From de47decebbbd8645708a47a2a7c11c58a268ac87 Mon Sep 17 00:00:00 2001 From: Ali Nazzal Date: Sun, 31 Aug 2025 09:51:47 +0300 Subject: [PATCH 01/11] docs(rustdoc): document that JS/TS checks run under tidy (eslint, es-check, tsc) --- src/doc/rustc-dev-guide/src/rustdoc.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/doc/rustc-dev-guide/src/rustdoc.md b/src/doc/rustc-dev-guide/src/rustdoc.md index 9290fcd3b41cb..4181c2f7f170f 100644 --- a/src/doc/rustc-dev-guide/src/rustdoc.md +++ b/src/doc/rustc-dev-guide/src/rustdoc.md @@ -60,6 +60,18 @@ does is call the `main()` that's in this crate's `lib.rs`, though.) * Use `./x test tests/rustdoc*` to run the tests using a stage1 rustdoc. * See [Rustdoc internals] for more information about tests. +* Use `./x.py test tidy --extra-checks=js` to run rustdoc’s JavaScript checks (`eslint`, `es-check`, and `tsc`). +> **Note:** `./x.py test tidy` already runs these checks automatically when JS/TS sources changed; `--extra-checks=js` forces them explicitly. + +### JavaScript CI checks + +Rustdoc’s JavaScript and TypeScript are checked during CI by `eslint`, `es-check`, and `tsc` (not by compiletest). These run as part of the `tidy` job. + +```bash +./x.py test tidy --extra-checks=js +``` + +The `--extra-checks=js` flag enables the frontend linting that runs in CI. [`bootstrap.toml`]: ./building/how-to-build-and-run.md From 9adc741bc4216d9f7c99ba25946372b7124db8b1 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 3 Sep 2025 21:46:06 +0200 Subject: [PATCH 02/11] rename primary git branch --- src/doc/rustc-dev-guide/.github/workflows/ci.yml | 2 +- src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml | 2 +- src/doc/rustc-dev-guide/book.toml | 2 +- src/doc/rustc-dev-guide/ci/linkcheck.sh | 2 +- src/doc/rustc-dev-guide/src/rustc-driver/intro.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index 2dd695b7a4733..79d03080dce38 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - master + - main pull_request: schedule: # Run multiple times a day as the successfull cached links are not checked every time. diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index 5ff3118960da6..fd21b149db8f1 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -14,7 +14,7 @@ jobs: github-app-id: ${{ vars.APP_CLIENT_ID }} zulip-stream-id: 196385 zulip-bot-email: "rustc-dev-guide-gha-notif-bot@rust-lang.zulipchat.com" - pr-base-branch: master + pr-base-branch: main branch-name: rustc-pull secrets: zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }} diff --git a/src/doc/rustc-dev-guide/book.toml b/src/doc/rustc-dev-guide/book.toml index daf237ed9081b..efb13101c8de2 100644 --- a/src/doc/rustc-dev-guide/book.toml +++ b/src/doc/rustc-dev-guide/book.toml @@ -11,7 +11,7 @@ command = "mdbook-mermaid" [output.html] git-repository-url = "https://github.com/rust-lang/rustc-dev-guide" -edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/edit/master/{path}" +edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/edit/main/{path}" additional-js = [ "mermaid.min.js", "mermaid-init.js", diff --git a/src/doc/rustc-dev-guide/ci/linkcheck.sh b/src/doc/rustc-dev-guide/ci/linkcheck.sh index e5184839be02f..867b427eafbbe 100755 --- a/src/doc/rustc-dev-guide/ci/linkcheck.sh +++ b/src/doc/rustc-dev-guide/ci/linkcheck.sh @@ -32,7 +32,7 @@ elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] ; then # running in PR CI build echo "Checking files changed since $BASE_SHA: $CHANGED_FILES" else # running locally - COMMIT_RANGE=master... + COMMIT_RANGE=main... CHANGED_FILES=$(git diff --name-only $COMMIT_RANGE | sed 's#^src/##' | tr '\n' ' ') FLAGS="-f $CHANGED_FILES" diff --git a/src/doc/rustc-dev-guide/src/rustc-driver/intro.md b/src/doc/rustc-dev-guide/src/rustc-driver/intro.md index a3684397b2995..32d27d218197d 100644 --- a/src/doc/rustc-dev-guide/src/rustc-driver/intro.md +++ b/src/doc/rustc-dev-guide/src/rustc-driver/intro.md @@ -34,7 +34,7 @@ specifically [`rustc_driver_impl::run_compiler`][rdi_rc] [`rustc_driver`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/ [`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html [`Callbacks`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/trait.Callbacks.html -[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-interface-example.rs +[example]: https://github.com/rust-lang/rustc-dev-guide/blob/main/examples/rustc-interface-example.rs [i_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/fn.run_compiler.html [rd_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/fn.run_compiler.html [rdi_rc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver_impl/fn.run_compiler.html From 88f954453f794e7eaa16a4cb78b63e0777e12c20 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 22 Sep 2025 20:45:37 +0200 Subject: [PATCH 03/11] compiler-team.md: remove obsolete membership level There used to be compiler team and compiler-contributor team, and those have since been collapsed into 1 team. --- src/doc/rustc-dev-guide/src/compiler-team.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/compiler-team.md b/src/doc/rustc-dev-guide/src/compiler-team.md index 896d9e6f6d94c..8c0481f6ea8f5 100644 --- a/src/doc/rustc-dev-guide/src/compiler-team.md +++ b/src/doc/rustc-dev-guide/src/compiler-team.md @@ -134,12 +134,3 @@ Getting on the reviewer rotation is much appreciated as it lowers the review burden for all of us! However, if you don't have time to give people timely feedback on their PRs, it may be better that you don't get on the list. - -### Full team membership - -Full team membership is typically extended once someone made many -contributions to the Rust compiler over time, ideally (but not -necessarily) to multiple areas. Sometimes this might be implementing a -new feature, but it is also important — perhaps more important! — to -have time and willingness to help out with general upkeep such as -bugfixes, tracking regressions, and other less glamorous work. From 92e65dc4d485e464204346557c228374a8828f7c Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 29 Sep 2025 18:39:39 +0200 Subject: [PATCH 04/11] how-to-build-and-run.md: replace "rm build" with "x clean --all" --- src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md index 36610f28854b5..f8ee9629f0474 100644 --- a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md +++ b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md @@ -187,7 +187,7 @@ Alternatively, you can write `bootstrap.toml` by hand. See `bootstrap.example.to settings and explanations of them. See `src/bootstrap/defaults` for common settings to change. If you have already built `rustc` and you change settings related to LLVM, then you may have to -execute `rm -rf build` for subsequent configuration changes to take effect. Note that `./x +execute `./x clean --all` for subsequent configuration changes to take effect. Note that `./x clean` will not cause a rebuild of LLVM. ## Common `x` commands From eaeca967785ef51145016839bb7f8ceec876ae1c Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 29 Sep 2025 18:58:03 +0200 Subject: [PATCH 05/11] how-to-build-and-run.md: update "building compiler" section --- .../src/building/how-to-build-and-run.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md index 36610f28854b5..fb4da9c187eaf 100644 --- a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md +++ b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md @@ -226,16 +226,17 @@ Once you've created a `bootstrap.toml`, you are now ready to run `x`. There are a lot of options here, but let's start with what is probably the best "go to" command for building a local compiler: -```bash -./x build library +```console +./x build rustc ``` -This may *look* like it only builds the standard library, but that is not the case. -What this command does is the following: +What this command does is build `rustc` using the stage0 compiler and stage0 `std`. + +To build `rustc` with the in-tree `std`, use this command instead: -- Build `rustc` using the stage0 compiler - - This produces the stage1 compiler -- Build `std` using the stage1 compiler +```console +./x build rustc --stage 2 +``` This final product (stage1 compiler + libs built using that compiler) is what you need to build other Rust programs (unless you use `#![no_std]` or @@ -253,7 +254,7 @@ signature of some function, you can use `./x check` instead for a much faster bu Note that this whole command just gives you a subset of the full `rustc` build. The **full** `rustc` build (what you get with `./x build ---stage 2 compiler/rustc`) has quite a few more steps: +--stage 2 rustc`) has quite a few more steps: - Build `rustc` with the stage1 compiler. - The resulting compiler here is called the "stage2" compiler, which uses stage1 std from the previous command. From 74caed9a4502c97c44d9c578e8ba50500da3d8fb Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 3 Oct 2025 15:15:45 +0200 Subject: [PATCH 06/11] cg_gcc.md: add missing quote --- .../rustc-dev-guide/src/tests/codegen-backend-tests/cg_gcc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/tests/codegen-backend-tests/cg_gcc.md b/src/doc/rustc-dev-guide/src/tests/codegen-backend-tests/cg_gcc.md index 74dbfb7d31b30..aa337754186d6 100644 --- a/src/doc/rustc-dev-guide/src/tests/codegen-backend-tests/cg_gcc.md +++ b/src/doc/rustc-dev-guide/src/tests/codegen-backend-tests/cg_gcc.md @@ -20,7 +20,7 @@ rust.codegen-backends = ["llvm", "gcc"] ``` If you don't want to change your `bootstrap.toml` file, you can alternatively run your `x` -commands with `--set rust.codegen-backends=["llvm", "gcc"]'`. For example: +commands with `--set 'rust.codegen-backends=["llvm", "gcc"]'`. For example: ```bash ./x build --set 'rust.codegen-backends=["llvm", "gcc"]' From a175921d5e67997e359e71dc1602bd1e3547c0d7 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sat, 4 Oct 2025 23:52:33 -0400 Subject: [PATCH 07/11] update libEnzyme file name, and add missing strict-aliasing flag --- src/doc/rustc-dev-guide/src/autodiff/debugging.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/autodiff/debugging.md b/src/doc/rustc-dev-guide/src/autodiff/debugging.md index bd46a66fade47..a66d775d98264 100644 --- a/src/doc/rustc-dev-guide/src/autodiff/debugging.md +++ b/src/doc/rustc-dev-guide/src/autodiff/debugging.md @@ -16,7 +16,7 @@ Before generating the llvm-ir, keep in mind two techniques that can help ensure ## 1) Generate an llvm-ir reproducer ```sh -rustflags="-z autodiff=enable,printmodbefore" cargo +enzyme build --release &> out.ll +RUSTFLAGS="-Z autodiff=Enable,PrintModbefore" cargo +enzyme build --release &> out.ll ``` This also captures a few warnings and info messages above and below your module. open out.ll and remove every line above `; moduleid = `. Now look at the end of the file and remove everything that's not part of llvm-ir, i.e. remove errors and warnings. The last line of your llvm-ir should now start with `! = `, i.e. `!40831 = !{i32 0, i32 1037508, i32 1037538, i32 1037559}` or `!43760 = !dilocation(line: 297, column: 5, scope: !43746)`. @@ -25,10 +25,10 @@ The actual numbers will depend on your code. ## 2) Check your llvm-ir reproducer -To confirm that your previous step worked, we will use llvm's `opt` tool. find your path to the opt binary, with a path similar to `/rust/build//build/bin/opt`. also find `llvmenzyme-19.` path, similar to `/rust/build/target-tripple/enzyme/build/enzyme/llvmenzyme-19`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command: +To confirm that your previous step worked, we will use llvm's `opt` tool. find your path to the opt binary, with a path similar to `/rust/build//build/bin/opt`. also find `llvmenzyme-19.` path, similar to `/rust/build/target-triple/enzyme/build/enzyme/llvmenzyme-19`. Please keep in mind that llvm frequently updates it's llvm backend, so the version number might be higher (20, 21, ...). Once you have both, run the following command: ```sh - out.ll -load-pass-plugin=/path/to/llvmenzyme-19.so -passes="enzyme" -s + out.ll -load-pass-plugin=/path/to/build//stage1/lib/libEnzyme-21.so -passes="enzyme" -enzyme-strict-aliasing=0 -s ``` If the previous step succeeded, you are going to see the same error that you saw when compiling your rust code with cargo. From 765e2fe6eed09e4fb61702ede01362336b6250e7 Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Sun, 5 Oct 2025 01:38:29 -0400 Subject: [PATCH 08/11] Add potential instability warning --- src/doc/rustc-dev-guide/src/autodiff/debugging.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustc-dev-guide/src/autodiff/debugging.md b/src/doc/rustc-dev-guide/src/autodiff/debugging.md index a66d775d98264..97893535cfe54 100644 --- a/src/doc/rustc-dev-guide/src/autodiff/debugging.md +++ b/src/doc/rustc-dev-guide/src/autodiff/debugging.md @@ -30,6 +30,7 @@ To confirm that your previous step worked, we will use llvm's `opt` tool. find y ```sh out.ll -load-pass-plugin=/path/to/build//stage1/lib/libEnzyme-21.so -passes="enzyme" -enzyme-strict-aliasing=0 -s ``` +This command might fail for future versions or on your system, in which case you should replace libEnzyme-21.so with LLVMEnzyme-21.so. Look at the Enzyme docs for instructions on how to build it. You might need to also adjust how to build your LLVM version. If the previous step succeeded, you are going to see the same error that you saw when compiling your rust code with cargo. From f54139aa310b4cd2cb2bfc144eec865464a8cc09 Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Mon, 6 Oct 2025 04:13:15 +0000 Subject: [PATCH 09/11] Prepare for merging from rust-lang/rust This updates the rust-version file to 4fa824bb78318a3cba8c7339d5754b4909922547. --- src/doc/rustc-dev-guide/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index 0dc9ce843e9c9..47552aee08f74 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -9f32ccf35fb877270bc44a86a126440f04d676d0 +4fa824bb78318a3cba8c7339d5754b4909922547 From 98afeb86453540ebdea0af21ba5064caed6b089b Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 6 Oct 2025 07:06:27 +0200 Subject: [PATCH 10/11] fix text describing edition range testing --- src/doc/rustc-dev-guide/src/tests/directives.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 3b6c891746455..25c8a4c354ab6 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -264,11 +264,16 @@ Consider writing the test as a proper incremental test instead. #### The edition directive -The `//@ edition` directive can take an exact edition, a bounded half-open range of editions or a left-bounded half-open range of editions, this affects which edition is used by `./x test` to run the test. For example: +The `//@ edition` directive can take an exact edition, a bounded range of editions, or a left-bounded half-open range of editions. +This affects which edition is used by `./x test` to run the test. + +For example: - A test with the `//@ edition: 2018` directive will only run under the 2018 edition. -- A test with the `//@ edition: 2015..2021` directive can be run under both the 2015 and 2018 editions. However, CI will only run the test with the lowest edition possible (2015 in this case). -- A test with the `//@ edition: 2018..` directive will run under any edition greater or equal than 2018. However, CI will only run the test with the lowest edition possible (2018 in this case). +- A test with the `//@ edition: 2015..2021` directive can be run under the 2015, 2018, and 2021 editions. + However, CI will only run the test with the lowest edition in the range (which is 2015 in this example). +- A test with the `//@ edition: 2018..` directive will run under 2018 edition or greater. + However, CI will only run the test with the lowest edition in the range (which is 2018 in this example). You can also force `./x test` to use a specific edition by passing the `-- --edition=` argument. However, tests with the `//@ edition` directive will clamp the value passed to the argument. For example, if we run `./x test -- --edition=2015`: From 2d6f590af115f16c57796162703cca62a5860ebd Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 6 Oct 2025 07:13:01 +0200 Subject: [PATCH 11/11] overlong --- src/doc/rustc-dev-guide/src/tests/directives.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 25c8a4c354ab6..2c6cfeb0ac702 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -264,7 +264,8 @@ Consider writing the test as a proper incremental test instead. #### The edition directive -The `//@ edition` directive can take an exact edition, a bounded range of editions, or a left-bounded half-open range of editions. +The `//@ edition` directive can take an exact edition, a bounded range of editions, +or a left-bounded half-open range of editions. This affects which edition is used by `./x test` to run the test. For example: @@ -275,7 +276,9 @@ For example: - A test with the `//@ edition: 2018..` directive will run under 2018 edition or greater. However, CI will only run the test with the lowest edition in the range (which is 2018 in this example). -You can also force `./x test` to use a specific edition by passing the `-- --edition=` argument. However, tests with the `//@ edition` directive will clamp the value passed to the argument. For example, if we run `./x test -- --edition=2015`: +You can also force `./x test` to use a specific edition by passing the `-- --edition=` argument. +However, tests with the `//@ edition` directive will clamp the value passed to the argument. +For example, if we run `./x test -- --edition=2015`: - A test with the `//@ edition: 2018` will run with the 2018 edition. - A test with the `//@ edition: 2015..2021` will be run with the 2015 edition.