From 0300d987c6b083d9c7d8ff16ab6bab267fe360ec Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Sun, 8 Nov 2026 12:27:42 +0900 Subject: [PATCH 01/25] feat(time): add `Duration` extractors for units larger than second --- library/core/src/time.rs | 85 +++++++++++++++++++++++++++++++++ library/coretests/tests/lib.rs | 2 + library/coretests/tests/time.rs | 24 ++++++++++ 3 files changed, 111 insertions(+) diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 6fc40b4c25c2e..8f6ed950b72bd 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -722,6 +722,91 @@ impl Duration { self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos.as_inner() as u128 } + /// Returns the number of _whole_ weeks contained by this `Duration`. + /// + /// The returned value does not include any fractional component + /// corresponding to units less than a week of the duration. + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extractors)] + /// #![feature(duration_constructors)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_days(40); + /// assert_eq!(duration.as_weeks(), 5); + /// ``` + #[unstable(feature = "duration_extractors", issue = "none")] + #[must_use] + #[inline] + pub const fn as_weeks(&self) -> u64 { + self.as_secs() / (SECS_PER_MINUTE * MINS_PER_HOUR * HOURS_PER_DAY * DAYS_PER_WEEK) + } + + /// Returns the number of _whole_ days contained by this `Duration`. + /// + /// The returned value does not include any fractional component + /// corresponding to units less than a day of the duration. + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extractors)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_hours(130); + /// assert_eq!(duration.as_days(), 5); + /// ``` + #[unstable(feature = "duration_extractors", issue = "none")] + #[must_use] + #[inline] + pub const fn as_days(&self) -> u64 { + self.as_secs() / (SECS_PER_MINUTE * MINS_PER_HOUR * HOURS_PER_DAY) + } + + /// Returns the number of _whole_ hours contained by this `Duration`. + /// + /// The returned value does not include any fractional component + /// corresponding to units less than an hour of the duration. + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extractors_lite)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_mins(320); + /// assert_eq!(duration.as_hours(), 5); + /// ``` + #[unstable(feature = "duration_extractors_lite", issue = "none")] + #[must_use] + #[inline] + pub const fn as_hours(&self) -> u64 { + self.as_secs() / (SECS_PER_MINUTE * MINS_PER_HOUR) + } + + /// Returns the number of _whole_ minutes contained by this `Duration`. + /// + /// The returned value does not include any fractional component + /// corresponding to units less than a minute of the duration. + /// + /// # Examples + /// + /// ``` + /// #![feature(duration_extractors_lite)] + /// use std::time::Duration; + /// + /// let duration = Duration::from_secs(320); + /// assert_eq!(duration.as_mins(), 5); + /// ``` + #[unstable(feature = "duration_extractors_lite", issue = "none")] + #[must_use] + #[inline] + pub const fn as_mins(&self) -> u64 { + self.as_secs() / SECS_PER_MINUTE + } + /// Computes the absolute difference between `self` and `other`. /// /// # Examples diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index c9c07fe817cac..e28b2670c8474 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -55,6 +55,8 @@ #![feature(duration_constants)] #![feature(duration_constructors)] #![feature(duration_display_seconds)] +#![feature(duration_extractors)] +#![feature(duration_extractors_lite)] #![feature(exact_div)] #![feature(exact_size_is_empty)] #![feature(extend_one)] diff --git a/library/coretests/tests/time.rs b/library/coretests/tests/time.rs index c5ad53346f8ae..1fa905e50ca3e 100644 --- a/library/coretests/tests/time.rs +++ b/library/coretests/tests/time.rs @@ -641,6 +641,30 @@ fn duration_const() { const FROM_NANOS_U128: Duration = Duration::from_nanos_u128(NANOS); assert_eq!(FROM_NANOS_U128, Duration::SECOND); + const WEEKS: u64 = Duration::WEEK.as_weeks(); + assert_eq!(WEEKS, 1); + + const FROM_WEEKS: Duration = Duration::from_weeks(1); + assert_eq!(FROM_WEEKS, 604_800 * Duration::SECOND); + + const DAYS: u64 = Duration::DAY.as_days(); + assert_eq!(DAYS, 1); + + const FROM_DAYS: Duration = Duration::from_days(1); + assert_eq!(FROM_DAYS, 86400 * Duration::SECOND); + + const HOURS: u64 = Duration::HOUR.as_hours(); + assert_eq!(HOURS, 1); + + const FROM_HOURS: Duration = Duration::from_hours(1); + assert_eq!(FROM_HOURS, 3600 * Duration::SECOND); + + const MINUTES: u64 = Duration::MINUTE.as_mins(); + assert_eq!(MINUTES, 1); + + const FROM_MINUTES: Duration = Duration::from_mins(1); + assert_eq!(FROM_MINUTES, 60 * Duration::SECOND); + const MAX: Duration = Duration::new(u64::MAX, 999_999_999); const CHECKED_ADD: Option = MAX.checked_add(Duration::SECOND); From 69d8f47c508d18d7d52aae532f37cd0c919f9213 Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Wed, 11 Nov 2026 08:00:30 +0900 Subject: [PATCH 02/25] chore: set issue numbers of tracking issues --- library/core/src/time.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 8f6ed950b72bd..7256fc6646fd0 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -737,7 +737,7 @@ impl Duration { /// let duration = Duration::from_days(40); /// assert_eq!(duration.as_weeks(), 5); /// ``` - #[unstable(feature = "duration_extractors", issue = "none")] + #[unstable(feature = "duration_extractors", issue = "165786")] #[must_use] #[inline] pub const fn as_weeks(&self) -> u64 { @@ -758,7 +758,7 @@ impl Duration { /// let duration = Duration::from_hours(130); /// assert_eq!(duration.as_days(), 5); /// ``` - #[unstable(feature = "duration_extractors", issue = "none")] + #[unstable(feature = "duration_extractors", issue = "165786")] #[must_use] #[inline] pub const fn as_days(&self) -> u64 { @@ -779,7 +779,7 @@ impl Duration { /// let duration = Duration::from_mins(320); /// assert_eq!(duration.as_hours(), 5); /// ``` - #[unstable(feature = "duration_extractors_lite", issue = "none")] + #[unstable(feature = "duration_extractors_lite", issue = "165784")] #[must_use] #[inline] pub const fn as_hours(&self) -> u64 { @@ -800,7 +800,7 @@ impl Duration { /// let duration = Duration::from_secs(320); /// assert_eq!(duration.as_mins(), 5); /// ``` - #[unstable(feature = "duration_extractors_lite", issue = "none")] + #[unstable(feature = "duration_extractors_lite", issue = "165784")] #[must_use] #[inline] pub const fn as_mins(&self) -> u64 { From 076d2b6df8c7d1bedd5eb7f4f61b2b08c547c664 Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Wed, 11 Nov 2026 08:18:02 +0900 Subject: [PATCH 03/25] docs(time): clarify exact seconds for units larger than the second --- library/core/src/time.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 7256fc6646fd0..b8661462d20e9 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -727,6 +727,8 @@ impl Duration { /// The returned value does not include any fractional component /// corresponding to units less than a week of the duration. /// + /// For this method, one week is defined as 7 days, or 604,800 seconds. + /// /// # Examples /// /// ``` @@ -749,6 +751,8 @@ impl Duration { /// The returned value does not include any fractional component /// corresponding to units less than a day of the duration. /// + /// For this method, one day is defined as 24 hours, or 86,400 seconds. + /// /// # Examples /// /// ``` @@ -770,6 +774,8 @@ impl Duration { /// The returned value does not include any fractional component /// corresponding to units less than an hour of the duration. /// + /// For this method, one hour is defined as 60 minutes, or 3,600 seconds. + /// /// # Examples /// /// ``` @@ -791,6 +797,8 @@ impl Duration { /// The returned value does not include any fractional component /// corresponding to units less than a minute of the duration. /// + /// For this method, one minute is defined as 60 seconds. + /// /// # Examples /// /// ``` From a4947979e78e5f8ae60a19a3d6b7bcb9b8549d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 18 Nov 2026 20:11:18 +0100 Subject: [PATCH 04/25] Add `r? @ghost` suffix to Josh push PRs --- src/doc/rustc-dev-guide/josh-sync.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/doc/rustc-dev-guide/josh-sync.toml b/src/doc/rustc-dev-guide/josh-sync.toml index 7882051e23390..ac858e5072378 100644 --- a/src/doc/rustc-dev-guide/josh-sync.toml +++ b/src/doc/rustc-dev-guide/josh-sync.toml @@ -1,3 +1,6 @@ org = "rust-lang" repo = "rustc-dev-guide" path = "src/doc/rustc-dev-guide" + +[push-pr] +suffix = "r? @ghost" From 6ba40f20564372441f42ecec4bf0f6cde9540aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 18 Nov 2026 20:19:34 +0100 Subject: [PATCH 05/25] Add hashbrown to the list of Josh subtrees --- src/doc/rustc-dev-guide/src/external-repos.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustc-dev-guide/src/external-repos.md b/src/doc/rustc-dev-guide/src/external-repos.md index 28a7cc667f066..4bef36c799ae9 100644 --- a/src/doc/rustc-dev-guide/src/external-repos.md +++ b/src/doc/rustc-dev-guide/src/external-repos.md @@ -17,6 +17,7 @@ As a general rule: The following external projects are managed using a Josh `subtree`: * [clippy](https://github.com/rust-lang/rust-clippy) +* [hashbrown](https://github.com/rust-lang/hashbrown) * [miri](https://github.com/rust-lang/miri) * [portable-simd](https://github.com/rust-lang/portable-simd) * [rustfmt](https://github.com/rust-lang/rustfmt) From 54b1675a4c5c2b8cbf584eb2fcdc522488f617e9 Mon Sep 17 00:00:00 2001 From: Kazuyarch Date: Sat, 21 Nov 2026 17:23:15 +0000 Subject: [PATCH 06/25] Add regression test for issue 53156 --- ...e-bound-with-lifetime-53156.current.stderr | 26 ++ ...here-bound-with-lifetime-53156.next.stderr | 26 ++ .../where-bound-with-lifetime-53156.rs | 235 ++++++++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 tests/ui/lifetimes/where-bound-with-lifetime-53156.current.stderr create mode 100644 tests/ui/lifetimes/where-bound-with-lifetime-53156.next.stderr create mode 100644 tests/ui/lifetimes/where-bound-with-lifetime-53156.rs diff --git a/tests/ui/lifetimes/where-bound-with-lifetime-53156.current.stderr b/tests/ui/lifetimes/where-bound-with-lifetime-53156.current.stderr new file mode 100644 index 0000000000000..b9d50d4f5354d --- /dev/null +++ b/tests/ui/lifetimes/where-bound-with-lifetime-53156.current.stderr @@ -0,0 +1,26 @@ +error: lifetime may not live long enough + --> $DIR/where-bound-with-lifetime-53156.rs:35:9 + | +LL | impl<'a, B> OwnedWrap + | -- lifetime `'a` defined here +... +LL | pub fn to_arc_aac(&self) -> Arc { + | - let's call the lifetime of this reference `'1` +LL | let OwnedWrap(ref owned) = *self; +LL | owned.borrow().into() + | ^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a` + +error[E0621]: explicit lifetime required in the type of `wrap` + --> $DIR/where-bound-with-lifetime-53156.rs:135:5 + | +LL | owned.borrow().into() + | ^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `wrap` + | +LL | fn to_arc_aac<'a, B>(wrap: &'a OwnedWrap) -> Arc + | ++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/lifetimes/where-bound-with-lifetime-53156.next.stderr b/tests/ui/lifetimes/where-bound-with-lifetime-53156.next.stderr new file mode 100644 index 0000000000000..b9d50d4f5354d --- /dev/null +++ b/tests/ui/lifetimes/where-bound-with-lifetime-53156.next.stderr @@ -0,0 +1,26 @@ +error: lifetime may not live long enough + --> $DIR/where-bound-with-lifetime-53156.rs:35:9 + | +LL | impl<'a, B> OwnedWrap + | -- lifetime `'a` defined here +... +LL | pub fn to_arc_aac(&self) -> Arc { + | - let's call the lifetime of this reference `'1` +LL | let OwnedWrap(ref owned) = *self; +LL | owned.borrow().into() + | ^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'a` + +error[E0621]: explicit lifetime required in the type of `wrap` + --> $DIR/where-bound-with-lifetime-53156.rs:135:5 + | +LL | owned.borrow().into() + | ^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required + | +help: add explicit lifetime `'a` to the type of `wrap` + | +LL | fn to_arc_aac<'a, B>(wrap: &'a OwnedWrap) -> Arc + | ++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/lifetimes/where-bound-with-lifetime-53156.rs b/tests/ui/lifetimes/where-bound-with-lifetime-53156.rs new file mode 100644 index 0000000000000..10663bdb5f578 --- /dev/null +++ b/tests/ui/lifetimes/where-bound-with-lifetime-53156.rs @@ -0,0 +1,235 @@ +//! Regression test for . +//! Second where bound was causing incorrect rejection of acceptable lifetime. + +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +use std::borrow::Borrow; +use std::sync::Arc; + +struct OwnedWrap(::Owned); + +impl<'a, B> OwnedWrap +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + // 1a-2a-3a + pub fn to_arc_aaa(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + let b: &B = owned.borrow(); + unimplemented!() + } + + // 1a-2a-3b + pub fn to_arc_aab(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + let _: &B = owned.borrow(); + unimplemented!() + } + + // 1a-2a-3c + pub fn to_arc_aac(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + owned.borrow().into() + //~^ ERROR lifetime may not live long enough + } + + // 1a-2b-3a + pub fn to_arc_aba(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + let b: &B = owned.borrow(); + unimplemented!() + } + + // 1a-2b-3b + pub fn to_arc_abb(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + let _: &B = owned.borrow(); + unimplemented!() + } + + // 1a-2b-3c + pub fn to_arc_abc(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + owned.borrow().into() + } +} + +impl<'a, B> OwnedWrap +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + // 1b-2a-3a + pub fn to_arc_baa(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + let b: &B = owned.borrow(); + unimplemented!() + } + + // 1b-2a-3b + pub fn to_arc_bab(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + let _: &B = owned.borrow(); + unimplemented!() + } + + // 1b-2a-3c + pub fn to_arc_bac(&self) -> Arc { + let OwnedWrap(ref owned) = *self; + owned.borrow().into() + } + + // 1b-2b-3a + pub fn to_arc_bba(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + let b: &B = owned.borrow(); + unimplemented!() + } + + // 1b-2b-3b + pub fn to_arc_bbb(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + let _: &B = owned.borrow(); + unimplemented!() + } + + // 1b-2b-3c + pub fn to_arc_bbc(&'a self) -> Arc { + let OwnedWrap(ref owned) = *self; + owned.borrow().into() + } +} + +// 1a-2a-3a +fn to_arc_aaa<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + let b: &B = owned.borrow(); + unimplemented!() +} + +// 1a-2a-3b +fn to_arc_aab<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + let _: &B = owned.borrow(); + unimplemented!() +} + +// 1a-2a-3c +fn to_arc_aac<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + owned.borrow().into() + //~^ ERROR explicit lifetime required in the type of `wrap` +} + +// 1a-2b-3a +fn to_arc_aba<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + let b: &B = owned.borrow(); + unimplemented!() +} + +// 1a-2b-3b +fn to_arc_abb<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + let _: &B = owned.borrow(); + unimplemented!() +} + +// 1a-2b-3c +fn to_arc_abc<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + &'a B: Into>, // 1a +{ + let OwnedWrap(ref owned) = *wrap; + owned.borrow().into() +} + +// 1b-2a-3a +fn to_arc_baa<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + let b: &B = owned.borrow(); + unimplemented!() +} + +// 1b-2a-3b +fn to_arc_bab<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + let _: &B = owned.borrow(); + unimplemented!() +} + +// 1b-2a-3c +fn to_arc_bac<'a, B>(wrap: &OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + owned.borrow().into() +} + +// 1b-2b-3a +fn to_arc_bba<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + let b: &B = owned.borrow(); + unimplemented!() +} + +// 1b-2b-3b +fn to_arc_bbb<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + let _: &B = owned.borrow(); + unimplemented!() +} + +// 1b-2b-3c +fn to_arc_bbc<'a, B>(wrap: &'a OwnedWrap) -> Arc +where + B: 'a + ToOwned + ?Sized, + for<'b> &'b B: Into> // 1b +{ + let OwnedWrap(ref owned) = *wrap; + owned.borrow().into() +} + +fn main() {} From ad37db99c3aa62c35f058f0b408b0abeff81cc83 Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Mon, 23 Nov 2026 04:15:47 +0000 Subject: [PATCH 07/25] Prepare for merging from rust-lang/rust This updates the rust-version file to fde8dfd638478da758f93f0e8d9b74d7907f0c9e. --- 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 7fe96b0a30f39..f7edaffb6aee2 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -c55b900aa3e4d23bb5628a00718304b31077d619 +fde8dfd638478da758f93f0e8d9b74d7907f0c9e From 8d7a4dee361cd75c19a1d6842b8b2ae0c45523d7 Mon Sep 17 00:00:00 2001 From: Redddy Date: Mon, 23 Nov 2026 04:33:54 +0000 Subject: [PATCH 08/25] fix some GitHub and doc link --- src/doc/rustc-dev-guide/src/appendix/code-index.md | 4 ++-- .../src/backend/implicit-caller-location.md | 2 +- src/doc/rustc-dev-guide/src/const-generics.md | 6 +++--- src/doc/rustc-dev-guide/src/diagnostics.md | 10 +++++----- src/doc/rustc-dev-guide/src/effects.md | 6 +++--- src/doc/rustc-dev-guide/src/git.md | 2 +- src/doc/rustc-dev-guide/src/hir.md | 14 +++++++------- src/doc/rustc-dev-guide/src/hir/lowering.md | 2 +- .../src/implementing-new-features.md | 4 ++-- src/doc/rustc-dev-guide/src/lang-items.md | 2 +- src/doc/rustc-dev-guide/src/memory.md | 2 +- src/doc/rustc-dev-guide/src/normalization.md | 2 +- src/doc/rustc-dev-guide/src/overview.md | 6 +++--- src/doc/rustc-dev-guide/src/query.md | 2 +- src/doc/rustc-dev-guide/src/serialization.md | 2 +- src/doc/rustc-dev-guide/src/tests/running.md | 2 +- src/doc/rustc-dev-guide/src/tests/ui.md | 4 ++-- .../src/ty-module/generic-arguments.md | 4 ++-- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/appendix/code-index.md b/src/doc/rustc-dev-guide/src/appendix/code-index.md index 351be5e39f921..fd822ab641486 100644 --- a/src/doc/rustc-dev-guide/src/appendix/code-index.md +++ b/src/doc/rustc-dev-guide/src/appendix/code-index.md @@ -11,7 +11,7 @@ Item | Kind | Short description | Chapter | `ast::Crate` | struct | A syntax-level representation of a parsed crate | [The parser] | [compiler/rustc_ast/src/ast.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/struct.Crate.html) `hir::Crate` | struct | A more abstract, compiler-friendly form of a crate's AST | [The Hir] | [compiler/rustc_middle/src/hir/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/struct.Crate.html) `DefId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [compiler/rustc_hir/src/def_id.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefId.html) -`Diag` | struct | A struct for a compiler diagnostic, such as an error or lint | [Emitting Diagnostics] | [compiler/rustc_errors/src/diagnostic.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html) +`Diag` | struct | A struct for a compiler diagnostic, such as an error or lint | [Emitting Diagnostics] | [compiler/rustc_errors/src/diagnostic.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html) `DocContext` | struct | A state container used by rustdoc when crawling through a crate to gather its documentation | [Rustdoc] | [src/librustdoc/core.rs](https://github.com/rust-lang/rust/blob/HEAD/src/librustdoc/core.rs) `HirId` | struct | One of four types of HIR node identifiers | [Identifiers in the HIR] | [compiler/rustc_hir_id/src/lib.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/struct.HirId.html) `Lexer` | struct | This is the lexer used during parsing. It consumes characters from the raw source code being compiled and produces a series of tokens for use by the rest of the parser | [The parser] | [compiler/rustc_parse/src/lexer/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/lexer/struct.Lexer.html) @@ -27,7 +27,7 @@ Item | Kind | Short description | Chapter | `TraitDef` | struct | This struct contains a trait's definition with type information | [The `ty` modules] | [compiler/rustc_middle/src/ty/trait_def.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait_def/struct.TraitDef.html) `TraitRef` | struct | The combination of a trait and its input types (e.g. `P0: Trait`) | [Trait Solving: Goals and Clauses] | [compiler/rustc_middle/src/ty/sty.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.TraitRef.html) `Ty<'tcx>` | struct | This is the internal representation of a type used for type checking | [Type checking] | [compiler/rustc_middle/src/ty/mod.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Ty.html) -`TyCtxt<'tcx>` | struct | The "typing context". This is the central data structure in the compiler. It is the context that you use to perform all manner of queries | [The `ty` modules] | [compiler/rustc_middle/src/ty/context.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html) +`TyCtxt<'tcx>` | struct | The "typing context". This is the central data structure in the compiler. It is the context that you use to perform all manner of queries | [The `ty` modules] | [compiler/rustc_middle/src/ty/context.rs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html) [The HIR]: ../hir.md [Identifiers in the HIR]: ../hir.md#hir-id diff --git a/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md b/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md index 909c00ea40cff..bfb2973bdd743 100644 --- a/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md +++ b/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md @@ -284,7 +284,7 @@ to the author and reviewers. [requires-location]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/instance/enum.InstanceKind.html#method.requires_caller_location [alloc-location]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/struct.InterpCx.html#method.alloc_caller_location [fcx-location]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/struct.FunctionCx.html#structfield.caller_location -[const-location-query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.const_caller_location +[const-location-query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.const_caller_location [location-memory-kind]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/enum.MemoryKind.html#variant.CallerLocation [const-frame]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/struct.Frame.html [const-stack]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_const_eval/interpret/struct.InterpCx.html#structfield.stack diff --git a/src/doc/rustc-dev-guide/src/const-generics.md b/src/doc/rustc-dev-guide/src/const-generics.md index 2738782db9e48..579b12f55ac62 100644 --- a/src/doc/rustc-dev-guide/src/const-generics.md +++ b/src/doc/rustc-dev-guide/src/const-generics.md @@ -248,9 +248,9 @@ Looking at the above example, this corresponds to `[u8; ANON]` being a well form [`ConstKind::Value`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/consts/type.ConstKind.html#variant.Value [const_arg_has_type]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.ClauseKind.html#variant.ConstArgHasType [`ParamEnv`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html -[`generics_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#impl-TyCtxt%3C'tcx%3E/method.generics_of -[`type_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.type_of +[`generics_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.generics_of +[`type_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.type_of [`DefKind::AnonConst`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def/enum.DefKind.html#variant.AnonConst [`hir::Node::AnonConst`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html#variant.AnonConst# [cec_fcw]: https://github.com/rust-lang/rust/issues/76200 -[`const_eval_resolve_for_typeck`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.const_eval_resolve_for_typeck +[`const_eval_resolve_for_typeck`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.const_eval_resolve_for_typeck diff --git a/src/doc/rustc-dev-guide/src/diagnostics.md b/src/doc/rustc-dev-guide/src/diagnostics.md index bdb3f8c9f22ae..23d40dff79341 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics.md +++ b/src/doc/rustc-dev-guide/src/diagnostics.md @@ -352,8 +352,8 @@ before emitting it by calling the [`emit`] method. [spanerr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagCtxt.html#method.span_err [strspanerr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.DiagCtxt.html#method.struct_span_err -[`emit`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html#method.emit -[cancel]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html#method.cancel +[`emit`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html#method.emit +[cancel]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html#method.cancel ```rust,ignore // Get a `Diag`. This does _not_ emit an error yet. @@ -412,7 +412,7 @@ some heuristics for verbosity are met) suggestion is obvious from the text, but we still want to let tools to apply them) - not shown (used for _very_ obvious cases, but we still want to allow tools to apply them) -[span_suggestion]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html#method.span_suggestion +[span_suggestion]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html#method.span_suggestion For example, to make our `qux` suggestion machine-applicable, we would do: @@ -860,7 +860,7 @@ The JSON emitter defines [its own `Diagnostic` struct](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/json/struct.Diagnostic.html) (and sub-structs) for the JSON serialization. Don't confuse this with -[`errors::Diag`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html)! +[`errors::Diag`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html)! ## Diagnostic attributes @@ -879,4 +879,4 @@ If possible, consider improving or implementing such an attribute rather than ad reporting code. [`rustc_on_unimplemented`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_ir/attribute.rustc_on_unimplemented.html -[diag]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html +[diag]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html diff --git a/src/doc/rustc-dev-guide/src/effects.md b/src/doc/rustc-dev-guide/src/effects.md index f6a11b435ad32..0a06ba3202c3f 100644 --- a/src/doc/rustc-dev-guide/src/effects.md +++ b/src/doc/rustc-dev-guide/src/effects.md @@ -19,8 +19,8 @@ therefore they will result in `HostEffect(T: Tr, const)` being added to `clauses and not `const_conditions`. [`HostEffectPredicate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/predicate/struct.HostEffectPredicate.html -[`clauses_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.clauses_of -[`const_conditions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.const_conditions +[`clauses_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.clauses_of +[`const_conditions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.const_conditions ## The `const_conditions` query @@ -137,7 +137,7 @@ These bounds are checked in [`compare_impl_item::check_type_bounds`] for HIR typ [`evaluate_host_effect_from_item_bounds`] in the old solver and [`consider_additional_alias_assumptions`] in the new solver. -[`explicit_item_bounds`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.explicit_item_bounds +[`explicit_item_bounds`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.explicit_item_bounds [`compare_impl_item::check_type_bounds`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.check_type_bounds.html [`evaluate_host_effect_from_item_bounds`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/effects/fn.evaluate_host_effect_from_item_bounds.html [`consider_additional_alias_assumptions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/assembly/trait.GoalKind.html#tymethod.consider_additional_alias_assumptions diff --git a/src/doc/rustc-dev-guide/src/git.md b/src/doc/rustc-dev-guide/src/git.md index 5974e0e92cad6..3e70c05d1c07e 100644 --- a/src/doc/rustc-dev-guide/src/git.md +++ b/src/doc/rustc-dev-guide/src/git.md @@ -687,4 +687,4 @@ easily figure out *why* a commit is ignored. [Git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules [`rust-lang/llvm-project`]: https://github.com/rust-lang/llvm-project -[llvm-update]: https://github.com/rust-lang/rust/pull/99464/files +[llvm-update]: https://github.com/rust-lang/rust/pull/99464/changes diff --git a/src/doc/rustc-dev-guide/src/hir.md b/src/doc/rustc-dev-guide/src/hir.md index c2e227dc936ce..1a4e300b626d2 100644 --- a/src/doc/rustc-dev-guide/src/hir.md +++ b/src/doc/rustc-dev-guide/src/hir.md @@ -126,13 +126,13 @@ It contains a number of methods, defined in the `hir::map` module and mostly prefixed with `hir_`, to convert between IDs of various kinds and to lookup data associated with a HIR node. -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html For example, if you have a [`LocalDefId`], and you would like to convert it to a [`HirId`], you can use [`tcx.local_def_id_to_hir_id(def_id)`][local_def_id_to_hir_id]. You need a `LocalDefId`, rather than a `DefId`, since only local items have HIR nodes. -[local_def_id_to_hir_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.local_def_id_to_hir_id +[local_def_id_to_hir_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.local_def_id_to_hir_id Similarly, you can use [`tcx.hir_node(n)`][hir_node] to lookup the node for a [`HirId`]. @@ -145,15 +145,15 @@ that `n` must be some HIR expression, you can do [`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the [`&hir::Expr`][Expr], panicking if `n` is not in fact an expression. -[hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_node +[hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.hir_node [`Node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html -[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.expect_expr +[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.expect_expr [Expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Expr.html Finally, you can find the parents of nodes, via calls like [`tcx.parent_hir_node(n)`][parent_hir_node]. -[parent_hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.parent_hir_node +[parent_hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.parent_hir_node ## HIR Bodies @@ -167,5 +167,5 @@ associated with a given def-id ([`hir_maybe_body_owned_by`]) or to find the owner of a body ([`hir_body_owner_def_id`]). [`rustc_hir::Body`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Body.html -[`hir_maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_maybe_body_owned_by -[`hir_body_owner_def_id`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_body_owner_def_id +[`hir_maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.hir_maybe_body_owned_by +[`hir_body_owner_def_id`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.hir_body_owner_def_id diff --git a/src/doc/rustc-dev-guide/src/hir/lowering.md b/src/doc/rustc-dev-guide/src/hir/lowering.md index d555e0e7b3a85..635748bb8d633 100644 --- a/src/doc/rustc-dev-guide/src/hir/lowering.md +++ b/src/doc/rustc-dev-guide/src/hir/lowering.md @@ -58,7 +58,7 @@ sanity checks in [`compiler/rustc_passes/src/hir_id_validator.rs`][hir_id_valida [`rustc_ast_lowering`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/index.html [`lower_to_hir`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/fn.lower_to_hir.html -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html [`hir::Crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/struct.Crate.html [`ItemLowerer::lower_node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/item/struct.ItemLowerer.html [`LoweringContext`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html diff --git a/src/doc/rustc-dev-guide/src/implementing-new-features.md b/src/doc/rustc-dev-guide/src/implementing-new-features.md index 947dd9d36d0e5..e892d15466719 100644 --- a/src/doc/rustc-dev-guide/src/implementing-new-features.md +++ b/src/doc/rustc-dev-guide/src/implementing-new-features.md @@ -222,7 +222,7 @@ The below steps needs to be followed in order to implement a new unstable featur If the feature gate is not set, you should either maintain the pre-feature behavior or raise an error, depending on what makes sense. - Errors should generally use [`rustc_session::errors::feature_err`]. + Errors should generally use [`rustc_session::diagnostics::feature_err`]. For an example of adding an error, see [#81015]. For features introducing new syntax, pre-expansion gating should be used instead. @@ -252,7 +252,7 @@ The below steps needs to be followed in order to implement a new unstable featur [`GatedSpans`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.GatedSpans.html [#81015]: https://github.com/rust-lang/rust/pull/81015 -[`rustc_session::errors::feature_err`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/errors/fn.feature_err.html +[`rustc_session::diagnostics::feature_err`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/diagnostics/fn.feature_err.html [`rustc_ast_passes::feature_gate::check_crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_passes/feature_gate/fn.check_crate.html [value the stability of Rust]: https://github.com/rust-lang/rfcs/blob/master/text/1122-language-semver.md [stability in code]: #stability-in-code diff --git a/src/doc/rustc-dev-guide/src/lang-items.md b/src/doc/rustc-dev-guide/src/lang-items.md index e3859f46a3651..737bbe2897bd2 100644 --- a/src/doc/rustc-dev-guide/src/lang-items.md +++ b/src/doc/rustc-dev-guide/src/lang-items.md @@ -55,7 +55,7 @@ You can either: - Proceed with limited functionality, by just omitting whatever you were going to do with the `DefId`. -[`tcx.lang_items()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.lang_items +[`tcx.lang_items()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.lang_items ## List of all language items diff --git a/src/doc/rustc-dev-guide/src/memory.md b/src/doc/rustc-dev-guide/src/memory.md index 14601e47b81c9..dc961afb73bba 100644 --- a/src/doc/rustc-dev-guide/src/memory.md +++ b/src/doc/rustc-dev-guide/src/memory.md @@ -85,7 +85,7 @@ As you can see, the `TyCtxt` type takes a lifetime parameter. When you see a reference with a lifetime like `'tcx`, you know that it refers to arena-allocated data (or data that lives as long as the arenas, anyhow). -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html ### A Note On Lifetimes diff --git a/src/doc/rustc-dev-guide/src/normalization.md b/src/doc/rustc-dev-guide/src/normalization.md index cefd92999d9e5..f0acf9afd047c 100644 --- a/src/doc/rustc-dev-guide/src/normalization.md +++ b/src/doc/rustc-dev-guide/src/normalization.md @@ -286,7 +286,7 @@ Lints and codegen make heavy use of this entry point as they typically are worki (or at least, are not responsible for erroring on). [`infcx.query_normalize`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.query_normalize -[`normalize_erasing_regions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.normalize_erasing_regions +[`normalize_erasing_regions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.normalize_erasing_regions [`normalize`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/at/struct.At.html#method.normalize [`deeply_normalize`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/normalize/trait.NormalizeExt.html#tymethoz [structurally_normalize]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/trait.StructurallyNormalizeExt.html#tymethod.structurally_normalize_ty diff --git a/src/doc/rustc-dev-guide/src/overview.md b/src/doc/rustc-dev-guide/src/overview.md index 374a3c5bfa406..006ed2d3c97aa 100644 --- a/src/doc/rustc-dev-guide/src/overview.md +++ b/src/doc/rustc-dev-guide/src/overview.md @@ -138,7 +138,7 @@ The different libraries/binaries are then linked together to produce the final b [`bump`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.bump [`check`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.check [`Crate`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_ast/ast/struct.Crate.html -[`diag`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html +[`diag`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html [`eat`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.eat [`expect`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.expect [`Expr`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_ast/ast/struct.Expr.html @@ -330,7 +330,7 @@ You will also see lifetimes with the name `'tcx`, which means that something is tied to the lifetime of the [`TyCtxt`] (usually it is stored or interned there). -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html For more information about queries in the compiler, see [the queries chapter][queries]. @@ -433,7 +433,7 @@ For more details on bootstrapping, see [the bootstrapping section of the guide][ - Guide: [Type Inference](type-inference.md) - Guide: [The ty Module: Representing Types](ty.md) (semantics) - Main entry point (type inference): [`InferCtxtBuilder::enter`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtBuilder.html#method.enter) - - Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck) + - Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.typeck) - These two functions can't be decoupled. - The Mid Level Intermediate Representation (MIR) - Guide: [The `MIR` (Mid level IR)](mir/index.md) diff --git a/src/doc/rustc-dev-guide/src/query.md b/src/doc/rustc-dev-guide/src/query.md index a4b9eef02f13a..af2528831cff8 100644 --- a/src/doc/rustc-dev-guide/src/query.md +++ b/src/doc/rustc-dev-guide/src/query.md @@ -60,7 +60,7 @@ For example, to invoke the `type_of` query, you would just do this: let ty = tcx.type_of(some_def_id); ``` -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html ## How the compiler executes a query diff --git a/src/doc/rustc-dev-guide/src/serialization.md b/src/doc/rustc-dev-guide/src/serialization.md index 891ff913c144f..0f5b53d346593 100644 --- a/src/doc/rustc-dev-guide/src/serialization.md +++ b/src/doc/rustc-dev-guide/src/serialization.md @@ -108,7 +108,7 @@ like [`ty::Predicate`] and manually implementing `Encodable` and `Decodable` may [`RefDecodable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.RefDecodable.html [`rustc_middle`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/index.html [`ty::Predicate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/predicate/struct.Predicate.html -[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html [`TyDecodable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_macros/derive.TyDecodable.html [`TyDecoder`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.TyDecoder.html [`TyEncodable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_macros/derive.TyEncodable.html diff --git a/src/doc/rustc-dev-guide/src/tests/running.md b/src/doc/rustc-dev-guide/src/tests/running.md index 112c9af455628..4aa538f894f8b 100644 --- a/src/doc/rustc-dev-guide/src/tests/running.md +++ b/src/doc/rustc-dev-guide/src/tests/running.md @@ -373,7 +373,7 @@ export TEST_DEVICE_ADDR="127.0.0.1:12345" # FIXME(madsmtm): Allow debuginfo tests to work (maybe needs `.dSYM` folder to be copied to the target?). ``` -[armhf-gnu]: https://github.com/rust-lang/rust/tree/HEAD/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile +[armhf-gnu]: https://github.com/rust-lang/rust/tree/HEAD/src/ci/docker/host-x86_64/test-armhf-gnu/Dockerfile [QEMU]: https://www.qemu.org/ [remote-test-client]: https://github.com/rust-lang/rust/tree/HEAD/src/tools/remote-test-client [remote-test-server]: https://github.com/rust-lang/rust/tree/HEAD/src/tools/remote-test-server diff --git a/src/doc/rustc-dev-guide/src/tests/ui.md b/src/doc/rustc-dev-guide/src/tests/ui.md index 1ec6e84d30502..56c0b46d7b862 100644 --- a/src/doc/rustc-dev-guide/src/tests/ui.md +++ b/src/doc/rustc-dev-guide/src/tests/ui.md @@ -177,10 +177,10 @@ The corresponding reference file will use the normalized output to test both ... ``` -Please see [`ui/transmute/main.rs`][mrs] and [`main.stderr`] for a concrete usage example. +Please see [`ui/transmute/main.rs`][mrs] and [`main.current.stderr`] for a concrete usage example. [mrs]: https://github.com/rust-lang/rust/blob/HEAD/tests/ui/transmute/main.rs -[`main.stderr`]: https://github.com/rust-lang/rust/blob/HEAD/tests/ui/transmute/main.stderr +[`main.current.stderr`]: https://github.com/rust-lang/rust/blob/HEAD/tests/ui/transmute/main.current.stderr ## Error annotations diff --git a/src/doc/rustc-dev-guide/src/ty-module/generic-arguments.md b/src/doc/rustc-dev-guide/src/ty-module/generic-arguments.md index 295b654e0ce4b..b7d032ce9b51c 100644 --- a/src/doc/rustc-dev-guide/src/ty-module/generic-arguments.md +++ b/src/doc/rustc-dev-guide/src/ty-module/generic-arguments.md @@ -51,7 +51,7 @@ There is essentially a one-to-one relationship between `AdtDef` and `DefId`. You can get the `AdtDef` for a `DefId` with the [`tcx.adt_def(def_id)` query][adtdefq]. `AdtDef`s are all interned, as shown by the `'tcx` lifetime. -[adtdefq]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.adt_def +[adtdefq]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.adt_def ## Question: Why not substitute “inside” the `AdtDef`? @@ -166,5 +166,5 @@ The general theme of how it works is outermost to innermost (`T` before `T2` in Check out [`ty::Generics`] for exact specifics on how the flattening works. [`ty::Generics`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Generics.html -[`generics_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.generics_of +[`generics_of`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.generics_of [late-bound generics]: ../early-late-parameters.md From 7a902d84dd09d9060923b6a742291af71cd1cdad Mon Sep 17 00:00:00 2001 From: Redddy Date: Mon, 23 Nov 2026 06:28:14 +0000 Subject: [PATCH 09/25] fix link connection --- src/doc/rustc-dev-guide/src/hir.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/hir.md b/src/doc/rustc-dev-guide/src/hir.md index 1a4e300b626d2..abf1b6d8485ed 100644 --- a/src/doc/rustc-dev-guide/src/hir.md +++ b/src/doc/rustc-dev-guide/src/hir.md @@ -107,7 +107,7 @@ The HIR uses a bunch of different identifiers that coexist and serve different p For more info about HIR bodies, please refer to the [HIR chapter][hir-bodies]. -These identifiers can be converted into one another through the `TyCtxt`. +These identifiers can be converted into one another through the [`TyCtxt`]. [`DefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefId.html [`LocalDefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.LocalDefId.html @@ -121,7 +121,7 @@ These identifiers can be converted into one another through the `TyCtxt`. ## HIR Operations -Most of the time when you are working with the HIR, you will do so via `TyCtxt`. +Most of the time when you are working with the HIR, you will do so via [`TyCtxt`]. It contains a number of methods, defined in the `hir::map` module and mostly prefixed with `hir_`, to convert between IDs of various kinds and to lookup data associated with a HIR node. @@ -162,7 +162,7 @@ A [`rustc_hir::Body`] represents some kind of executable code, such as the body of a function/closure or the definition of a constant. Bodies are associated with an **owner**, which is typically some kind of item (e.g. an `fn()` or `const`), but could also be a closure expression -(e.g. `|x, y| x + y`). You can use the `TyCtxt` to find the body +(e.g. `|x, y| x + y`). You can use the [`TyCtxt`] to find the body associated with a given def-id ([`hir_maybe_body_owned_by`]) or to find the owner of a body ([`hir_body_owner_def_id`]). From 9048760c6ae5d38ffc95767c9d902750c08e674a Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Mon, 23 Nov 2026 08:26:27 +0000 Subject: [PATCH 10/25] Prepare for merging from rust-lang/rust This updates the rust-version file to 5debe6a1244452beced762385f88a51857a915fc. --- 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 f7edaffb6aee2..1d6089214b36e 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -fde8dfd638478da758f93f0e8d9b74d7907f0c9e +5debe6a1244452beced762385f88a51857a915fc From 31a18a17b3260c22f9385be05f93cae83646d8a5 Mon Sep 17 00:00:00 2001 From: Yassa-hue Date: Wed, 11 Nov 2026 23:11:22 +0200 Subject: [PATCH 11/25] update-hir-lowering-doc --- src/doc/rustc-dev-guide/src/hir/lowering.md | 44 +++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/hir/lowering.md b/src/doc/rustc-dev-guide/src/hir/lowering.md index d555e0e7b3a85..501325c60a14e 100644 --- a/src/doc/rustc-dev-guide/src/hir/lowering.md +++ b/src/doc/rustc-dev-guide/src/hir/lowering.md @@ -30,31 +30,34 @@ split across multiple files in the [`rustc_ast_lowering`] crate such as `item.rs `expr.rs`, `pat.rs`, `path.rs`, and others, but they all share the same [`LoweringContext`] state and ID‑lowering machinery. -Each owner is lowered in its own [`with_hir_id_owner`] scope. -This is why the -`HirId` invariants below matter: `lower_node_id` maps AST `NodeId`s into the -current owner, while `next_id` creates fresh HIR-only nodes introduced during -desugaring. +Each owner is lowered in its own [`LoweringContext`] context. +Each Lowering owner gets a new lowering context inside `lower_to_hir`, +specifically `with_lctx` helper function. +This is why the `HirId` invariants below matter: `lower_node_id` allocates a new `HirId` for +the given `NodeId`, while `next_id` creates fresh `HirId` introduced during desugaring. Lowering needs to uphold several invariants in order to not trigger the sanity checks in [`compiler/rustc_passes/src/hir_id_validator.rs`][hir_id_validator]: -1. A `HirId` must be used if created. - So, if you use the `lower_node_id`, - you *must* use the resulting `NodeId` or `HirId` (either is fine, since - any `NodeId`s in the `HIR` are checked for existing `HirId`s). +1. A `HirId` must be used if created, + therefore the `ItemLocalId`s set of local IDs associated with the owner’s nodes + form a dense range of integers starting at zero as IDs are allocated + consecutively starting at one, zero is reserved for the owner. + 2. Lowering a `HirId` must be done in the scope of the *owning* item. - This means you need to use `with_hir_id_owner` if you are creating parts - of an item other than the one being currently lowered. - This happens, for example, during the lowering of existential `impl Trait`. -3. A `NodeId` that will be placed into a HIR structure must be lowered, - even if its `HirId` is unused. - Calling `let _ = self.lower_node_id(node_id);` is perfectly legitimate. -4. If you are creating new nodes that didn't exist in the `AST`, you *must* - create new ids for them. - This is done by calling the `next_id` method, - which produces both a new `NodeId` as well as automatically lowering it - for you so you also get the `HirId`. + And this is done by creating a new `LoweringContext` for each owner. + +3. When lowering an AST node, + the compiler can create HIR nodes that don't exist in the AST tree during desugaring + such as the loop instead of the for loop. + These HIR nodes must have a `HirId` and this is done by `next_id`. + +4. There's always at least one entry for the owning item itself. + The owner node has local ID zero, so the owner’s collection is nonempty. + +5. When traversing an item with a nested item, + the owner part of the nested item's definition parent `HirId` must match + the enclosing HIR owner currently being traversed. [`rustc_ast_lowering`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/index.html [`lower_to_hir`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/fn.lower_to_hir.html @@ -62,7 +65,6 @@ sanity checks in [`compiler/rustc_passes/src/hir_id_validator.rs`][hir_id_valida [`hir::Crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/struct.Crate.html [`ItemLowerer::lower_node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/item/struct.ItemLowerer.html [`LoweringContext`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html -[`with_hir_id_owner`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html#method.with_hir_id_owner [hir_id_validator]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_passes/src/hir_id_validator.rs If you are creating new `DefId`s, since each `DefId` needs to have a From 70e5f9411ea2aa462eb7be442efb12b2f0f467a5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 24 Nov 2026 08:16:47 +0100 Subject: [PATCH 12/25] add test checking that -Ctarget-feature implies cfg(target_feature) --- .../target-feature-detection.rs | 4 ++-- .../target-feature-flag-sets-cfg.rs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/ui/target-feature/target-feature-flag-sets-cfg.rs diff --git a/tests/ui/target-feature/target-feature-detection.rs b/tests/ui/target-feature/target-feature-detection.rs index 9a9102bf7d54d..22ff8442e3ed2 100644 --- a/tests/ui/target-feature/target-feature-detection.rs +++ b/tests/ui/target-feature/target-feature-detection.rs @@ -1,5 +1,5 @@ -//! Check that `cfg!(target_feature = "...")` correctly detects available CPU features, -//! specifically `sse2` on x86/x86_64 platforms, and correctly reports absent features. +//! Check that `cfg!(target_feature = "...")` correctly detects available CPU features from the base +//! target, specifically `sse2` on x86/x86_64 platforms, and correctly reports absent features. //@ run-pass //@ ignore-i586 (no SSE2) diff --git a/tests/ui/target-feature/target-feature-flag-sets-cfg.rs b/tests/ui/target-feature/target-feature-flag-sets-cfg.rs new file mode 100644 index 0000000000000..d1d778ce85901 --- /dev/null +++ b/tests/ui/target-feature/target-feature-flag-sets-cfg.rs @@ -0,0 +1,23 @@ +//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`. +// These are just warnings for now. +//@ check-pass +//@ compile-flags: --crate-type=lib +//@ revisions: x86 riscv +//@[x86] compile-flags: --target=x86_64-unknown-linux-gnu -Ctarget-feature=+avx512f +//@[x86] needs-llvm-components: x86 +//@[riscv] compile-flags: --target=riscv64im-unknown-none-elf -Ctarget-feature=+d +//@[riscv] needs-llvm-components: riscv +//@ add-minicore + +#![feature(no_core, riscv_target_feature)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// Ensure we can "see" the enabled target feature, and its implications. +#[cfg(not(any( + all(target_arch = "x86_64", target_feature = "avx512f", target_feature = "avx2"), + all(target_arch = "riscv64", target_feature = "d", target_feature = "f") +)))] +compile_error!("target feature has not been set in cfg"); From 0096949fba0fd7624e32e4a424d14f372f631d24 Mon Sep 17 00:00:00 2001 From: Aymene Date: Tue, 24 Nov 2026 19:37:25 +0100 Subject: [PATCH 13/25] Fix typo in ConstItemInteriorMutationsDiag struct --- compiler/rustc_lint/src/diagnostics.rs | 2 +- ...em-interior-mutations-const-atomics.stderr | 88 +++++++++---------- ...-item-interior-mutations-const-cell.stderr | 44 +++++----- ...const-item-interior-mutations-const.stderr | 60 ++++++------- 4 files changed, 97 insertions(+), 97 deletions(-) diff --git a/compiler/rustc_lint/src/diagnostics.rs b/compiler/rustc_lint/src/diagnostics.rs index 3565df367aa89..a3663ca96af6c 100644 --- a/compiler/rustc_lint/src/diagnostics.rs +++ b/compiler/rustc_lint/src/diagnostics.rs @@ -1101,7 +1101,7 @@ pub(crate) struct ConstItemInteriorMutationsDiag<'tcx> { pub method_name: Ident, pub const_name: Ident, pub const_ty: Ty<'tcx>, - #[label("`{$const_name}` is a interior mutable `const` item of type `{$const_ty}`")] + #[label("`{$const_name}` is an interior mutable `const` item of type `{$const_ty}`")] pub receiver_span: Span, #[subdiagnostic] pub sugg_static: Option, diff --git a/tests/ui/lint/const-item-interior-mutations-const-atomics.stderr b/tests/ui/lint/const-item-interior-mutations-const-atomics.stderr index dd6f561f5b799..d82944bbd88c7 100644 --- a/tests/ui/lint/const-item-interior-mutations-const-atomics.stderr +++ b/tests/ui/lint/const-item-interior-mutations-const-atomics.stderr @@ -4,7 +4,7 @@ warning: mutation of an interior mutable `const` item with call to `store` LL | let _a = A.store(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -22,7 +22,7 @@ warning: mutation of an interior mutable `const` item with call to `swap` LL | let _a = A.swap(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -39,7 +39,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_and_ LL | let _a = A.compare_and_swap(false, true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -56,7 +56,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch LL | let _a = A.compare_exchange(false, true, Ordering::SeqCst, Ordering::Relaxed); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -73,7 +73,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch LL | let _a = A.compare_exchange_weak(false, true, Ordering::SeqCst, Ordering::Relaxed); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -90,7 +90,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_and` LL | let _a = A.fetch_and(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -107,7 +107,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_nand` LL | let _a = A.fetch_nand(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -124,7 +124,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_or` LL | let _a = A.fetch_or(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -141,7 +141,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_xor` LL | let _a = A.fetch_xor(true, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -158,7 +158,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_not` LL | let _a = A.fetch_not(Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -175,7 +175,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_update LL | let _a = A.fetch_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(true)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -192,7 +192,7 @@ warning: mutation of an interior mutable `const` item with call to `try_update` LL | let _a = A.try_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(false)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -209,7 +209,7 @@ warning: mutation of an interior mutable `const` item with call to `update` LL | let _a = A.update(Ordering::SeqCst, Ordering::Relaxed, |_| true); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -226,7 +226,7 @@ warning: mutation of an interior mutable `const` item with call to `store` LL | let _a = A.store(std::ptr::null_mut(), Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -243,7 +243,7 @@ warning: mutation of an interior mutable `const` item with call to `swap` LL | let _a = A.swap(std::ptr::null_mut(), Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -260,7 +260,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_and_ LL | let _a = A.compare_and_swap(std::ptr::null_mut(), std::ptr::null_mut(), Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -275,7 +275,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch --> $DIR/const-item-interior-mutations-const-atomics.rs:64:14 | LL | let _a = A.compare_exchange( - | ^ `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | ^ `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | ______________| | | LL | | @@ -299,7 +299,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch --> $DIR/const-item-interior-mutations-const-atomics.rs:72:14 | LL | let _a = A.compare_exchange_weak( - | ^ `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | ^ `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | ______________| | | LL | | @@ -325,7 +325,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_update LL | let _a = A.fetch_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(std::ptr::null_mut())); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -342,7 +342,7 @@ warning: mutation of an interior mutable `const` item with call to `try_update` LL | let _a = A.try_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(std::ptr::null_mut())); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -359,7 +359,7 @@ warning: mutation of an interior mutable `const` item with call to `update` LL | let _a = A.update(Ordering::SeqCst, Ordering::Relaxed, |_| std::ptr::null_mut()); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -376,7 +376,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_ptr_ad LL | let _a = A.fetch_ptr_add(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -393,7 +393,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_ptr_su LL | let _a = A.fetch_ptr_sub(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -410,7 +410,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_byte_a LL | let _a = A.fetch_byte_add(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -427,7 +427,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_byte_s LL | let _a = A.fetch_byte_sub(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -444,7 +444,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_and` LL | let _a = A.fetch_and(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -461,7 +461,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_or` LL | let _a = A.fetch_or(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -478,7 +478,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_xor` LL | let _a = A.fetch_xor(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic<*mut i32>` + | `A` is an interior mutable `const` item of type `Atomic<*mut i32>` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -495,7 +495,7 @@ warning: mutation of an interior mutable `const` item with call to `store` LL | let _a = A.store(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -512,7 +512,7 @@ warning: mutation of an interior mutable `const` item with call to `swap` LL | let _a = A.swap(2, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -529,7 +529,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_and_ LL | let _a = A.compare_and_swap(2, 3, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -546,7 +546,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch LL | let _a = A.compare_exchange(3, 4, Ordering::SeqCst, Ordering::Relaxed); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -563,7 +563,7 @@ warning: mutation of an interior mutable `const` item with call to `compare_exch LL | let _a = A.compare_exchange_weak(4, 5, Ordering::SeqCst, Ordering::Relaxed); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -580,7 +580,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_add` LL | let _a = A.fetch_add(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -597,7 +597,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_sub` LL | let _a = A.fetch_sub(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -614,7 +614,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_add` LL | let _a = A.fetch_add(2, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -631,7 +631,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_nand` LL | let _a = A.fetch_nand(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -648,7 +648,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_or` LL | let _a = A.fetch_or(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -665,7 +665,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_xor` LL | let _a = A.fetch_xor(1, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -682,7 +682,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_update LL | let _a = A.fetch_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(10)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -699,7 +699,7 @@ warning: mutation of an interior mutable `const` item with call to `try_update` LL | let _a = A.try_update(Ordering::SeqCst, Ordering::Relaxed, |_| Some(11)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -716,7 +716,7 @@ warning: mutation of an interior mutable `const` item with call to `update` LL | let _a = A.update(Ordering::SeqCst, Ordering::Relaxed, |_| 12); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -733,7 +733,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_max` LL | let _a = A.fetch_max(20, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -750,7 +750,7 @@ warning: mutation of an interior mutable `const` item with call to `fetch_min` LL | let _a = A.fetch_min(5, Ordering::SeqCst); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Atomic` + | `A` is an interior mutable `const` item of type `Atomic` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified diff --git a/tests/ui/lint/const-item-interior-mutations-const-cell.stderr b/tests/ui/lint/const-item-interior-mutations-const-cell.stderr index ec3a5f4e38eed..c9b95a64200bc 100644 --- a/tests/ui/lint/const-item-interior-mutations-const-cell.stderr +++ b/tests/ui/lint/const-item-interior-mutations-const-cell.stderr @@ -4,7 +4,7 @@ warning: mutation of an interior mutable `const` item with call to `force` LL | let _ = LazyCell::force(&A); | ^^^^^^^^^^^^^^^^^-^ | | - | `A` is a interior mutable `const` item of type `LazyCell` + | `A` is an interior mutable `const` item of type `LazyCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -22,7 +22,7 @@ warning: mutation of an interior mutable `const` item with call to `set` LL | let _ = A.set(10); | -^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceCell` + | `A` is an interior mutable `const` item of type `OnceCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -39,7 +39,7 @@ warning: mutation of an interior mutable `const` item with call to `try_insert` LL | let _ = A.try_insert(20); | -^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceCell` + | `A` is an interior mutable `const` item of type `OnceCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -56,7 +56,7 @@ warning: mutation of an interior mutable `const` item with call to `get_or_init` LL | let _ = A.get_or_init(|| 30); | -^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceCell` + | `A` is an interior mutable `const` item of type `OnceCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -73,7 +73,7 @@ warning: mutation of an interior mutable `const` item with call to `get_or_try_i LL | let _ = A.get_or_try_init(|| Ok::<_, ()>(40)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceCell` + | `A` is an interior mutable `const` item of type `OnceCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -90,7 +90,7 @@ warning: mutation of an interior mutable `const` item with call to `set` LL | let _ = A.set(1); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Cell` + | `A` is an interior mutable `const` item of type `Cell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -107,7 +107,7 @@ warning: mutation of an interior mutable `const` item with call to `swap` LL | let _ = A.swap(&A); | -^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Cell` + | `A` is an interior mutable `const` item of type `Cell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -124,7 +124,7 @@ warning: mutation of an interior mutable `const` item with call to `replace` LL | let _ = A.replace(2); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Cell` + | `A` is an interior mutable `const` item of type `Cell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -141,7 +141,7 @@ warning: mutation of an interior mutable `const` item with call to `get` LL | let _ = A.get(); | -^^^^^^ | | - | `A` is a interior mutable `const` item of type `Cell` + | `A` is an interior mutable `const` item of type `Cell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -158,7 +158,7 @@ warning: mutation of an interior mutable `const` item with call to `update` LL | let _ = A.update(|x| x + 1); | -^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `Cell` + | `A` is an interior mutable `const` item of type `Cell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -175,7 +175,7 @@ warning: mutation of an interior mutable `const` item with call to `replace` LL | let _ = A.replace(1); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -192,7 +192,7 @@ warning: mutation of an interior mutable `const` item with call to `replace_with LL | let _ = A.replace_with(|x| *x + 2); | -^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -209,7 +209,7 @@ warning: mutation of an interior mutable `const` item with call to `swap` LL | let _ = A.swap(&A); | -^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -226,7 +226,7 @@ warning: mutation of an interior mutable `const` item with call to `borrow` LL | let _ = A.borrow(); | -^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -243,7 +243,7 @@ warning: mutation of an interior mutable `const` item with call to `try_borrow` LL | let _ = A.try_borrow(); | -^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -260,7 +260,7 @@ warning: mutation of an interior mutable `const` item with call to `borrow_mut` LL | let _ = A.borrow_mut(); | -^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -277,7 +277,7 @@ warning: mutation of an interior mutable `const` item with call to `try_borrow_m LL | let _ = A.try_borrow_mut(); | -^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `RefCell` + | `A` is an interior mutable `const` item of type `RefCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -294,7 +294,7 @@ warning: mutation of an interior mutable `const` item with call to `replace` LL | let _ = unsafe { A.replace(1) }; | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `UnsafeCell` + | `A` is an interior mutable `const` item of type `UnsafeCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -311,7 +311,7 @@ warning: mutation of an interior mutable `const` item with call to `get` LL | let _ = A.get(); | -^^^^^^ | | - | `A` is a interior mutable `const` item of type `UnsafeCell` + | `A` is an interior mutable `const` item of type `UnsafeCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -328,7 +328,7 @@ warning: mutation of an interior mutable `const` item with call to `as_ref_unche LL | let _ = A.as_ref_unchecked(); | -^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `UnsafeCell` + | `A` is an interior mutable `const` item of type `UnsafeCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -345,7 +345,7 @@ warning: mutation of an interior mutable `const` item with call to `as_mut_unche LL | let _ = A.as_mut_unchecked(); | -^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `UnsafeCell` + | `A` is an interior mutable `const` item of type `UnsafeCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -362,7 +362,7 @@ warning: mutation of an interior mutable `const` item with call to `get` LL | let _ = A.get(); | -^^^^^^ | | - | `A` is a interior mutable `const` item of type `SyncUnsafeCell` + | `A` is an interior mutable `const` item of type `SyncUnsafeCell` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified diff --git a/tests/ui/lint/const-item-interior-mutations-const.stderr b/tests/ui/lint/const-item-interior-mutations-const.stderr index 2fe8f190dbed8..f615f6ecabf93 100644 --- a/tests/ui/lint/const-item-interior-mutations-const.stderr +++ b/tests/ui/lint/const-item-interior-mutations-const.stderr @@ -4,7 +4,7 @@ warning: mutation of an interior mutable `const` item with call to `set` LL | let _a = A.set(1); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Mutex` + | `A` is an interior mutable `const` item of type `std::sync::Mutex` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -22,7 +22,7 @@ warning: mutation of an interior mutable `const` item with call to `replace` LL | let _a = A.replace(2); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Mutex` + | `A` is an interior mutable `const` item of type `std::sync::Mutex` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -39,7 +39,7 @@ warning: mutation of an interior mutable `const` item with call to `lock` LL | drop(A.lock()); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Mutex` + | `A` is an interior mutable `const` item of type `std::sync::Mutex` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -56,7 +56,7 @@ warning: mutation of an interior mutable `const` item with call to `try_lock` LL | drop(A.try_lock()); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Mutex` + | `A` is an interior mutable `const` item of type `std::sync::Mutex` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -73,7 +73,7 @@ warning: mutation of an interior mutable `const` item with call to `clear_poison LL | let _a = A.clear_poison(); | -^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Mutex` + | `A` is an interior mutable `const` item of type `std::sync::Mutex` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -90,7 +90,7 @@ warning: mutation of an interior mutable `const` item with call to `call_once` LL | let _a = A.call_once(|| {}); | -^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Once` + | `A` is an interior mutable `const` item of type `std::sync::Once` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -107,7 +107,7 @@ warning: mutation of an interior mutable `const` item with call to `call_once_fo LL | let _a = A.call_once_force(|_| {}); | -^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Once` + | `A` is an interior mutable `const` item of type `std::sync::Once` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -124,7 +124,7 @@ warning: mutation of an interior mutable `const` item with call to `wait` LL | let _a = A.wait(); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Once` + | `A` is an interior mutable `const` item of type `std::sync::Once` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -141,7 +141,7 @@ warning: mutation of an interior mutable `const` item with call to `wait_force` LL | let _a = A.wait_force(); | -^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Once` + | `A` is an interior mutable `const` item of type `std::sync::Once` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -158,7 +158,7 @@ warning: mutation of an interior mutable `const` item with call to `set` LL | let _a = A.set(1); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -175,7 +175,7 @@ warning: mutation of an interior mutable `const` item with call to `replace` LL | let _a = A.replace(2); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -192,7 +192,7 @@ warning: mutation of an interior mutable `const` item with call to `read` LL | drop(A.read()); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -209,7 +209,7 @@ warning: mutation of an interior mutable `const` item with call to `try_read` LL | drop(A.try_read()); | -^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -226,7 +226,7 @@ warning: mutation of an interior mutable `const` item with call to `write` LL | drop(A.write()); | -^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -243,7 +243,7 @@ warning: mutation of an interior mutable `const` item with call to `try_write` LL | drop(A.try_write()); | -^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::RwLock` + | `A` is an interior mutable `const` item of type `std::sync::RwLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -260,7 +260,7 @@ warning: mutation of an interior mutable `const` item with call to `force` LL | let _a = LazyLock::force(&A); | ^^^^^^^^^^^^^^^^^-^ | | - | `A` is a interior mutable `const` item of type `LazyLock` + | `A` is an interior mutable `const` item of type `LazyLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -277,7 +277,7 @@ warning: mutation of an interior mutable `const` item with call to `get` LL | let _a = LazyLock::get(&A); | ^^^^^^^^^^^^^^^-^ | | - | `A` is a interior mutable `const` item of type `LazyLock` + | `A` is an interior mutable `const` item of type `LazyLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -294,7 +294,7 @@ warning: mutation of an interior mutable `const` item with call to `get` LL | let _a = A.get(); | -^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -311,7 +311,7 @@ warning: mutation of an interior mutable `const` item with call to `wait` LL | let _a = A.wait(); | -^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -328,7 +328,7 @@ warning: mutation of an interior mutable `const` item with call to `set` LL | let _a = A.set(10); | -^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -345,7 +345,7 @@ warning: mutation of an interior mutable `const` item with call to `try_insert` LL | let _a = A.try_insert(20); | -^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -362,7 +362,7 @@ warning: mutation of an interior mutable `const` item with call to `get_or_init` LL | let _a = A.get_or_init(|| 30); | -^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -379,7 +379,7 @@ warning: mutation of an interior mutable `const` item with call to `get_or_try_i LL | let _a = A.get_or_try_init(|| Ok::<_, ()>(40)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `OnceLock` + | `A` is an interior mutable `const` item of type `OnceLock` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -396,7 +396,7 @@ warning: mutation of an interior mutable `const` item with call to `wait` LL | let _a = A.wait(guard); | -^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -413,7 +413,7 @@ warning: mutation of an interior mutable `const` item with call to `wait_while` LL | let _a = A.wait_while(guard, |x| *x == 0); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -430,7 +430,7 @@ warning: mutation of an interior mutable `const` item with call to `wait_timeout LL | let _a = A.wait_timeout_ms(guard, 10); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -447,7 +447,7 @@ warning: mutation of an interior mutable `const` item with call to `wait_timeout LL | let _a = A.wait_timeout(guard, Duration::from_millis(10)); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -464,7 +464,7 @@ warning: mutation of an interior mutable `const` item with call to `wait_timeout LL | let _a = A.wait_timeout_while(guard, Duration::from_millis(10), |x| *x == 0); | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -481,7 +481,7 @@ warning: mutation of an interior mutable `const` item with call to `notify_one` LL | let _a = A.notify_one(); | -^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified @@ -498,7 +498,7 @@ warning: mutation of an interior mutable `const` item with call to `notify_all` LL | let _a = A.notify_all(); | -^^^^^^^^^^^^^ | | - | `A` is a interior mutable `const` item of type `std::sync::Condvar` + | `A` is an interior mutable `const` item of type `std::sync::Condvar` | = note: each usage of a `const` item creates a new temporary = note: only the temporaries and never the original `const A` will be modified From 7ee3dfef93638aadd4c7affda9fe6674be127428 Mon Sep 17 00:00:00 2001 From: xonx4l Date: Tue, 24 Nov 2026 21:14:14 +0000 Subject: [PATCH 14/25] Add explanatory comment and rename alias of stdarch intrinsic-test --- src/bootstrap/src/core/build_steps/test.rs | 13 +++++++++---- .../core/builder/cli_paths/snapshots/x_test.snap | 2 +- .../cli_paths/snapshots/x_test_skip_coverage.snap | 2 +- .../snapshots/x_test_skip_coverage_map.snap | 2 +- .../snapshots/x_test_skip_coverage_run.snap | 2 +- .../cli_paths/snapshots/x_test_skip_tests.snap | 2 +- .../snapshots/x_test_skip_tests_coverage.snap | 2 +- .../cli_paths/snapshots/x_test_skip_tests_etc.snap | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 9c930c201b20d..2701e9f3b7e0c 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1071,12 +1071,17 @@ pub struct IntrinsicTest { host: TargetSelection, } +impl IntrinsicTest { + const ALIAS: &'static str = "stdarch-intrinsic-test"; +} + impl CommandLineStep for IntrinsicTest { type Output = (); const IS_HOST: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.alias("intrinsic-test") + // Not using a path since we don't want this to be part of `./x test library`. + run.alias(Self::ALIAS) } fn is_default_step(_builder: &Builder<'_>) -> bool { @@ -1087,12 +1092,12 @@ impl CommandLineStep for IntrinsicTest { let target = run.target; let builder = run.builder; - let is_explicit = - builder.config.paths.iter().any(|p| p.to_string_lossy() == "intrinsic-test"); + let is_explicit = builder.config.paths.iter().any(|p| p.to_string_lossy() == Self::ALIAS); if target.contains("x86_64-unknown-linux") && builder.config.sde.is_none() && is_explicit { panic!( - "SDE is required to run intrinsic-test. Please configure `build.sde` in config.toml." + "SDE is required to run {}. Please configure `build.sde` in config.toml.", + Self::ALIAS ); } diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap index 1fe97ca766c81..4518b08c8b866 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap @@ -228,4 +228,4 @@ expression: test - Suite(tests/run-make-cargo) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap index f112cdafa81b3..55a800f25e596 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap @@ -225,4 +225,4 @@ expression: test --skip=coverage - Suite(tests/run-make-cargo) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap index 401cdc8432d2f..b5624cfaa0a72 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_map.snap @@ -228,4 +228,4 @@ expression: test --skip=coverage-map - Suite(tests/run-make-cargo) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap index 01d5b362e928f..10067d8bf076f 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage_run.snap @@ -228,4 +228,4 @@ expression: test --skip=coverage-run - Suite(tests/run-make-cargo) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap index b936eeefe8805..febeb867a4920 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap @@ -168,4 +168,4 @@ expression: test --skip=tests - Set({compiler-builtins}) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap index c7ea1c663a030..d96a35d841110 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_coverage.snap @@ -225,4 +225,4 @@ expression: test --skip=tests/coverage - Suite(tests/run-make-cargo) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap index 98b39e619fad8..13953e98f335c 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests_etc.snap @@ -148,4 +148,4 @@ expression: test --skip=tests --skip=library --skip=tidyselftest - Set({compiler-builtins}) [Test] test::IntrinsicTest targets: [x86_64-unknown-linux-gnu] - - Set({intrinsic-test}) + - Set({stdarch-intrinsic-test}) From 33e9f6951e8216fcd69a506e24862e42463f8b51 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 25 Nov 2026 00:19:38 +0000 Subject: [PATCH 15/25] Make `issue-96797.rs` link again This is the regression test for Rust issue 96797. LLVM had merged away a function that `global_asm!` referred to with `sym`, causing the build to fail to link. But the test doesn't link right now. We moved it to `minicore` (in Rust PR 154277) and build it as a `no_core` library, so it would pass even if that function were merged away. Let's go back to building it as a binary for x86-64 Linux. --- tests/ui/asm/x86_64/issue-96797.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs index 3f1f71be021b6..6e9451c2a8874 100644 --- a/tests/ui/asm/x86_64/issue-96797.rs +++ b/tests/ui/asm/x86_64/issue-96797.rs @@ -1,15 +1,15 @@ -//@ add-minicore //@ build-pass -//@ compile-flags: --target x86_64-unknown-linux-gnu -O -//@ needs-llvm-components: x86 -#![crate_type = "lib"] -#![feature(no_core)] -#![no_core] - -extern crate minicore; -use minicore::*; +//@ compile-flags: -O +//@ needs-asm-support +//@ only-x86_64 +//@ only-linux // regression test for #96797 +// +// Note that this test needs to link. It's checking that we did not +// merge `foobar` into `my_func`, which would cause linking to fail. + +use std::arch::global_asm; #[no_mangle] fn my_func() {} From b455f3aea5ac5f266921f270b20c1e3a0ad436b5 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Wed, 25 Nov 2026 10:44:11 +0900 Subject: [PATCH 16/25] Return `Err` from `send_process_group_signal` if leader has been awaited --- library/std/src/sys/process/unix/unix.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/process/unix/unix.rs b/library/std/src/sys/process/unix/unix.rs index d1262ba3e2e6e..40c907d864ca3 100644 --- a/library/std/src/sys/process/unix/unix.rs +++ b/library/std/src/sys/process/unix/unix.rs @@ -1020,7 +1020,10 @@ impl Process { pub(crate) fn send_process_group_signal(&self, signal: i32) -> io::Result<()> { // See note in `send_signal` regarding recycled PIDs. if self.status.is_some() { - return Ok(()); + return Err(io::Error::new( + io::ErrorKind::Other, + "process group leader has already been awaited", + )); } #[cfg(target_os = "linux")] if let Some(pid_fd) = self.pidfd.as_ref() { From 397fe3c3719bdb22a44806d8e6bbc6167ac59b23 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 05:57:05 +0100 Subject: [PATCH 17/25] prevent comment noise Not useful for bot PRs > Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? . --- src/doc/rustc-dev-guide/josh-sync.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/doc/rustc-dev-guide/josh-sync.toml b/src/doc/rustc-dev-guide/josh-sync.toml index ac858e5072378..b3f154de71af7 100644 --- a/src/doc/rustc-dev-guide/josh-sync.toml +++ b/src/doc/rustc-dev-guide/josh-sync.toml @@ -1,6 +1,5 @@ org = "rust-lang" repo = "rustc-dev-guide" path = "src/doc/rustc-dev-guide" - -[push-pr] -suffix = "r? @ghost" +push-pr.suffix = "r? @ghost" +pull-pr.suffix = "r? @ghost" From 32e99697b21707fb34c7b4cdffba8274610b9a5a Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:00:41 +0100 Subject: [PATCH 18/25] reflow src/hir.md --- src/doc/rustc-dev-guide/src/hir.md | 89 +++++++++++++----------------- 1 file changed, 39 insertions(+), 50 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/hir.md b/src/doc/rustc-dev-guide/src/hir.md index abf1b6d8485ed..55b95d884ee9d 100644 --- a/src/doc/rustc-dev-guide/src/hir.md +++ b/src/doc/rustc-dev-guide/src/hir.md @@ -1,14 +1,12 @@ # The HIR -The HIR – "High-Level Intermediate Representation" – is the primary IR used -in most of rustc. +The HIR – "High-Level Intermediate Representation" – is the primary IR used in most of rustc. It is a compiler-friendly representation of the abstract -syntax tree (AST) that is generated after parsing, macro expansion, and name -resolution (see [Lowering](./hir/lowering.md) for how the HIR is created). -Many parts of HIR resemble Rust surface syntax quite closely, with -the exception that some of Rust's expression forms have been desugared away. -For example, `for` loops are converted into a `loop` and do not appear in -the HIR. +syntax tree (AST) that is generated after parsing, macro expansion, +and name resolution (see [Lowering](./hir/lowering.md) for how the HIR is created). +Many parts of HIR resemble Rust surface syntax quite closely, +with the exception that some of Rust's expression forms have been desugared away. +For example, `for` loops are converted into a `loop` and do not appear in the HIR. This makes HIR more amenable to analysis than a normal AST. This chapter covers the main concepts of the HIR. @@ -30,19 +28,17 @@ cargo rustc -- -Z unpretty=hir ## Out-of-band storage and the `Crate` type -The top-level data-structure in the HIR is the [`Crate`], which stores -the contents of the crate currently being compiled (we only ever +The top-level data-structure in the HIR is the [`Crate`], +which stores the contents of the crate currently being compiled (we only ever construct HIR for the current crate). -Whereas in the AST the crate -data structure basically just contains the root module, the HIR -`Crate` structure contains a number of maps and other things that +Whereas in the AST the crate data structure basically just contains the root module, +the HIR `Crate` structure contains a number of maps and other things that serve to organize the content of the crate for easier access. [`Crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/struct.Crate.html For example, the contents of individual items (e.g. modules, -functions, traits, impls, etc) in the HIR are not immediately -accessible in the parents. +functions, traits, impls, etc) in the HIR are not immediately accessible in the parents. So, for example, if there is a module item `foo` containing a function `bar()`: ```rust @@ -53,8 +49,7 @@ mod foo { then in the HIR the representation of module `foo` (the [`Mod`] struct) would only have the **`ItemId`** `I` of `bar()`. -To get the details of the function `bar()`, we would lookup `I` in the -`items` map. +To get the details of the function `bar()`, we would lookup `I` in the `items` map. [`Mod`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Mod.html @@ -69,11 +64,10 @@ integration with incremental compilation. This way, if you gain access to an [`&rustc_hir::Item`] (e.g. for the mod `foo`), you do not immediately gain access to the contents of the function `bar()`. -Instead, you only -gain access to the **id** for `bar()`, and you must invoke some -function to lookup the contents of `bar()` given its id; this gives -the compiler a chance to observe that you accessed the data for -`bar()`, and then record the dependency. +Instead, you only gain access to the **id** for `bar()`, +and you must invoke some function to lookup the contents of `bar()` given its id; this gives +the compiler a chance to observe that you accessed the data for `bar()`, +and then record the dependency. [`&rustc_hir::Item`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Item.html @@ -83,29 +77,27 @@ the compiler a chance to observe that you accessed the data for The HIR uses a bunch of different identifiers that coexist and serve different purposes. -- A [`DefId`], as the name suggests, identifies a particular definition, or top-level - item, in a given crate. +- A [`DefId`], as the name suggests, identifies a particular definition, or top-level item, + in a given crate. It is composed of two parts: a [`CrateNum`] which identifies - the crate the definition comes from, and a [`DefIndex`] which identifies the definition - within the crate. - Unlike [`HirId`]s, there isn't a [`DefId`] for every expression, which - makes them more stable across compilations. + the crate the definition comes from, + and a [`DefIndex`] which identifies the definition within the crate. + Unlike [`HirId`]s, there isn't a [`DefId`] for every expression, + which makes them more stable across compilations. - A [`LocalDefId`] is basically a [`DefId`] that is known to come from the current crate. This allows us to drop the [`CrateNum`] part, and use the type system to ensure that only local definitions are passed to functions that expect a local definition. - A [`HirId`] uniquely identifies a node in the HIR of the current crate. - It is composed of two parts: - an `owner` and a `local_id` that is unique within the `owner`. + It is composed of two parts: an `owner` and a `local_id` that is unique within the `owner`. This combination makes for more stable values which are helpful for incremental compilation. Unlike [`DefId`]s, a [`HirId`] can refer to [fine-grained entities][Node] like expressions, but stays local to the current crate. - A [`BodyId`] identifies a HIR [`Body`] in the current crate. It is currently only a wrapper around a [`HirId`]. - For more info about HIR bodies, please refer to the - [HIR chapter][hir-bodies]. + For more info about HIR bodies, please refer to the [HIR chapter][hir-bodies]. These identifiers can be converted into one another through the [`TyCtxt`]. @@ -122,44 +114,41 @@ These identifiers can be converted into one another through the [`TyCtxt`]. ## HIR Operations Most of the time when you are working with the HIR, you will do so via [`TyCtxt`]. -It contains a number of methods, defined in the `hir::map` module and -mostly prefixed with `hir_`, to convert between IDs of various kinds and to -lookup data associated with a HIR node. +It contains a number of methods, defined in the `hir::map` module and mostly prefixed with `hir_`, +to convert between IDs of various kinds and to lookup data associated with a HIR node. [`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html -For example, if you have a [`LocalDefId`], and you would like to convert it -to a [`HirId`], you can use [`tcx.local_def_id_to_hir_id(def_id)`][local_def_id_to_hir_id]. +For example, if you have a [`LocalDefId`], and you would like to convert it to a [`HirId`], +you can use [`tcx.local_def_id_to_hir_id(def_id)`][local_def_id_to_hir_id]. You need a `LocalDefId`, rather than a `DefId`, since only local items have HIR nodes. [local_def_id_to_hir_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.local_def_id_to_hir_id -Similarly, you can use [`tcx.hir_node(n)`][hir_node] to lookup the node for a -[`HirId`]. -This returns a `Option>`, where [`Node`] is an enum -defined in the map. -By matching on this, you can find out what sort of -node the `HirId` referred to and also get a pointer to the data +Similarly, you can use [`tcx.hir_node(n)`][hir_node] to lookup the node for a [`HirId`]. +This returns a `Option>`, where [`Node`] is an enum defined in the map. +By matching on this, +you can find out what sort of node the `HirId` referred to and also get a pointer to the data itself. Often, you know what sort of node `n` is – e.g. if you know -that `n` must be some HIR expression, you can do -[`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the -[`&hir::Expr`][Expr], panicking if `n` is not in fact an expression. +that `n` must be some HIR expression, you can do [`tcx.hir_expect_expr(n)`][expect_expr], +which will extract and return the [`&hir::Expr`][Expr], +panicking if `n` is not in fact an expression. [hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.hir_node [`Node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html [expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.expect_expr [Expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Expr.html -Finally, you can find the parents of nodes, via -calls like [`tcx.parent_hir_node(n)`][parent_hir_node]. +Finally, you can find the parents of nodes, +via calls like [`tcx.parent_hir_node(n)`][parent_hir_node]. [parent_hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.parent_hir_node ## HIR Bodies -A [`rustc_hir::Body`] represents some kind of executable code, such as the body -of a function/closure or the definition of a constant. +A [`rustc_hir::Body`] represents some kind of executable code, +such as the body of a function/closure or the definition of a constant. Bodies are associated with an **owner**, which is typically some kind of item (e.g. an `fn()` or `const`), but could also be a closure expression (e.g. `|x, y| x + y`). You can use the [`TyCtxt`] to find the body From 067f22aaef1ca9435fd85811365b8cfca85c6dfe Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:12:18 +0100 Subject: [PATCH 19/25] improve hir.md --- src/doc/rustc-dev-guide/src/hir.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/hir.md b/src/doc/rustc-dev-guide/src/hir.md index 55b95d884ee9d..ff33b0d908605 100644 --- a/src/doc/rustc-dev-guide/src/hir.md +++ b/src/doc/rustc-dev-guide/src/hir.md @@ -129,7 +129,8 @@ Similarly, you can use [`tcx.hir_node(n)`][hir_node] to lookup the node for a [` This returns a `Option>`, where [`Node`] is an enum defined in the map. By matching on this, you can find out what sort of node the `HirId` referred to and also get a pointer to the data -itself. Often, you know what sort of node `n` is – e.g. if you know +itself. +Often, you know what sort of node `n` is – e.g. if you know that `n` must be some HIR expression, you can do [`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the [`&hir::Expr`][Expr], panicking if `n` is not in fact an expression. @@ -148,10 +149,11 @@ via calls like [`tcx.parent_hir_node(n)`][parent_hir_node]. ## HIR Bodies A [`rustc_hir::Body`] represents some kind of executable code, -such as the body of a function/closure or the definition of a constant. -Bodies are associated with an **owner**, which is typically some kind of item -(e.g. an `fn()` or `const`), but could also be a closure expression -(e.g. `|x, y| x + y`). You can use the [`TyCtxt`] to find the body +such as the body of a function/closure, or the definition of a constant. +Bodies are associated with an **owner**, +which is typically some kind of item (e.g. an `fn()` or `const`), +but could also be a closure expression (e.g. `|x, y| x + y`). +You can use the [`TyCtxt`] to find the body associated with a given def-id ([`hir_maybe_body_owned_by`]) or to find the owner of a body ([`hir_body_owner_def_id`]). From c370818f3012c3340ef4a127c85f5d3bf4d4b02a Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:13:49 +0100 Subject: [PATCH 20/25] reflow src/parallel-rustc.md --- src/doc/rustc-dev-guide/src/parallel-rustc.md | 73 ++++++++----------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/parallel-rustc.md b/src/doc/rustc-dev-guide/src/parallel-rustc.md index 4a530518c8696..cc51601115ebb 100644 --- a/src/doc/rustc-dev-guide/src/parallel-rustc.md +++ b/src/doc/rustc-dev-guide/src/parallel-rustc.md @@ -12,14 +12,13 @@ As of November 2024, most of the rust compiler is now parallelized. - The codegen part is executed concurrently by default. - You can use the `-C - codegen-units=n` option to control the number of concurrent tasks. -- The parts after HIR lowering to codegen such as type checking, borrowing - checking, and mir optimization are parallelized in the nightly version. - Currently, they are executed in serial by default, and parallelization is - manually enabled by the user using the `-Z threads = n` option. -- Other parts, such as lexical parsing, HIR lowering, and macro expansion, are - still executed in serial mode. + You can use the `-C codegen-units=n` option to control the number of concurrent tasks. +- The parts after HIR lowering to codegen such as type checking, borrowing checking, + and mir optimization are parallelized in the nightly version. + Currently, they are executed in serial by default, + and parallelization is manually enabled by the user using the `-Z threads = n` option. +- Other parts, such as lexical parsing, HIR lowering, and macro expansion, + are still executed in serial mode.
The following sections are kept for now but are quite outdated. @@ -34,8 +33,7 @@ The following sections are kept for now but are quite outdated. During monomorphization the compiler splits up all the code to be generated into smaller chunks called _codegen units_. These are then generated by independent instances of LLVM running in parallel. -At the end, the linker -is run to combine all the codegen units together into one binary. +At the end, the linker is run to combine all the codegen units together into one binary. This process occurs in the [`rustc_codegen_ssa::base`] module. [`rustc_codegen_ssa::base`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/index.html @@ -44,8 +42,7 @@ This process occurs in the [`rustc_codegen_ssa::base`] module. The underlying thread-safe data-structures used in the parallel compiler can be found in the [`rustc_data_structures::sync`] module. -These data structures -are implemented differently depending on whether `parallel-compiler` is true. +These data structures are implemented differently depending on whether `parallel-compiler` is true. | data structure | parallel | non-parallel | | -------------------------------- | --------------------------------------------------- | ------------ | @@ -61,8 +58,8 @@ are implemented differently depending on whether `parallel-compiler` is true. can cause lock contention resulting in degraded performance as the number of threads increases beyond 4. So we audit the use of these data structures which leads to either a refactoring so as to reduce the use of shared state, - or the authoring of persistent documentation covering the specific of the - invariants, the atomicity, and the lock orderings. + or the authoring of persistent documentation covering the specific of the invariants, + the atomicity, and the lock orderings. - On the other hand, we still need to figure out what other invariants during compilation might not hold in parallel compilation. @@ -73,31 +70,27 @@ are implemented differently depending on whether `parallel-compiler` is true. [`WorkerLocal`] is a special data structure implemented for parallel compilers. It holds worker-locals values for each thread in a thread pool. -You can only -access the worker local value through the `Deref` `impl` on the thread pool it +You can only access the worker local value through the `Deref` `impl` on the thread pool it was constructed on. It panics otherwise. -`WorkerLocal` is used to implement the `Arena` allocator in the parallel -environment, which is critical in parallel queries. -Its implementation is -located in the [`rustc_data_structures::sync::worker_local`] module. +`WorkerLocal` is used to implement the `Arena` allocator in the parallel environment, +which is critical in parallel queries. +Its implementation is located in the [`rustc_data_structures::sync::worker_local`] module. However, -in the non-parallel compiler, it is implemented as `(OneThread)`, whose `T` -can be accessed directly through `Deref::deref`. +in the non-parallel compiler, it is implemented as `(OneThread)`, +whose `T` can be accessed directly through `Deref::deref`. [`rustc_data_structures::sync::worker_local`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/sync/worker_local/index.html [`WorkerLocal`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/sync/worker_local/struct.WorkerLocal.html ## Parallel iterator -The parallel iterators provided by the [`rayon`] crate are easy ways to -implement parallelism. +The parallel iterators provided by the [`rayon`] crate are easy ways to implement parallelism. In the current implementation of the parallel compiler, we use [a custom fork of `rayon`][rustc-rayon] to run tasks in parallel. -Some iterator functions are implemented to run loops in parallel -when `parallel-compiler` is true. +Some iterator functions are implemented to run loops in parallel when `parallel-compiler` is true. | Function(Omit `Send` and `Sync`) | Introduction | Owning Module | | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------- | @@ -136,30 +129,26 @@ There are still many loops that have the potential to use parallel iterators. The query model has some properties that make it actually feasible to evaluate multiple queries in parallel without too much effort: -- All data a query provider can access is via the query context, so - the query context can take care of synchronizing access. +- All data a query provider can access is via the query context, + so the query context can take care of synchronizing access. - Query results are required to be immutable so they can safely be used by different threads concurrently. When a query `foo` is evaluated, the cache table for `foo` is locked. -- If there already is a result, we can clone it, release the lock and - we are done. -- If there is no cache entry and no other active query invocation computing the - same result, we mark the key as being "in progress", release the lock and - start evaluating. -- If there *is* another query invocation for the same key in progress, we - release the lock, and just block the thread until the other invocation has - computed the result we are waiting for. +- If there already is a result, we can clone it, release the lock and we are done. +- If there is no cache entry and no other active query invocation computing the same result, + we mark the key as being "in progress", release the lock and start evaluating. +- If there *is* another query invocation for the same key in progress, we release the lock, + and just block the thread until the other invocation has computed the result we are waiting for. **Cycle error detection** in the parallel compiler requires more complex logic than in single-threaded mode. - When - worker threads in parallel queries stop making progress due to interdependence, - the compiler uses an extra thread *(named deadlock handler)* to detect, remove and - report the cycle error. + When worker threads in parallel queries stop making progress due to interdependence, + the compiler uses an extra thread *(named deadlock handler)* to detect, + remove and report the cycle error. -The parallel query feature still has implementation to do, most of which is -related to the previous `Data Structures` and `Parallel Iterators`. +The parallel query feature still has implementation to do, +most of which is related to the previous `Data Structures` and `Parallel Iterators`. See [this open feature tracking issue][tracking]. ## Rustdoc From d93b8e648475c006f6ff123c8276ffccad4b7cfe Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:20:25 +0100 Subject: [PATCH 21/25] improve parallel-rustc.md --- src/doc/rustc-dev-guide/src/parallel-rustc.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/parallel-rustc.md b/src/doc/rustc-dev-guide/src/parallel-rustc.md index cc51601115ebb..98f831e1c985f 100644 --- a/src/doc/rustc-dev-guide/src/parallel-rustc.md +++ b/src/doc/rustc-dev-guide/src/parallel-rustc.md @@ -13,9 +13,9 @@ parallelized. - The codegen part is executed concurrently by default. You can use the `-C codegen-units=n` option to control the number of concurrent tasks. -- The parts after HIR lowering to codegen such as type checking, borrowing checking, +- The parts after HIR lowering to codegen, such as type checking, borrow-checking, and mir optimization are parallelized in the nightly version. - Currently, they are executed in serial by default, + Currently, they are executed serially by default, and parallelization is manually enabled by the user using the `-Z threads = n` option. - Other parts, such as lexical parsing, HIR lowering, and macro expansion, are still executed in serial mode. @@ -42,7 +42,7 @@ This process occurs in the [`rustc_codegen_ssa::base`] module. The underlying thread-safe data-structures used in the parallel compiler can be found in the [`rustc_data_structures::sync`] module. -These data structures are implemented differently depending on whether `parallel-compiler` is true. +These data structures are implemented differently, depending on whether `parallel-compiler` is true. | data structure | parallel | non-parallel | | -------------------------------- | --------------------------------------------------- | ------------ | @@ -136,16 +136,16 @@ multiple queries in parallel without too much effort: When a query `foo` is evaluated, the cache table for `foo` is locked. -- If there already is a result, we can clone it, release the lock and we are done. +- If there already is a result, we can clone it, release the lock, and we are done. - If there is no cache entry and no other active query invocation computing the same result, - we mark the key as being "in progress", release the lock and start evaluating. + we mark the key as being "in progress", release the lock, and start evaluating. - If there *is* another query invocation for the same key in progress, we release the lock, and just block the thread until the other invocation has computed the result we are waiting for. **Cycle error detection** in the parallel compiler requires more complex logic than in single-threaded mode. When worker threads in parallel queries stop making progress due to interdependence, the compiler uses an extra thread *(named deadlock handler)* to detect, - remove and report the cycle error. + remove, and report the cycle error. The parallel query feature still has implementation to do, most of which is related to the previous `Data Structures` and `Parallel Iterators`. From 765c7c822b582eaf4b39801f8ea92f6ec29d92aa Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:20:48 +0100 Subject: [PATCH 22/25] reflow src/tests/compiletest.md --- src/doc/rustc-dev-guide/src/tests/compiletest.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index 037b5b2929afb..50abacbd9d3f5 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -809,7 +809,8 @@ pub fn identity(ts: TokenStream) -> TokenStream { ### Auxiliary lint -By using an `aux-lint` directive in a `ui-fulldeps` test, you can build a 'lint library' file which will be loaded into rustc's lints when running your test. +By using an `aux-lint` directive in a `ui-fulldeps` test, +you can build a 'lint library' file which will be loaded into rustc's lints when running your test. ```rs // tests/ui-fulldeps/lint_test.rs From 58b1549f2b8b0517fc1d1d4a1718464b27bbf078 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:26:59 +0100 Subject: [PATCH 23/25] add date-check marker to recent section --- src/doc/rustc-dev-guide/src/tests/compiletest.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index 50abacbd9d3f5..800266b3feaa0 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -808,6 +808,7 @@ pub fn identity(ts: TokenStream) -> TokenStream { > force-host` and `//@ no-prefer-dynamic` headers in the proc-macro. ### Auxiliary lint + By using an `aux-lint` directive in a `ui-fulldeps` test, you can build a 'lint library' file which will be loaded into rustc's lints when running your test. From 058c874d09e3f0c6b72837e5a838a9940af77f4f Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Wed, 25 Nov 2026 06:28:27 +0100 Subject: [PATCH 24/25] reflow src/tests/x86_64-gnu-parallel-frontend.md --- .../src/tests/x86_64-gnu-parallel-frontend.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/x86_64-gnu-parallel-frontend.md b/src/doc/rustc-dev-guide/src/tests/x86_64-gnu-parallel-frontend.md index bfabce1dc2b69..b897b1d4d44b3 100644 --- a/src/doc/rustc-dev-guide/src/tests/x86_64-gnu-parallel-frontend.md +++ b/src/doc/rustc-dev-guide/src/tests/x86_64-gnu-parallel-frontend.md @@ -1,8 +1,8 @@ # Parallel frontend testing on CI -If you see any test failures in `tests/ui` from the CI job `test-x86_64-gnu-parallel-frontend`, please -add `//@ ignore-parallel-frontend triage` to the failing test, even if your PR is otherwise -entirely unrelated to parallel compiler or its testing. +If you see any test failures in `tests/ui` from the CI job `test-x86_64-gnu-parallel-frontend`, +please add `//@ ignore-parallel-frontend triage` to the failing test, +even if your PR is otherwise entirely unrelated to parallel compiler or its testing. In some time people from the parallel rustc working group will triage the failing test, make a tracking issue for it, and try to debug the problem. From 57050a72bf0c42c60cad4286070a32d99716570c Mon Sep 17 00:00:00 2001 From: Manuel Drehwald Date: Wed, 25 Nov 2026 00:25:33 -0500 Subject: [PATCH 25/25] We decoupled the autodiff frontend a long time ago from the backend --- tests/ui/autodiff/autodiff_illegal.rs | 5 --- tests/ui/autodiff/autodiff_illegal.stderr | 42 +++++++++++------------ 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/tests/ui/autodiff/autodiff_illegal.rs b/tests/ui/autodiff/autodiff_illegal.rs index 5143d26406d5b..5f398933f2d45 100644 --- a/tests/ui/autodiff/autodiff_illegal.rs +++ b/tests/ui/autodiff/autodiff_illegal.rs @@ -1,9 +1,4 @@ -//@ needs-enzyme - #![feature(autodiff)] -//@ pretty-mode:expanded -//@ pretty-compare-only -//@ pp-exact:autodiff_illegal.pp // Test that invalid ad macros give nice errors and don't ICE. diff --git a/tests/ui/autodiff/autodiff_illegal.stderr b/tests/ui/autodiff/autodiff_illegal.stderr index f9f31c3b90a08..54b0e91cb3c17 100644 --- a/tests/ui/autodiff/autodiff_illegal.stderr +++ b/tests/ui/autodiff/autodiff_illegal.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/autodiff_illegal.rs:54:5 + --> $DIR/autodiff_illegal.rs:49:5 | LL | #[autodiff_forward(df7, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,43 +9,43 @@ LL | #[autodiff_forward(df7, Dual)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: Duplicated can not be used for this type - --> $DIR/autodiff_illegal.rs:14:14 + --> $DIR/autodiff_illegal.rs:9:14 | LL | pub fn f1(x: f64) { | ^^^ error: expected 1 activities, but found 2 - --> $DIR/autodiff_illegal.rs:20:1 + --> $DIR/autodiff_illegal.rs:15:1 | LL | #[autodiff_reverse(df3, Duplicated, Const)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected 1 activities, but found 0 - --> $DIR/autodiff_illegal.rs:27:1 + --> $DIR/autodiff_illegal.rs:22:1 | LL | #[autodiff_reverse(df4)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: Dual can not be used in Reverse Mode - --> $DIR/autodiff_illegal.rs:34:1 + --> $DIR/autodiff_illegal.rs:29:1 | LL | #[autodiff_reverse(df5, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Duplicated can not be used in Forward Mode - --> $DIR/autodiff_illegal.rs:41:1 + --> $DIR/autodiff_illegal.rs:36:1 | LL | #[autodiff_forward(df6, Duplicated)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Duplicated can not be used for this type - --> $DIR/autodiff_illegal.rs:42:14 + --> $DIR/autodiff_illegal.rs:37:14 | LL | pub fn f6(x: f64) { | ^^^ error[E0658]: macro attributes on statements are unstable - --> $DIR/autodiff_illegal.rs:49:5 + --> $DIR/autodiff_illegal.rs:44:5 | LL | #[autodiff_forward(df7, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,13 +55,13 @@ LL | #[autodiff_forward(df7, Dual)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: autodiff must be applied to function - --> $DIR/autodiff_illegal.rs:51:5 + --> $DIR/autodiff_illegal.rs:46:5 | LL | let mut x = 5; | ^^^^^^^^^^^^^^ error[E0658]: macro attributes on expressions are unstable - --> $DIR/autodiff_illegal.rs:54:5 + --> $DIR/autodiff_illegal.rs:49:5 | LL | #[autodiff_forward(df7, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,13 +71,13 @@ LL | #[autodiff_forward(df7, Dual)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: autodiff must be applied to function - --> $DIR/autodiff_illegal.rs:55:5 + --> $DIR/autodiff_illegal.rs:50:5 | LL | x = x + 3; | ^ error[E0658]: macro attributes on statements are unstable - --> $DIR/autodiff_illegal.rs:60:5 + --> $DIR/autodiff_illegal.rs:55:5 | LL | #[autodiff_forward(df7, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,13 +87,13 @@ LL | #[autodiff_forward(df7, Dual)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: autodiff must be applied to function - --> $DIR/autodiff_illegal.rs:62:5 + --> $DIR/autodiff_illegal.rs:57:5 | LL | let add_one_v2 = |x: u32| -> u32 { x + 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: autodiff requires at least a name and mode - --> $DIR/autodiff_illegal.rs:68:1 + --> $DIR/autodiff_illegal.rs:63:1 | LL | / pub fn f7(x: f64) { LL | | @@ -102,7 +102,7 @@ LL | | } | |_^ error: autodiff requires at least a name and mode - --> $DIR/autodiff_illegal.rs:75:1 + --> $DIR/autodiff_illegal.rs:70:1 | LL | / pub fn f8(x: f64) { LL | | @@ -111,7 +111,7 @@ LL | | } | |_^ error: autodiff requires at least a name and mode - --> $DIR/autodiff_illegal.rs:82:1 + --> $DIR/autodiff_illegal.rs:77:1 | LL | / pub fn f9(x: f64) { LL | | @@ -120,7 +120,7 @@ LL | | } | |_^ error[E0428]: the name `fn_exists` is defined multiple times - --> $DIR/autodiff_illegal.rs:90:1 + --> $DIR/autodiff_illegal.rs:85:1 | LL | fn fn_exists() {} | -------------- previous definition of the value `fn_exists` here @@ -131,25 +131,25 @@ LL | #[autodiff_reverse(fn_exists, Active)] = note: `fn_exists` must be defined only once in the value namespace of this module error: did not recognize Activity: `Reverse` - --> $DIR/autodiff_illegal.rs:98:26 + --> $DIR/autodiff_illegal.rs:93:26 | LL | #[autodiff_reverse(df13, Reverse)] | ^^^^^^^ error: invalid return activity Active in Forward Mode - --> $DIR/autodiff_illegal.rs:134:1 + --> $DIR/autodiff_illegal.rs:129:1 | LL | #[autodiff_forward(df19, Dual, Active)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid return activity Dual in Reverse Mode - --> $DIR/autodiff_illegal.rs:140:1 + --> $DIR/autodiff_illegal.rs:135:1 | LL | #[autodiff_reverse(df20, Active, Dual)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid return activity Duplicated in Reverse Mode - --> $DIR/autodiff_illegal.rs:147:1 + --> $DIR/autodiff_illegal.rs:142:1 | LL | #[autodiff_reverse(df21, Active, Duplicated)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^