Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to contribute to Rust and what I have recently been working on

TaKO8Ki
June 15, 2022

How to contribute to Rust and what I have recently been working on

TaKO8Ki

June 15, 2022
Tweet

More Decks by TaKO8Ki

Other Decks in Technology

Transcript

  1. How to contribute to Rust and what I have recently

    been working on Takayuki Maeda (@TaKO8Ki)
  2. About myself Takayuki Maeda at CTO Office GitHub: @TaKO8Ki Twitter:

    @TaKOBKi Pull requests I created in rust-lang/rust
  3. Guide to Rustc Development Building and debugging rustc Contributing to

    rustc High-Level Compiler Architecture Source Code Representation Analysis From MIR to Binaries Appendices has seven parts: 1. 2. 3. 4. 5. 6. 7.
  4. Guide to Rustc Development Building and debugging rustc Contributing to

    rustc High-Level Compiler Architecture Source Code Representation Analysis From MIR to Binaries Appendices has seven parts: 1. 2. 3. 4. 5. 6. 7.
  5. $ git clone https://github.com/rust-lang/rust.git $ cd rust Building rustc –

    the Rust compiler – rustc is a bootstrapping compiler $ ./x.py setup
  6. Building rustc – the Rust compiler – ./x.py setup creates

    config.toml [rust] debug-logging = true # Leave debug! and trace! calls in rustc? incremental = true # Build rustc with incremental compilation?
  7. Building rustc – the Rust compiler – Build a compiler

    $ ./x.py build If you want to use incremental compilation $ ./x.py build -i library/std
  8. Building rustc – the Rust compiler – Build std using

    the stage0 compiler (using incremental) Build rustc using the stage0 compiler (using incremental) This produces the stage1 compiler Build std using the stage1 compiler (cannot use incremental) This command does the following things: $ ./x.py build -i library/std
  9. Building rustc – the Rust compiler – You cannot use

    incremental compilation for stage1 libraries.This is because incremental only works when you run the same compiler twice in a row.
  10. Building rustc – the Rust compiler – $ rustup toolchain

    link stage1 build/<host- triple>/stage1 Create rustup toolchains Then you can run $ rustc +stage1 -vV $ cargo +stage1 build
  11. Testing rustc $ ./x.py test src/test/ui If you want to

    run rustc ui tests If you want to run specific tests $ ./x.py test src/test/ui --test-args 'derives'
  12. Debugging rustc $ RUSTC_LOG=rustc_middle::traits=debug cargo +stage1 build You can use

    module level filters You can use the other filters such as function level filters and query level filters.
  13. Find issues If you are interested in developing a parser

    → A-parser (Area: The parsing of Rust source code to an AST.) If you are interested in developing a rustdoc → T-rustdoc (Relevant to the rustdoc Team, which will review and decide on the PR/issue.) https://github.com/rust-lang/rust/issues There are some labels like the following:
  14. If you have any questions The best way to get

    started is by asking for help in the #new members Zulip stream.
  15. macro_rules! foo { () => {}; } pub use foo;

    Given the following code: Issue #98087
  16. Issue #98087 The current output is: However, you need to

    use `# [macro_export]` to make the macro public.
  17. Issue #98087 To solve this problem, I implemented struct `MacroData`

    including a flag for checking if a macro is `decl_macro` or not.