authorbors <bors@rust-lang.org> 2026-03-12 11:32:41 UTC
committerbors <bors@rust-lang.org> 2026-03-12 11:32:41 UTC
logd097a0cba9a42f8e37bd28d0d219e433938981ec
tree6ca7bd5277adadac6552348feeab3aa344ab19f3
parentd1ee5e59a964a419b84b760812a35075034f4861
parentcf8e79fa9ad9e61deabbba95cb017a27a0d41675

Auto merge of #153770 - JonathanBrouwer:rollup-522Yrag, r=JonathanBrouwer

Rollup of 10 pull requests Successful merges: - rust-lang/rust#153726 (Add optional CI job to build the compiler with the parallel frontend) - rust-lang/rust#153763 (Don't add empty target features for target-cpu=native on macOS) - rust-lang/rust#153432 (Fix some comments about dataflow analysis.) - rust-lang/rust#153529 (Fix LegacyKeyValueFormat report from docker build: pr) - rust-lang/rust#153694 (fix(query): Pass Query Key to `value_from_cycle_error`) - rust-lang/rust#153717 (unused_macro_rules switched used and unused comments) - rust-lang/rust#153736 (add test that an incomplete feature emits a warning) - rust-lang/rust#153748 (editorconfig: css uses tabs) - rust-lang/rust#153750 (rustc-dev-guide subtree update) - rust-lang/rust#153762 (actually make the is-fn test test what it says it tests)

35 files changed, 287 insertions(+), 83 deletions(-)

