Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5a98077
Mention `@bors squash` in squashing documentation
Kobzol Feb 28, 2026
1ec1e10
Merge pull request #2785 from Kobzol/bors-squash
Kobzol Mar 1, 2026
0b9fb67
Prepare for merging from rust-lang/rust
invalid-email-address Mar 2, 2026
aa57821
Merge ref 'e7d90c695a39' from rust-lang/rust
invalid-email-address Mar 2, 2026
22a111a
Merge pull request #2787 from rust-lang/rustc-pull
tshepang Mar 2, 2026
aabb3d8
Update query documentation to reflect QueryKey changes
reddevilmidzy Mar 8, 2026
25dcaa1
Merge pull request #2790 from reddevilmidzy/query
reddevilmidzy Mar 8, 2026
bf4004a
Update conventions for TODO and FIXME comments
reddevilmidzy Mar 8, 2026
d1f5438
Merge pull request #2789 from reddevilmidzy/todo-fixme
tshepang Mar 8, 2026
c159475
Fix typo in feature gate check
reddevilmidzy Mar 9, 2026
e4d4287
Merge pull request #2791 from rust-lang/fix
reddevilmidzy Mar 9, 2026
91c3763
Prepare for merging from rust-lang/rust
invalid-email-address Mar 9, 2026
5e98580
Merge ref 'eda4fc7733ee' from rust-lang/rust
invalid-email-address Mar 9, 2026
0f3f57f
Merge pull request #2792 from rust-lang/rustc-pull
tshepang Mar 9, 2026
752f75d
document that older LLVM versions come with increased risk
RalfJung Mar 9, 2026
903ecb4
Merge pull request #2793 from RalfJung/llvm
tshepang Mar 9, 2026
a5f88c7
add autodiff download instructions
ZuseZ4 Mar 10, 2026
5cbdf84
Merge pull request #2788 from rust-lang/update-autodiff-installation
ZuseZ4 Mar 10, 2026
4bd7718
Remove emoji :)
reddevilmidzy Mar 10, 2026
16050b6
Merge pull request #2794 from rust-lang/reddevilmidzy-patch-1
reddevilmidzy Mar 10, 2026
5e305ab
sembr src/backend/updating-llvm.md
tshepang Mar 12, 2026
5de87cd
sembr src/diagnostics/translation.md
tshepang Mar 12, 2026
7963b55
sembr src/git.md
tshepang Mar 12, 2026
751562f
sembr src/tracing.md
tshepang Mar 12, 2026
da4f9a7
Merge pull request #2795 from rust-lang/tshepang/sembr
tshepang Mar 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c78a29473a68f07012904af11c92ecffa68fcc75
eda4fc7733ee89e484d7120cafbd80dcb2fce66e
49 changes: 48 additions & 1 deletion src/doc/rustc-dev-guide/src/autodiff/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# Installation

In the near future, `std::autodiff` should become available in nightly builds for users. As a contributor however, you will still need to build rustc from source. Please be aware that the msvc target is not supported at the moment, all other tier 1 targets should work. Please open an issue if you encounter any problems on a supported tier 1 target, or if you successfully build this project on a tier2/tier3 target.
In the near future, `std::autodiff` should become available for users via rustup. As a rustc/enzyme/autodiff contributor however, you will still need to build rustc from source.
For the meantime, you can download up-to-date builds to enable `std::autodiff` on your latest nightly toolchain, if you are using either of:
**Linux**, with `x86_64-unknown-linux-gnu` or `aarch64-unknown-linux-gnu`
**Windows**, with `x86_64-llvm-mingw` or `aarch64-llvm-mingw`

You can also download slightly outdated builds for **Apple** (aarch64-apple), which should generally work for now.

If you need any other platform, you can build rustc including autodiff from source. Please open an issue if you want to help enabling automatic builds for your prefered target.

## Installation guide

If you want to use `std::autodiff` and don't plan to contribute PR's to the project, then we recommend to just use your existing nightly installation and download the missing component. In the future, rustup will be able to do it for you.
For now, you'll have to manually download and copy it.