.editorconfig+3
......@@ -12,6 +12,9 @@ trim_trailing_whitespace = true
1212indent_style = space
1313indent_size = 4
1414
15[*.css]
16indent_style = tab
17
1518# some tests need trailing whitespace in output snapshots
1619[tests/**]
1720trim_trailing_whitespace = false
compiler/rustc_codegen_llvm/src/llvm_util.rs+3-1
......@@ -702,7 +702,9 @@ pub(crate) fn global_llvm_features(sess: &Session, only_base_features: bool) ->
702702
703703 features_string
704704 };
705 features.extend(features_string.split(',').map(String::from));
705 if !features_string.is_empty() {
706 features.extend(features_string.split(',').map(String::from));
707 }
706708 }
707709 Some(_) | None => {}
708710 };
compiler/rustc_feature/src/unstable.rs+2
......@@ -257,6 +257,8 @@ declare_features! (
257257 (internal, rustc_attrs, "1.0.0", None),
258258 /// Allows using the `#[stable]` and `#[unstable]` attributes.
259259 (internal, staged_api, "1.0.0", None),
260 /// Perma-unstable, only used to test the `incomplete_features` lint.
261 (incomplete, test_incomplete_feature, "CURRENT_RUSTC_VERSION", None),
260262 /// Added for testing unstable lints; perma-unstable.
261263 (internal, test_unstable_lint, "1.60.0", None),
262264 /// Use for stable + negative coherence and strict coherence depending on trait's
compiler/rustc_lint_defs/src/builtin.rs+2-2
......@@ -1033,8 +1033,8 @@ declare_lint! {
10331033 /// ```rust
10341034 /// #[warn(unused_macro_rules)]
10351035 /// macro_rules! unused_empty {
1036 /// (hello) => { println!("Hello, world!") }; // This rule is unused
1037 /// () => { println!("empty") }; // This rule is used
1036 /// (hello) => { println!("Hello, world!") }; // This rule is used
1037 /// () => { println!("empty") }; // This rule is unused
10381038 /// }
10391039 ///
10401040 /// fn main() {
compiler/rustc_middle/src/mir/basic_blocks.rs+1-1
......@@ -65,7 +65,7 @@ impl<'tcx> BasicBlocks<'tcx> {
6565
6666 /// Returns basic blocks in a reverse postorder.
6767 ///
68 /// See [`traversal::reverse_postorder`]'s docs to learn what is preorder traversal.
68 /// See [`traversal::reverse_postorder`]'s docs to learn what is postorder traversal.
6969 ///
7070 /// [`traversal::reverse_postorder`]: crate::mir::traversal::reverse_postorder
7171 #[inline]
compiler/rustc_middle/src/query/plumbing.rs+6-2
......@@ -136,8 +136,12 @@ pub struct QueryVTable<'tcx, C: QueryCache> {
136136 /// For `no_hash` queries, this function pointer is None.
137137 pub hash_value_fn: Option<fn(&mut StableHashingContext<'_>, &C::Value) -> Fingerprint>,
138138
139 pub value_from_cycle_error:
140 fn(tcx: TyCtxt<'tcx>, cycle_error: CycleError, guar: ErrorGuaranteed) -> C::Value,
139 pub value_from_cycle_error: fn(
140 tcx: TyCtxt<'tcx>,
141 key: C::Key,
142 cycle_error: CycleError,
143 guar: ErrorGuaranteed,
144 ) -> C::Value,
141145 pub format_value: fn(&C::Value) -> String,
142146
143147 /// Formats a human-readable description of this query and its key, as
compiler/rustc_mir_dataflow/src/impls/initialized.rs+28-26
......@@ -109,21 +109,21 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
109109/// ```rust
110110/// struct S;
111111/// #[rustfmt::skip]
112/// fn foo(pred: bool) { // maybe-init:
113/// // {}
114/// let a = S; let mut b = S; let c; let d; // {a, b}
112/// fn foo(p: bool) { // maybe-init:
113/// // {p}
114/// let a = S; let mut b = S; let c; let d; // {p, a, b}
115115///
116/// if pred {
117/// drop(a); // { b}
118/// b = S; // { b}
116/// if p {
117/// drop(a); // {p, b}
118/// b = S; // {p, b}
119119///
120120/// } else {
121/// drop(b); // {a}
122/// d = S; // {a, d}
121/// drop(b); // {p, a}
122/// d = S; // {p, a, d}
123123///
124/// } // {a, b, d}
124/// } // {p, a, b, d}
125125///
126/// c = S; // {a, b, c, d}
126/// c = S; // {p, a, b, c, d}
127127/// }
128128/// ```
129129///
......@@ -199,11 +199,11 @@ impl<'a, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'tcx> {
199199/// ```rust
200200/// struct S;
201201/// #[rustfmt::skip]
202/// fn foo(pred: bool) { // maybe-uninit:
202/// fn foo(p: bool) { // maybe-uninit:
203203/// // {a, b, c, d}
204204/// let a = S; let mut b = S; let c; let d; // { c, d}
205205///
206/// if pred {
206/// if p {
207207/// drop(a); // {a, c, d}
208208/// b = S; // {a, c, d}
209209///
......@@ -279,34 +279,36 @@ impl<'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
279279 }
280280}
281281
282/// `EverInitializedPlaces` tracks all places that might have ever been
283/// initialized upon reaching a particular point in the control flow
284/// for a function, without an intervening `StorageDead`.
282/// `EverInitializedPlaces` tracks all initializations that may have occurred
283/// upon reaching a particular point in the control flow for a function,
284/// without an intervening `StorageDead`.
285285///
286286/// This dataflow is used to determine if an immutable local variable may
287287/// be assigned to.
288288///
289289/// For example, in code like the following, we have corresponding
290/// dataflow information shown in the right-hand comments.
290/// dataflow information shown in the right-hand comments. Underscored indices
291/// are used to distinguish between multiple initializations of the same local
292/// variable, e.g. `b_0` and `b_1`.
291293///
292294/// ```rust
293295/// struct S;
294296/// #[rustfmt::skip]
295/// fn foo(pred: bool) { // ever-init:
296/// // { }
297/// let a = S; let mut b = S; let c; let d; // {a, b }
297/// fn foo(p: bool) { // ever-init:
298/// // {p, }
299/// let a = S; let mut b = S; let c; let d; // {p, a, b_0, }
298300///
299/// if pred {
300/// drop(a); // {a, b, }
301/// b = S; // {a, b, }
301/// if p {
302/// drop(a); // {p, a, b_0, }
303/// b = S; // {p, a, b_0, b_1, }
302304///
303305/// } else {
304/// drop(b); // {a, b, }
305/// d = S; // {a, b, d }
306/// drop(b); // {p, a, b_0, b_1, }
307/// d = S; // {p, a, b_0, b_1, d}
306308///
307/// } // {a, b, d }
309/// } // {p, a, b_0, b_1, d}
308310///
309/// c = S; // {a, b, c, d }
311/// c = S; // {p, a, b_0, b_1, c, d}
310312/// }
311313/// ```
312314pub struct EverInitializedPlaces<'a, 'tcx> {
compiler/rustc_query_impl/src/execution.rs+7-5
......@@ -125,17 +125,18 @@ where
125125fn mk_cycle<'tcx, C: QueryCache>(
126126 query: &'tcx QueryVTable<'tcx, C>,
127127 tcx: TyCtxt<'tcx>,
128 key: C::Key,
128129 cycle_error: CycleError,
129130) -> C::Value {
130131 let error = report_cycle(tcx.sess, &cycle_error);
131132 match query.cycle_error_handling {
132133 CycleErrorHandling::Error => {
133134 let guar = error.emit();
134 (query.value_from_cycle_error)(tcx, cycle_error, guar)
135 (query.value_from_cycle_error)(tcx, key, cycle_error, guar)
135136 }
136137 CycleErrorHandling::DelayBug => {
137138 let guar = error.delay_as_bug();
138 (query.value_from_cycle_error)(tcx, cycle_error, guar)
139 (query.value_from_cycle_error)(tcx, key, cycle_error, guar)
139140 }
140141 }
141142}
......@@ -219,6 +220,7 @@ where
219220fn cycle_error<'tcx, C: QueryCache>(
220221 query: &'tcx QueryVTable<'tcx, C>,
221222 tcx: TyCtxt<'tcx>,
223 key: C::Key,
222224 try_execute: QueryJobId,
223225 span: Span,
224226) -> (C::Value, Option<DepNodeIndex>) {
......@@ -229,7 +231,7 @@ fn cycle_error<'tcx, C: QueryCache>(
229231 .expect("failed to collect active queries");
230232
231233 let error = find_cycle_in_stack(try_execute, job_map, &current_query_job(), span);
232 (mk_cycle(query, tcx, error.lift()), None)
234 (mk_cycle(query, tcx, key, error.lift()), None)
233235}
234236
235237#[inline(always)]
......@@ -274,7 +276,7 @@ fn wait_for_query<'tcx, C: QueryCache>(
274276
275277 (v, Some(index))
276278 }
277 Err(cycle) => (mk_cycle(query, tcx, cycle.lift()), None),
279 Err(cycle) => (mk_cycle(query, tcx, key, cycle.lift()), None),
278280 }
279281}
280282
......@@ -337,7 +339,7 @@ fn try_execute_query<'tcx, C: QueryCache, const INCR: bool>(
337339
338340 // If we are single-threaded we know that we have cycle error,
339341 // so we just return the error.
340 cycle_error(query, tcx, id, span)
342 cycle_error(query, tcx, key, id, span)
341343 }
342344 }
343345 ActiveKeyStatus::Poisoned => FatalError.raise(),
compiler/rustc_query_impl/src/from_cycle_error.rs+11-14
......@@ -15,34 +15,34 @@ use rustc_middle::query::erase::erase_val;
1515use rustc_middle::ty::layout::{LayoutError, TyAndLayout};
1616use rustc_middle::ty::{self, Ty, TyCtxt};
1717use rustc_middle::{bug, span_bug};
18use rustc_span::def_id::LocalDefId;
18use rustc_span::def_id::{DefId, LocalDefId};
1919use rustc_span::{ErrorGuaranteed, Span};
2020
2121use crate::job::report_cycle;
2222
2323pub(crate) fn specialize_query_vtables<'tcx>(vtables: &mut QueryVTables<'tcx>) {
2424 vtables.type_of.value_from_cycle_error =
25 |tcx, _, guar| erase_val(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
25 |tcx, _, _, guar| erase_val(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
2626
2727 vtables.type_of_opaque_hir_typeck.value_from_cycle_error =
28 |tcx, _, guar| erase_val(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
28 |tcx, _, _, guar| erase_val(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
2929
3030 vtables.erase_and_anonymize_regions_ty.value_from_cycle_error =
31 |tcx, _, guar| erase_val(Ty::new_error(tcx, guar));
31 |tcx, _, _, guar| erase_val(Ty::new_error(tcx, guar));
3232
33 vtables.fn_sig.value_from_cycle_error = |tcx, cycle, guar| erase_val(fn_sig(tcx, cycle, guar));
33 vtables.fn_sig.value_from_cycle_error = |tcx, key, _, guar| erase_val(fn_sig(tcx, key, guar));
3434
3535 vtables.check_representability.value_from_cycle_error =
36 |tcx, cycle, guar| check_representability(tcx, cycle, guar);
36 |tcx, _, cycle, guar| check_representability(tcx, cycle, guar);
3737
3838 vtables.check_representability_adt_ty.value_from_cycle_error =
39 |tcx, cycle, guar| check_representability(tcx, cycle, guar);
39 |tcx, _, cycle, guar| check_representability(tcx, cycle, guar);
4040
4141 vtables.variances_of.value_from_cycle_error =
42 |tcx, cycle, guar| erase_val(variances_of(tcx, cycle, guar));
42 |tcx, _, cycle, guar| erase_val(variances_of(tcx, cycle, guar));
4343
4444 vtables.layout_of.value_from_cycle_error =
45 |tcx, cycle, guar| erase_val(layout_of(tcx, cycle, guar));
45 |tcx, _, cycle, guar| erase_val(layout_of(tcx, cycle, guar));
4646}
4747
4848pub(crate) fn default<'tcx>(tcx: TyCtxt<'tcx>, cycle_error: CycleError, query_name: &str) -> ! {
......@@ -57,15 +57,12 @@ pub(crate) fn default<'tcx>(tcx: TyCtxt<'tcx>, cycle_error: CycleError, query_na
5757
5858fn fn_sig<'tcx>(
5959 tcx: TyCtxt<'tcx>,
60 cycle_error: CycleError,
60 def_id: DefId,
6161 guar: ErrorGuaranteed,
6262) -> ty::EarlyBinder<'tcx, ty::PolyFnSig<'tcx>> {
6363 let err = Ty::new_error(tcx, guar);
6464
65 let arity = if let Some(info) = cycle_error.cycle.get(0)
66 && info.frame.dep_kind == DepKind::fn_sig
67 && let Some(def_id) = info.frame.def_id
68 && let Some(node) = tcx.hir_get_if_local(def_id)
65 let arity = if let Some(node) = tcx.hir_get_if_local(def_id)
6966 && let Some(sig) = node.fn_sig()
7067 {
7168 sig.decl.inputs.len()
compiler/rustc_query_impl/src/plumbing.rs+1-1
......@@ -487,7 +487,7 @@ macro_rules! define_queries {
487487 #[cfg(not($cache_on_disk))]
488488 is_loadable_from_disk_fn: |_tcx, _key, _index| false,
489489
490 value_from_cycle_error: |tcx, cycle, _| {
490 value_from_cycle_error: |tcx, _, cycle, _| {
491491 $crate::from_cycle_error::default(tcx, cycle, stringify!($name))
492492 },
493493
compiler/rustc_span/src/symbol.rs+1
......@@ -2006,6 +2006,7 @@ symbols! {
20062006 test_2018_feature,
20072007 test_accepted_feature,
20082008 test_case,
2009 test_incomplete_feature,
20092010 test_removed_feature,
20102011 test_runner,
20112012 test_unstable_lint,
src/ci/citool/src/jobs.rs+6-4
......@@ -200,12 +200,14 @@ fn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> {
200200 equivalent_modulo_carve_out(pr_job, auto_job)?;
201201 }
202202
203 // Auto CI jobs must all "fail-fast" to avoid wasting Auto CI resources. For instance, `tidy`.
203 // Auto CI should "fail-fast" to avoid wasting Auto CI resources.
204 // However, some experimental auto jobs can be made optional, for example if we are unsure about
205 // their flakiness. Those have to be prefixed with `optional-`.
204206 for auto_job in &db.auto_jobs {
205 if auto_job.continue_on_error == Some(true) {
207 if auto_job.continue_on_error == Some(true) && !auto_job.name.starts_with("optional-") {
206208 return Err(anyhow!(
207 "Auto job `{}` cannot have `continue_on_error: true`",
208 auto_job.name
209 "Auto job `{job}` cannot have `continue_on_error: true`. If the job should be optional, name it `optional-{job}`.",
210 job = auto_job.name
209211 ));
210212 }
211213 }
src/ci/docker/host-x86_64/optional-x86_64-gnu-parallel-frontend/Dockerfile created+36
......@@ -0,0 +1,36 @@
1FROM ubuntu:22.04
2
3ARG DEBIAN_FRONTEND=noninteractive
4RUN apt-get update && apt-get install -y --no-install-recommends \
5 g++ \
6 make \
7 ninja-build \
8 file \
9 curl \
10 ca-certificates \
11 python3 \
12 git \
13 cmake \
14 sudo \
15 gdb \
16 libssl-dev \
17 pkg-config \
18 xz-utils \
19 mingw-w64 \
20 zlib1g-dev \
21 libzstd-dev \
22 && rm -rf /var/lib/apt/lists/*
23
24COPY scripts/sccache.sh /scripts/
25RUN sh /scripts/sccache.sh
26
27ENV RUST_CONFIGURE_ARGS \
28 --build=x86_64-unknown-linux-gnu \
29 --enable-sanitizers \
30 --enable-profiler \
31 --enable-compiler-docs \
32 --set llvm.libzstd=true
33
34# Build the toolchain with multiple parallel frontend threads and then run tests
35# Tests are still compiled serially at the moment (intended to be changed in follow-ups).
36ENV SCRIPT python3 ../x.py --stage 2 test --set rust.parallel-frontend-threads=4
src/ci/docker/host-x86_64/pr-check-1/Dockerfile+2-2
......@@ -39,7 +39,7 @@ COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
3939# Check library crates on all tier 1 targets.
4040# We disable optimized compiler built-ins because that requires a C toolchain for the target.
4141# We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs.
42ENV SCRIPT \
42ENV SCRIPT=" \
4343 # Check some tools that aren't included in `x check` by default, to
4444 # ensure that maintainers can still do check builds locally.
4545 python3 ../x.py check \
......@@ -58,4 +58,4 @@ ENV SCRIPT \
5858 python3 ../x.py check --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \
5959 /scripts/validate-toolstate.sh && \
6060 reuse --include-submodules lint && \
61 python3 ../x.py test collect-license-metadata
61 python3 ../x.py test collect-license-metadata"
src/ci/docker/host-x86_64/pr-check-2/Dockerfile+2-3
......@@ -30,8 +30,7 @@ ENV RUST_CONFIGURE_ARGS="--set rust.validate-mir-opts=3"
3030COPY scripts/sccache.sh /scripts/
3131RUN sh /scripts/sccache.sh
3232
33ENV SCRIPT \
34 python3 ../x.py check && \
33ENV SCRIPT="python3 ../x.py check && \
3534 python3 ../x.py clippy ci --stage 2 && \
3635 python3 ../x.py test --stage 1 core alloc std test proc_macro && \
3736 # Elsewhere, we run all tests for the host. A number of codegen tests are sensitive to the target pointer
......@@ -48,4 +47,4 @@ ENV SCRIPT \
4847 RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc library/test --stage 1 && \
4948 # The BOOTSTRAP_TRACING flag is added to verify whether the
5049 # bootstrap process compiles successfully with this flag enabled.
51 BOOTSTRAP_TRACING=1 python3 ../x.py --help
50 BOOTSTRAP_TRACING=1 python3 ../x.py --help"
src/ci/docker/host-x86_64/tidy/Dockerfile+2-2
......@@ -39,5 +39,5 @@ COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
3939
4040# NOTE: intentionally uses python2 for x.py so we can test it still works.
4141# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
42ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
43 src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck
42ENV SCRIPT="TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
43 src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck"
src/ci/github-actions/jobs.yml+5
......@@ -348,6 +348,11 @@ auto:
348348 - name: x86_64-gnu
349349 <<: *job-linux-4c
350350
351 - name: optional-x86_64-gnu-parallel-frontend
352 # This test can be flaky, so do not cancel CI if it fails, for now.
353 continue_on_error: true
354 <<: *job-linux-4c
355
351356 - name: x86_64-gnu-gcc
352357 doc_url: https://rustc-dev-guide.rust-lang.org/tests/codegen-backend-tests/cg_gcc.html
353358 <<: *job-linux-4c
src/doc/rustc-dev-guide/rust-version+1-1
......@@ -1 +1 @@
1c78a29473a68f07012904af11c92ecffa68fcc75
1eda4fc7733ee89e484d7120cafbd80dcb2fce66e
src/doc/rustc-dev-guide/src/autodiff/installation.md+48-1
......@@ -1,6 +1,50 @@
11# Installation
22
3In 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.
3In 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.
4For the meantime, you can download up-to-date builds to enable `std::autodiff` on your latest nightly toolchain, if you are using either of:
5**Linux**, with `x86_64-unknown-linux-gnu` or `aarch64-unknown-linux-gnu`
6**Windows**, with `x86_64-llvm-mingw` or `aarch64-llvm-mingw`
7
8You can also download slightly outdated builds for **Apple** (aarch64-apple), which should generally work for now.
9
10If 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.
11
12## Installation guide
13
14If 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.
15For now, you'll have to manually download and copy it.
16
171) On our github repository, find the last merged PR: [`Repo`]
182) Scroll down to the lower end of the PR, where you'll find a rust-bors message saying `Test successful` with a `CI` link.
193) 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`.
204) Under the `CI artifacts` section, find the `enzyme-nightly` artifact, download, and unpack it.
215) 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`
22
23Apple support was temporarily reverted, due to downstream breakages. If you want to download autodiff for apple, please look at the artifacts from this [`run`].
24
25## Installation guide for Nix user.
26
27This setup was recommended by a nix and autodiff user. It uses [`Overlay`]. Please verify for yourself if you are comfortable using that repository.
28In that case you might use the following nix configuration to get a rustc that supports `std::autodiff`.
29```nix
30{
31 enzymeLib = pkgs.fetchzip {
32 url = "https://ci-artifacts.rust-lang.org/rustc-builds/ec818fda361ca216eb186f5cf45131bd9c776bb4/enzyme-nightly-x86_64-unknown-linux-gnu.tar.xz";
33 sha256 = "sha256-Rnrop44vzS+qmYNaRoMNNMFyAc3YsMnwdNGYMXpZ5VY=";
34 };
35
36 rustToolchain = pkgs.symlinkJoin {
37 name = "rust-with-enzyme";
38 paths = [pkgs.rust-bin.nightly.latest.default];
39 nativeBuildInputs = [pkgs.makeWrapper];
40 postBuild = ''
41 libdir=$out/lib/rustlib/x86_64-unknown-linux-gnu/lib
42 cp ${enzymeLib}/enzyme-preview/lib/rustlib/x86_64-unknown-linux-gnu/lib/libEnzyme-22.so $libdir/
43 wrapProgram $out/bin/rustc --add-flags "--sysroot $out"
44 '';
45 };
46}
47```
448
549## Build instructions
650
......@@ -87,3 +131,6 @@ ninja
87131```
88132This 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).
89133
134[`Repo`]: https://github.com/rust-lang/rust/
135[`run`]: https://github.com/rust-lang/rust/pull/153026#issuecomment-3950046599
136[`Overlay`]: https://github.com/oxalica/rust-overlay
src/doc/rustc-dev-guide/src/backend/updating-llvm.md+6-1
......@@ -6,7 +6,12 @@ Rust supports building against multiple LLVM versions:
66* Tip-of-tree for the current LLVM development branch is usually supported within a few days.
77 PRs for such fixes are tagged with `llvm-main`.
88* The latest released major version is always supported.
9* The one or two preceding major versions are usually supported.
9* The one or two preceding major versions are usually supported in the sense that they are expected
10 to build successfully and pass most tests.
11 However, fixes for miscompilations often do not get
12 backported to past LLVM versions, so using rustc with older versions of LLVM comes with an
13 increased risk of soundness bugs.
14 We strongly recommend using the latest version of LLVM.
1015
1116By default, Rust uses its own fork in the [rust-lang/llvm-project repository].
1217This fork is based on a `release/$N.x` branch of the upstream project, where
src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md-1
......@@ -110,7 +110,6 @@ Also, using `x` rather than `x.py` is recommended as:
110110Notice that this is not absolute.
111111For instance, using Nushell in VSCode on Win10,
112112typing `x` or `./x` still opens `x.py` in an editor rather than invoking the program.
113:)
114113
115114In the rest of this guide, we use `x` rather than `x.py` directly.
116115The following command:
src/doc/rustc-dev-guide/src/conventions.md+2
......@@ -139,6 +139,8 @@ if foo {
139139}
140140```
141141
142If you want to leave a note in the codebase, use `// FIXME` instead.
143
142144<a id="cio"></a>
143145
144146## Using crates from crates.io
src/doc/rustc-dev-guide/src/diagnostics/translation.md+1-2
......@@ -31,8 +31,7 @@ There are two ways of writing translatable diagnostics:
3131 ("Simple" diagnostics being those that don't require a lot of logic in
3232 deciding to emit subdiagnostics and can therefore be represented as diagnostic structs).
3333 See [the diagnostic and subdiagnostic structs documentation](./diagnostic-structs.md).
342. Using typed identifiers with `Diag` APIs (in
35 `Diagnostic` or `Subdiagnostic` implementations).
342. Using typed identifiers with `Diag` APIs (in `Diagnostic` or `Subdiagnostic` implementations).
3635
3736When adding or changing a translatable diagnostic,
3837you don't need to worry about the translations.
src/doc/rustc-dev-guide/src/feature-gate-check.md+1-1
......@@ -8,7 +8,7 @@ nightly-only `#![feature(...)]` opt-in.
88This chapter documents the implementation
99of feature gating: where gates are defined, how they are enabled, and how usage is verified.
1010
11<!-- data-check: Feb 2026 -->
11<!-- date-check: Feb 2026 -->
1212
1313## Feature Definitions
1414
src/doc/rustc-dev-guide/src/git.md+7-5
......@@ -383,6 +383,13 @@ Both the upside and downside of this is that it simplifies the history.
383383On the one hand, you lose track of the steps in which changes were made, but
384384the history becomes easier to work with.
385385
386The 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.
387By default, [bors] combines all commit messages of the PR into the squashed commit message.
388To customize the commit message, use `@bors squash msg=<commit message>`.
389
390
391If you want to squash commits using local git operations, read on below.
392
386393If there are no conflicts and you are just squashing to clean up the history,
387394use `git rebase --interactive --keep-base main`.
388395This keeps the fork point of your PR the same, making it easier to review the diff of what happened
......@@ -410,11 +417,6 @@ because they only represent "fixups" and not real changes.
410417For example,
411418`git rebase --interactive HEAD~2` will allow you to edit the two commits only.
412419
413For pull requests in `rust-lang/rust`, you can ask [bors] to squash by commenting
414`@bors squash` on the PR.
415By default, [bors] combines all commit messages in the PR.
416To customize the commit message, use `@bors squash [msg|message=<commit-message>]`.
417
418420[bors]: https://github.com/rust-lang/bors
419421
420422### `git range-diff`
src/doc/rustc-dev-guide/src/query.md+3-3
......@@ -90,7 +90,7 @@ dependencies of the local crate)
9090Note that what determines the crate that a query is targeting is not the *kind* of query, but the *key*.
9191For example, when you invoke `tcx.type_of(def_id)`, that could be a
9292local query or an external query, depending on what crate the `def_id`
93is referring to (see the [`self::keys::Key`][Key] trait for more information on how that works).
93is referring to (see the [`self::keys::QueryKey`][QueryKey] trait for more information on how that works).
9494
9595Providers always have the same signature:
9696
......@@ -308,7 +308,7 @@ Let's go over these elements one by one:
308308 Also used as the name of a struct (`ty::queries::type_of`) that will be generated to represent
309309 this query.
310310- **Query key type:** the type of the argument to this query.
311 This type must implement the [`ty::query::keys::Key`][Key] trait, which
311 This type must implement the [`ty::query::keys::QueryKey`][QueryKey] trait, which
312312 defines (for example) how to map it to a crate, and so forth.
313313- **Result type of query:** the type produced by this query.
314314 This type should (a) not use `RefCell` or other interior mutability and (b) be
......@@ -317,7 +317,7 @@ Let's go over these elements one by one:
317317- **Query modifiers:** various flags and options that customize how the
318318 query is processed (mostly with respect to [incremental compilation][incrcomp]).
319319
320[Key]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/query/keys/trait.Key.html
320[QueryKey]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/query/keys/trait.QueryKey.html
321321[incrcomp]: queries/incremental-compilation-in-detail.html#query-modifiers
322322
323323So, to add a query:
src/doc/rustc-dev-guide/src/tests/ci.md+6
......@@ -109,6 +109,12 @@ The live results can be seen on [the GitHub Actions workflows page].
109109At any given time, at most a single `auto` build is being executed.
110110Find out more in [Merging PRs serially with bors](#merging-prs-serially-with-bors).
111111
112Normally, when an auto job fails, the whole CI workflow immediately ends. However, it can be useful to
113create auto jobs that are "non-blocking", or optional, to test them on CI for some time before blocking
114merges on them. This can be useful if those jobs can be flaky.
115
116To do that, prefix such a job with `optional-`, and set `continue_on_error: true` for it in [`jobs.yml`].
117
112118[platform tiers]: https://forge.rust-lang.org/release/platform-support.html#rust-platform-support
113119[auto]: https://github.com/rust-lang/rust/tree/automation/bors/auto
114120
src/doc/rustc-dev-guide/src/tracing.md+2-2
......@@ -14,8 +14,8 @@ of `tracing-subscriber`](https://docs.rs/tracing-subscriber/0.2.24/tracing_subsc
1414
1515## Environment variables
1616
17This is an overview of the environment variables rustc accepts to customize
18its tracing output. The definition of these can mostly be found in `compiler/rustc_log/src/lib.rs`.
17This is an overview of the environment variables rustc accepts to customize its tracing output.
18The definition of these can mostly be found in `compiler/rustc_log/src/lib.rs`.
1919
2020| Name | Usage |
2121| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
tests/run-make/target-cpu-native/foo.rs+8
......@@ -1 +1,9 @@
11fn main() {}
2
3// This forces explicit emission of a +neon target feature on targets
4// where it is implied by the target-cpu, like aarch64-apple-darwin.
5// This is a regression test for #153397.
6#[cfg(target_feature = "neon")]
7#[target_feature(enable = "neon")]
8#[unsafe(no_mangle)]
9pub fn with_neon() {}
tests/run-make/target-cpu-native/rmake.rs+6-1
......@@ -8,7 +8,12 @@
88use run_make_support::{run, rustc};
99
1010fn main() {
11 let out = rustc().input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8();
11 let out = rustc()
12 .input("foo.rs")
13 .arg("-Ctarget-cpu=native")
14 .arg("-Zverify-llvm-ir")
15 .run()
16 .stderr_utf8();
1217 run("foo");
1318 // There should be zero warnings emitted - the bug would cause "unknown CPU `native`"
1419 // to be printed out.
tests/ui/async-await/async-closures/is-fn.rs+2-2
......@@ -9,11 +9,11 @@ use std::future::Future;
99
1010extern crate block_on;
1111
12// Check that closures that don't capture any state may implement `Fn`.
12// Check that async closures that don't capture any state may implement `Fn`.
1313
1414fn main() {
1515 block_on::block_on(async {
16 async fn call_once<F: Future>(x: impl FnOnce(&'static str) -> F) -> F::Output {
16 async fn call_once<F: Future>(x: impl Fn(&'static str) -> F) -> F::Output {
1717 x("hello, world").await
1818 }
1919 call_once(async |x: &'static str| {
tests/ui/feature-gates/incomplete-features.rs created+13
......@@ -0,0 +1,13 @@
1//! Make sure that incomplete features emit the `incomplete_features` lint.
2
3// gate-test-test_incomplete_feature
4
5//@ check-pass
6//@ revisions: warn expect
7
8#![cfg_attr(warn, warn(incomplete_features))]
9#![cfg_attr(expect, expect(incomplete_features))]
10
11#![feature(test_incomplete_feature)] //[warn]~ WARN the feature `test_incomplete_feature` is incomplete
12
13fn main() {}
tests/ui/feature-gates/incomplete-features.warn.stderr created+14
......@@ -0,0 +1,14 @@
1warning: the feature `test_incomplete_feature` is incomplete and may not be safe to use and/or cause compiler crashes
2 --> $DIR/incomplete-features.rs:11:12
3 |
4LL | #![feature(test_incomplete_feature)]
5 | ^^^^^^^^^^^^^^^^^^^^^^^
6 |
7note: the lint level is defined here
8 --> $DIR/incomplete-features.rs:8:24
9 |
10LL | #![cfg_attr(warn, warn(incomplete_features))]
11 | ^^^^^^^^^^^^^^^^^^^
12
13warning: 1 warning emitted
14
tests/ui/parallel-rustc/fn-sig-cycle-ice-153391.rs created+18
......@@ -0,0 +1,18 @@
1// Regression test for #153391.
2//
3//@ edition:2024
4//@ compile-flags: -Z threads=16
5//@ compare-output-by-lines
6//@ ignore-test (#142063)
7
8trait A {
9 fn g() -> B;
10 //~^ ERROR expected a type, found a trait
11}
12
13trait B {
14 fn bar(&self, x: &A);
15 //~^ ERROR expected a type, found a trait
16}
17
18fn main() {}
tests/ui/parallel-rustc/fn-sig-cycle-ice-153391.stderr created+31
......@@ -0,0 +1,31 @@
1error[E0782]: expected a type, found a trait
2 --> $DIR/fn-sig-cycle-ice-153391.rs:8:15
3 |
4LL | fn g() -> B;
5 | ^
6 |
7help: `B` is dyn-incompatible, use `impl B` to return an opaque type, as long as you return a single underlying type
8 |
9LL | fn g() -> impl B;
10 | ++++
11
12error[E0782]: expected a type, found a trait
13 --> $DIR/fn-sig-cycle-ice-153391.rs:13:23
14 |
15LL | fn bar(&self, x: &A);
16 | ^
17 |
18 = note: `A` is dyn-incompatible, otherwise a trait object could be used
19help: use a new generic type parameter, constrained by `A`
20 |
21LL - fn bar(&self, x: &A);
22LL + fn bar<T: A>(&self, x: &T);
23 |
24help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
25 |
26LL | fn bar(&self, x: &impl A);
27 | ++++
28
29error: aborting due to 2 previous errors
30
31For more information about this error, try `rustc --explain E0782`.