1) On our github repository, find the last merged PR: [`Repo`]
2) Scroll down to the lower end of the PR, where you'll find a rust-bors message saying `Test successful` with a `CI` link.
3) Click on the `CI` link, and grep for your target. E.g. `dist-x86_64-linux` or `dist-aarch64-llvm-mingw` and click `Load summary`.
4) Under the `CI artifacts` section, find the `enzyme-nightly` artifact, download, and unpack it.
5) Copy the artifact (libEnzyme-22.so for linux, libEnzyme-22.dylib for apple, etc.), which should be in a folder named `enzyme-preview`, to your rust toolchain directory. E.g. for linux: `cp ~/Downloads/enzyme-nightly-x86_64-unknown-linux-gnu/enzyme-preview/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib`

Apple support was temporarily reverted, due to downstream breakages. If you want to download autodiff for apple, please look at the artifacts from this [`run`].

## Installation guide for Nix user.

This setup was recommended by a nix and autodiff user. It uses [`Overlay`]. Please verify for yourself if you are comfortable using that repository.
In that case you might use the following nix configuration to get a rustc that supports `std::autodiff`.
```nix
{
enzymeLib = pkgs.fetchzip {
url = "https://ci-artifacts.rust-lang.org/rustc-builds/ec818fda361ca216eb186f5cf45131bd9c776bb4/enzyme-nightly-x86_64-unknown-linux-gnu.tar.xz";
sha256 = "sha256-Rnrop44vzS+qmYNaRoMNNMFyAc3YsMnwdNGYMXpZ5VY=";
};

rustToolchain = pkgs.symlinkJoin {
name = "rust-with-enzyme";
paths = [pkgs.rust-bin.nightly.latest.default];
nativeBuildInputs = [pkgs.makeWrapper];
postBuild = ''
libdir=$out/lib/rustlib/x86_64-unknown-linux-gnu/lib
cp ${enzymeLib}/enzyme-preview/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so $libdir/
wrapProgram $out/bin/rustc --add-flags "--sysroot $out"
'';
};
}
```

## Build instructions

Expand Down Expand Up @@ -87,3 +131,6 @@ ninja
```
This will build Enzyme, and you can find it in `Enzyme/enzyme/build/lib/<LLD/Clang/LLVM/lib>Enzyme.so`. (Endings might differ based on your OS).

[`Repo`]: https://github.com/rust-lang/rust/
[`run`]: https://github.com/rust-lang/rust/pull/153026#issuecomment-3950046599
[`Overlay`]: https://github.com/oxalica/rust-overlay
7 changes: 6 additions & 1 deletion src/doc/rustc-dev-guide/src/backend/updating-llvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ Rust supports building against multiple LLVM versions:
* Tip-of-tree for the current LLVM development branch is usually supported within a few days.
PRs for such fixes are tagged with `llvm-main`.
* The latest released major version is always supported.
* The one or two preceding major versions are usually supported.
* The one or two preceding major versions are usually supported in the sense that they are expected
to build successfully and pass most tests.
However, fixes for miscompilations often do not get
backported to past LLVM versions, so using rustc with older versions of LLVM comes with an
increased risk of soundness bugs.
We strongly recommend using the latest version of LLVM.

By default, Rust uses its own fork in the [rust-lang/llvm-project repository].
This fork is based on a `release/$N.x` branch of the upstream project, where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Also, using `x` rather than `x.py` is recommended as:
Notice that this is not absolute.
For instance, using Nushell in VSCode on Win10,
typing `x` or `./x` still opens `x.py` in an editor rather than invoking the program.
:)

In the rest of this guide, we use `x` rather than `x.py` directly.
The following command:
Expand Down
2 changes: 2 additions & 0 deletions src/doc/rustc-dev-guide/src/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ if foo {
}
```

If you want to leave a note in the codebase, use `// FIXME` instead.

<a id="cio"></a>

## Using crates from crates.io
Expand Down
3 changes: 1 addition & 2 deletions src/doc/rustc-dev-guide/src/diagnostics/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ There are two ways of writing translatable diagnostics:
("Simple" diagnostics being those that don't require a lot of logic in
deciding to emit subdiagnostics and can therefore be represented as diagnostic structs).
See [the diagnostic and subdiagnostic structs documentation](./diagnostic-structs.md).
2. Using typed identifiers with `Diag` APIs (in
`Diagnostic` or `Subdiagnostic` implementations).
2. Using typed identifiers with `Diag` APIs (in `Diagnostic` or `Subdiagnostic` implementations).

When adding or changing a translatable diagnostic,
you don't need to worry about the translations.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc-dev-guide/src/feature-gate-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nightly-only `#![feature(...)]` opt-in.
This chapter documents the implementation
of feature gating: where gates are defined, how they are enabled, and how usage is verified.

<!-- data-check: Feb 2026 -->
<!-- date-check: Feb 2026 -->

## Feature Definitions

Expand Down
12 changes: 7 additions & 5 deletions src/doc/rustc-dev-guide/src/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ Both the upside and downside of this is that it simplifies the history.
On the one hand, you lose track of the steps in which changes were made, but
the history becomes easier to work with.

The easiest way to squash your commits in a PR on the `rust-lang/rust` repository is to use the `@bors squash` command in a comment on the PR.
By default, [bors] combines all commit messages of the PR into the squashed commit message.
To customize the commit message, use `@bors squash msg=<commit message>`.


If you want to squash commits using local git operations, read on below.

If there are no conflicts and you are just squashing to clean up the history,
use `git rebase --interactive --keep-base main`.
This keeps the fork point of your PR the same, making it easier to review the diff of what happened
Expand Down Expand Up @@ -410,11 +417,6 @@ because they only represent "fixups" and not real changes.
For example,
`git rebase --interactive HEAD~2` will allow you to edit the two commits only.

For pull requests in `rust-lang/rust`, you can ask [bors] to squash by commenting
`@bors squash` on the PR.
By default, [bors] combines all commit messages in the PR.
To customize the commit message, use `@bors squash [msg|message=<commit-message>]`.

[bors]: https://github.com/rust-lang/bors

### `git range-diff`
Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustc-dev-guide/src/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dependencies of the local crate)
Note that what determines the crate that a query is targeting is not the *kind* of query, but the *key*.
For example, when you invoke `tcx.type_of(def_id)`, that could be a
local query or an external query, depending on what crate the `def_id`
is referring to (see the [`self::keys::Key`][Key] trait for more information on how that works).
is referring to (see the [`self::keys::QueryKey`][QueryKey] trait for more information on how that works).

Providers always have the same signature:

Expand Down Expand Up @@ -308,7 +308,7 @@ Let's go over these elements one by one:
Also used as the name of a struct (`ty::queries::type_of`) that will be generated to represent
this query.
- **Query key type:** the type of the argument to this query.
This type must implement the [`ty::query::keys::Key`][Key] trait, which
This type must implement the [`ty::query::keys::QueryKey`][QueryKey] trait, which
defines (for example) how to map it to a crate, and so forth.
- **Result type of query:** the type produced by this query.
This type should (a) not use `RefCell` or other interior mutability and (b) be
Expand All @@ -317,7 +317,7 @@ Let's go over these elements one by one:
- **Query modifiers:** various flags and options that customize how the
query is processed (mostly with respect to [incremental compilation][incrcomp]).

[Key]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/query/keys/trait.Key.html
[QueryKey]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/query/keys/trait.QueryKey.html
[incrcomp]: queries/incremental-compilation-in-detail.html#query-modifiers

So, to add a query:
Expand Down
4 changes: 2 additions & 2 deletions src/doc/rustc-dev-guide/src/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ of `tracing-subscriber`](https://docs.rs/tracing-subscriber/0.2.24/tracing_subsc

## Environment variables

This is an overview of the environment variables rustc accepts to customize
its tracing output. The definition of these can mostly be found in `compiler/rustc_log/src/lib.rs`.
This is an overview of the environment variables rustc accepts to customize its tracing output.
The definition of these can mostly be found in `compiler/rustc_log/src/lib.rs`.

| Name | Usage |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
Expand Down
Loading