From f9878e18127ae26e82501c80e68c3a00f4cb1a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 24 Sep 2026 05:18:55 +0000 Subject: [PATCH 01/38] Add test for `FnMut` closure moving value --- .../ui/closures/fnmut-closure-moving-value.rs | 33 +++++++++++++++ .../fnmut-closure-moving-value.stderr | 40 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 tests/ui/closures/fnmut-closure-moving-value.rs create mode 100644 tests/ui/closures/fnmut-closure-moving-value.stderr diff --git a/tests/ui/closures/fnmut-closure-moving-value.rs b/tests/ui/closures/fnmut-closure-moving-value.rs new file mode 100644 index 0000000000000..4dba4bde7d0e5 --- /dev/null +++ b/tests/ui/closures/fnmut-closure-moving-value.rs @@ -0,0 +1,33 @@ +struct Foo { + a: i32, + b: i32, + bar: Bar, +} + +struct Bar; + +impl Bar { + fn f(&self, mut f: F) + where F: FnMut() + { + f(); + } +} + +fn main() { + let mut foo = Foo { a: 1, b: 2, bar: Bar }; + let a = &mut foo.a; + let b = &mut foo.b; + (|| { // works + *if true {a} else {b} = 42; + })(); + + let mut foo = Foo { a: 1, b: 2, bar: Bar }; + let a = &mut foo.a; + let b = &mut foo.b; + foo.bar.f(|| { // doesn't work + *if true {a} else {b} = 42; + //~^ ERROR: cannot move out of `a`, a captured variable in an `FnMut` closure + //~| ERROR: cannot move out of `b`, a captured variable in an `FnMut` closure + }); +} diff --git a/tests/ui/closures/fnmut-closure-moving-value.stderr b/tests/ui/closures/fnmut-closure-moving-value.stderr new file mode 100644 index 0000000000000..6acd4bd625a43 --- /dev/null +++ b/tests/ui/closures/fnmut-closure-moving-value.stderr @@ -0,0 +1,40 @@ +error[E0507]: cannot move out of `a`, a captured variable in an `FnMut` closure + --> $DIR/fnmut-closure-moving-value.rs:29:19 + | +LL | let a = &mut foo.a; + | - ---------- move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait + | | + | captured outer variable +LL | let b = &mut foo.b; +LL | foo.bar.f(|| { // doesn't work + | -- captured by this `FnMut` closure +LL | *if true {a} else {b} = 42; + | ^ `a` is moved here + | +help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once + --> $DIR/fnmut-closure-moving-value.rs:11:14 + | +LL | where F: FnMut() + | ^^^^^^^ + +error[E0507]: cannot move out of `b`, a captured variable in an `FnMut` closure + --> $DIR/fnmut-closure-moving-value.rs:29:28 + | +LL | let b = &mut foo.b; + | - ---------- move occurs because `b` has type `&mut i32`, which does not implement the `Copy` trait + | | + | captured outer variable +LL | foo.bar.f(|| { // doesn't work + | -- captured by this `FnMut` closure +LL | *if true {a} else {b} = 42; + | ^ `b` is moved here + | +help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once + --> $DIR/fnmut-closure-moving-value.rs:11:14 + | +LL | where F: FnMut() + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0507`. From e0b39b589322ba66338f3a2d12b78f9df445b8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 24 Sep 2026 05:22:10 +0000 Subject: [PATCH 02/38] Add enclosing item context when pointing at `FnMut` bound Ensure that we always show the `fn` (and its enclosing `trait`/`impl` if appropriate) when pointing at an `FnMut` bound: ``` help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/fnmut-closure-moving-value.rs:11:14 | LL | impl Bar { LL | fn f(&self, mut f: F) LL | where F: FnMut() | ^^^^^^^ ``` --- .../src/diagnostics/move_errors.rs | 20 ++++++++++--- .../fnmut-closure-moving-value.stderr | 4 +++ .../dont-suggest-ref/move-into-closure.stderr | 30 +++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index aa62d6aaa0751..f78727293c62f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -1,6 +1,7 @@ use rustc_abi::FieldIdx; use rustc_data_structures::fx::FxHashSet; -use rustc_errors::{Applicability, Diag}; +use rustc_errors::{Applicability, Diag, MultiSpan}; +use rustc_hir::def::DefKind; use rustc_hir::intravisit::Visitor; use rustc_hir::{self as hir, CaptureBy, ExprKind, HirId, Node}; use rustc_middle::mir::*; @@ -634,7 +635,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> { &self, def_id: DefId, asyncness: ty::Asyncness, - ) -> Option { + ) -> Option { let tcx = self.infcx.tcx; let typeck_result = tcx.typeck(self.mir_def_id()); // Check whether the closure is an argument to a call, if so, @@ -642,14 +643,21 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> { let closure_hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local()); let hir::Node::Expr(parent) = tcx.parent_hir_node(closure_hir_id) else { return None }; + let mut context = vec![]; let gen_clauses = match parent.kind { hir::ExprKind::Call(callee, _) => { let ty = typeck_result.node_type_opt(callee.hir_id)?; let ty::FnDef(fn_def_id, args) = *ty.kind() else { return None }; + context.push(tcx.def_span(fn_def_id).shrink_to_lo()); + if tcx.def_kind(fn_def_id) == DefKind::AssocFn { + context.push(tcx.def_span(tcx.parent(fn_def_id)).shrink_to_lo()); + } tcx.clauses_of(fn_def_id).instantiate(tcx, args.no_bound_vars().unwrap()) } hir::ExprKind::MethodCall(..) => { let (_, method) = typeck_result.type_dependent_def(parent.hir_id)?; + context.push(tcx.def_span(method).shrink_to_lo()); + context.push(tcx.def_span(tcx.parent(method)).shrink_to_lo()); let args = typeck_result.node_args(parent.hir_id); tcx.clauses_of(method).instantiate(tcx, args) } @@ -658,7 +666,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> { // Check whether one of the where-bounds requires the closure to impl `Fn[Mut]` // or `AsyncFn[Mut]`. - for (clause, span) in gen_clauses.clauses.iter().zip(gen_clauses.spans.iter()) { + for (clause, &span) in gen_clauses.clauses.iter().zip(gen_clauses.spans.iter()) { let clause = clause.skip_norm_wip(); let dominated_by_fn_trait = self .closure_clause_kind(clause, def_id, asyncness) @@ -668,7 +676,11 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> { // ``. // We point at the bound that coerced the closure, which could be changed // to `FnOnce()` or `AsyncFnOnce()` to avoid the move error. - return Some(*span); + let mut span: MultiSpan = span.into(); + for context in context { + span.push_span_context(context); + } + return Some(span); } } None diff --git a/tests/ui/closures/fnmut-closure-moving-value.stderr b/tests/ui/closures/fnmut-closure-moving-value.stderr index 6acd4bd625a43..d5c0c98533386 100644 --- a/tests/ui/closures/fnmut-closure-moving-value.stderr +++ b/tests/ui/closures/fnmut-closure-moving-value.stderr @@ -14,6 +14,8 @@ LL | *if true {a} else {b} = 42; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/fnmut-closure-moving-value.rs:11:14 | +LL | impl Bar { +LL | fn f(&self, mut f: F) LL | where F: FnMut() | ^^^^^^^ @@ -32,6 +34,8 @@ LL | *if true {a} else {b} = 42; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/fnmut-closure-moving-value.rs:11:14 | +LL | impl Bar { +LL | fn f(&self, mut f: F) LL | where F: FnMut() | ^^^^^^^ diff --git a/tests/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/tests/ui/suggestions/dont-suggest-ref/move-into-closure.stderr index 03f02223165da..3aea33128358d 100644 --- a/tests/ui/suggestions/dont-suggest-ref/move-into-closure.stderr +++ b/tests/ui/suggestions/dont-suggest-ref/move-into-closure.stderr @@ -257,6 +257,7 @@ LL | let X(_t) = x; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -281,6 +282,7 @@ LL | if let Either::One(_t) = e { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -305,6 +307,7 @@ LL | while let Either::One(_t) = e { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -330,6 +333,7 @@ LL | Either::One(_t) help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -355,6 +359,7 @@ LL | Either::One(_t) => (), help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -379,6 +384,7 @@ LL | let X(mut _t) = x; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -403,6 +409,7 @@ LL | if let Either::One(mut _t) = em { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -427,6 +434,7 @@ LL | while let Either::One(mut _t) = em { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -452,6 +460,7 @@ LL | Either::One(mut _t) help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -477,6 +486,7 @@ LL | Either::One(mut _t) => (), help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:40:22 | +LL | trait T { LL | fn consume_fn(_f: F) { } | ^^^^ help: consider borrowing here @@ -500,6 +510,8 @@ LL | let X(_t) = x; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -524,6 +536,8 @@ LL | if let Either::One(_t) = e { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -548,6 +562,8 @@ LL | while let Either::One(_t) = e { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -573,6 +589,8 @@ LL | Either::One(_t) help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -598,6 +616,8 @@ LL | Either::One(_t) => (), help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -622,6 +642,8 @@ LL | let X(mut _t) = x; help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -646,6 +668,8 @@ LL | if let Either::One(mut _t) = em { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -670,6 +694,8 @@ LL | while let Either::One(mut _t) = em { } help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -695,6 +721,8 @@ LL | Either::One(mut _t) help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here @@ -720,6 +748,8 @@ LL | Either::One(mut _t) => (), help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but `FnOnce` closures may consume them only once --> $DIR/move-into-closure.rs:51:29 | +LL | trait T { +... LL | fn method_consume_fn(&self, _f: F) { } | ^^^^ help: consider borrowing here From 143e1861d86a630f5f0577f99fa2bd394a795c5c Mon Sep 17 00:00:00 2001 From: Joao Roberto Date: Sun, 11 Oct 2026 15:24:31 -0300 Subject: [PATCH 03/38] Preserve equality when relating binder regions Keep region equality in the unification table and transport its deferred outlives requirements through solver constraints. Record directed constraints for subtype relations under assumptions on binders. --- .../src/relate/solver_relating.rs | 45 +++++++++++++++---- .../placeholder-assumptions-issue-157840.rs | 2 +- ...laceholder-assumptions-issue-157840.stderr | 12 +++-- ...principal-upcast-region-eq-issue-157859.rs | 19 ++++++++ ...cipal-upcast-region-eq-issue-157859.stderr | 13 ++++++ .../trait-upcast-projection-region-eq.rs | 23 ++++++++++ .../trait-upcast-projection-region-eq.stderr | 13 ++++++ 7 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.rs create mode 100644 tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.stderr create mode 100644 tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.rs create mode 100644 tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.stderr diff --git a/compiler/rustc_type_ir/src/relate/solver_relating.rs b/compiler/rustc_type_ir/src/relate/solver_relating.rs index 3a7056234553b..e411d79e44dd4 100644 --- a/compiler/rustc_type_ir/src/relate/solver_relating.rs +++ b/compiler/rustc_type_ir/src/relate/solver_relating.rs @@ -2,6 +2,7 @@ use tracing::{debug, instrument}; use self::combine::{PredicateEmittingRelation, super_combine_consts, super_combine_tys}; use crate::data_structures::DelayedSet; +use crate::region_constraint::{LeafRegionConstraint, NoSpan, RegionConstraint}; use crate::relate::combine::combine_ty_args; pub use crate::relate::*; use crate::solve::{Goal, VisibleForLeakCheck}; @@ -239,14 +240,42 @@ where #[instrument(skip(self), level = "trace")] fn regions(&mut self, a: Region, b: Region) -> RelateResult> { - match self.ambient_variance { - // Subtype(&'a u8, &'b u8) => Outlives('a: 'b) => SubRegion('b, 'a) - ty::Covariant => self.infcx.sub_regions(b, a, VisibleForLeakCheck::Yes, self.span), - // Suptype(&'a u8, &'b u8) => Outlives('b: 'a) => SubRegion('a, 'b) - ty::Contravariant => self.infcx.sub_regions(a, b, VisibleForLeakCheck::Yes, self.span), - ty::Invariant => self.infcx.equate_regions(a, b, VisibleForLeakCheck::Yes, self.span), - ty::Bivariant => { - unreachable!("Expected bivariance to be handled in relate_with_variance") + if self.cx().assumptions_on_binders() { + let region_outlives = |a, b| { + RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, NoSpan)) + }; + + match self.ambient_variance { + ty::Bivariant => { + unreachable!("Expected bivariance to be handled in relate_with_variance") + } + _ if a == b => return Ok(a), + ty::Covariant => { + self.infcx.register_solver_region_constraint(region_outlives(a, b), self.span) + } + ty::Contravariant => { + self.infcx.register_solver_region_constraint(region_outlives(b, a), self.span) + } + ty::Invariant => { + self.infcx.equate_regions(a, b, VisibleForLeakCheck::Yes, self.span); + self.infcx.register_solver_region_constraint(region_outlives(a, b), self.span); + self.infcx.register_solver_region_constraint(region_outlives(b, a), self.span); + } + } + } else { + match self.ambient_variance { + // Subtype(&'a u8, &'b u8) => Outlives('a: 'b) => SubRegion('b, 'a) + ty::Covariant => self.infcx.sub_regions(b, a, VisibleForLeakCheck::Yes, self.span), + // Suptype(&'a u8, &'b u8) => Outlives('b: 'a) => SubRegion('a, 'b) + ty::Contravariant => { + self.infcx.sub_regions(a, b, VisibleForLeakCheck::Yes, self.span) + } + ty::Invariant => { + self.infcx.equate_regions(a, b, VisibleForLeakCheck::Yes, self.span) + } + ty::Bivariant => { + unreachable!("Expected bivariance to be handled in relate_with_variance") + } } } diff --git a/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.rs b/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.rs index b3bc4d6fae25f..a18aade6f54e1 100644 --- a/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.rs +++ b/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.rs @@ -10,7 +10,7 @@ fn foo<'a, T>() where T: Proj<'a, Assoc = fn(::Assoc)>, (): Trait<>::Assoc>, - //~^ ERROR overflow evaluating the requirement `(): Trait<>::Assoc>` + //~^ ERROR the trait bound `(): Trait fn(>::Assoc))>` is not satisfied { } diff --git a/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.stderr b/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.stderr index 9d1c8c4a10d02..3ebb61b92c5ad 100644 --- a/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.stderr +++ b/tests/ui/assumptions_on_binders/placeholder-assumptions-issue-157840.stderr @@ -1,9 +1,15 @@ -error[E0275]: overflow evaluating the requirement `(): Trait<>::Assoc>` +error[E0277]: the trait bound `(): Trait fn(>::Assoc))>` is not satisfied --> $DIR/placeholder-assumptions-issue-157840.rs:12:9 | LL | (): Trait<>::Assoc>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait fn(>::Assoc))>` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/placeholder-assumptions-issue-157840.rs:3:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.rs b/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.rs new file mode 100644 index 0000000000000..f3050fe336eb1 --- /dev/null +++ b/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.rs @@ -0,0 +1,19 @@ +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +trait Super { + fn a(&self) { + let a: &dyn Sub = &(); + let b: &dyn Super fn(&'a ())> = a; + //~^ ERROR the trait bound `&dyn Sub: CoerceUnsized<&dyn Super fn(&'a ())>>` is not satisfied + } +} + +impl Super for () {} + +trait Sub: Super {} + +impl Sub for () {} + +fn main() { + let a: &dyn Sub = &(); +} diff --git a/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.stderr b/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.stderr new file mode 100644 index 0000000000000..afc1f56491503 --- /dev/null +++ b/tests/ui/assumptions_on_binders/principal-upcast-region-eq-issue-157859.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `&dyn Sub: CoerceUnsized<&dyn Super fn(&'a ())>>` is not satisfied + --> $DIR/principal-upcast-region-eq-issue-157859.rs:6:49 + | +LL | let b: &dyn Super fn(&'a ())> = a; + | ^ the nightly-only, unstable trait `Unsize fn(&'a ())>>` is not implemented for `dyn Sub` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information + = note: required for `&dyn Sub` to implement `CoerceUnsized<&dyn Super fn(&'a ())>>` + = note: required for the cast from `&dyn Sub` to `&dyn Super fn(&'a ())>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.rs b/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.rs new file mode 100644 index 0000000000000..d32cdd33e6e8f --- /dev/null +++ b/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.rs @@ -0,0 +1,23 @@ +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +trait Super { + type Assoc; + + fn a(&self) { + let a: &dyn Sub = &(); + let b: &dyn Super fn(&'a ())> = a; + //~^ ERROR the trait bound `&dyn Sub: CoerceUnsized<&dyn Super fn(&'a ())>>` is not satisfied + } +} + +impl Super for () { + type Assoc = fn(&'static ()); +} + +trait Sub: Super {} + +impl Sub for () {} + +fn main() { + let a: &dyn Sub = &(); +} diff --git a/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.stderr b/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.stderr new file mode 100644 index 0000000000000..fb55bab0ad20c --- /dev/null +++ b/tests/ui/assumptions_on_binders/trait-upcast-projection-region-eq.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `&dyn Sub: CoerceUnsized<&dyn Super fn(&'a ())>>` is not satisfied + --> $DIR/trait-upcast-projection-region-eq.rs:8:57 + | +LL | let b: &dyn Super fn(&'a ())> = a; + | ^ the nightly-only, unstable trait `Unsize fn(&'a ())>>` is not implemented for `dyn Sub` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information + = note: required for `&dyn Sub` to implement `CoerceUnsized<&dyn Super fn(&'a ())>>` + = note: required for the cast from `&dyn Sub` to `&dyn Super fn(&'a ())>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. From 754a3c846e454fc890c265d2556310c408322044 Mon Sep 17 00:00:00 2001 From: Joao Roberto Date: Sun, 11 Oct 2026 15:26:44 -0300 Subject: [PATCH 04/38] Test equality and variance across binder boundaries --- .../relating-region-equality.rs | 73 +++++++++++++++++++ .../relating-region-variance-constraints.rs | 41 +++++++++++ .../relating-region-variance-fail.abby.stderr | 51 +++++++++++++ ...elating-region-variance-fail.normal.stderr | 53 ++++++++++++++ .../relating-region-variance-fail.rs | 27 +++++++ .../relating-region-variance.rs | 28 +++++++ 6 files changed, 273 insertions(+) create mode 100644 tests/ui/assumptions_on_binders/relating-region-equality.rs create mode 100644 tests/ui/assumptions_on_binders/relating-region-variance-constraints.rs create mode 100644 tests/ui/assumptions_on_binders/relating-region-variance-fail.abby.stderr create mode 100644 tests/ui/assumptions_on_binders/relating-region-variance-fail.normal.stderr create mode 100644 tests/ui/assumptions_on_binders/relating-region-variance-fail.rs create mode 100644 tests/ui/assumptions_on_binders/relating-region-variance.rs diff --git a/tests/ui/assumptions_on_binders/relating-region-equality.rs b/tests/ui/assumptions_on_binders/relating-region-equality.rs new file mode 100644 index 0000000000000..8d70fd762bda0 --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-equality.rs @@ -0,0 +1,73 @@ +//@ check-pass +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +#![feature(test_binder_constraints, non_lifetime_binders)] +#![expect(incomplete_features)] + +trait Same {} +impl Same for T {} + +trait Trait<'a, 'b> { + type Assoc; +} + +struct Carrier(T); +trait Require<'a, 'b, 'c, T> {} + +impl<'a, 'b, 'c, T> Require<'a, 'b, 'c, T> for Carrier +where + T: Trait<'a, 'b>, + >::Assoc: 'c, +{ +} + +core::test_binder_constraints! { + impl<'a: 'b, 'b: 'a> { + forall<> { + predicates &'a (): Same<&'b ()> + } expect { + 'b: 'a, + 'a: 'b, + } + } +} + +core::test_binder_constraints! { + impl<'c, T> + where + for<'a, 'b> T: Trait<'a, 'b>, + { + forall<'a> + where + for<'b> >::Assoc: 'c, + { + forall<'b> { + predicates Carrier: Require<'a, 'b, 'c, T> + } expect { + for<'b> >::Assoc: 'c + } + } expect {} + } +} + +core::test_binder_constraints! { + impl<'c, T> + where + for<'a, 'b> T: Trait<'a, 'b>, + { + forall<'a> + where + for<'b> >::Assoc: 'c, + { + forall<'b> { + exists { + predicates Carrier: Require<'a, 'b, 'c, T> + } + } expect { + for<'b> >::Assoc: 'c + } + } expect {} + } +} + +fn main() {} diff --git a/tests/ui/assumptions_on_binders/relating-region-variance-constraints.rs b/tests/ui/assumptions_on_binders/relating-region-variance-constraints.rs new file mode 100644 index 0000000000000..59b9e00100f2c --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-variance-constraints.rs @@ -0,0 +1,41 @@ +//@ check-pass +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +#![feature(test_binder_constraints)] + +core::test_binder_constraints! { + impl<'a: 'b, 'b> { + forall<> { + 'a: 'b + } expect { + 'a: 'b + } + } +} + +core::test_binder_constraints! { + impl<'a, 'b: 'a> { + forall<> { + 'b: 'a + } expect { + 'b: 'a + } + } +} + +core::test_binder_constraints! { + impl<'a: 'b, 'b> { + forall<'c> where 'c: 'b { + forall<'d> where 'd: 'c { + 'd: 'b + } expect { + or { + 'c: 'b, + 'c: 'static, + } + } + } expect {} + } +} + +fn main() {} diff --git a/tests/ui/assumptions_on_binders/relating-region-variance-fail.abby.stderr b/tests/ui/assumptions_on_binders/relating-region-variance-fail.abby.stderr new file mode 100644 index 0000000000000..8b3c10d5c25fe --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-variance-fail.abby.stderr @@ -0,0 +1,51 @@ +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:8:5 + | +LL | fn covariant<'a: 'b, 'b>(x: &'b ()) -> &'a () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:13:5 + | +LL | fn contravariant<'a: 'b, 'b>(x: fn(&'a ())) -> fn(&'b ()) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:18:5 + | +LL | fn invariant<'a: 'b, 'b>(x: Cell<&'a ()>) -> Cell<&'b ()> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + = note: requirement occurs because of the type `Cell<&()>`, which makes the generic argument `&()` invariant + = note: the struct `Cell` is invariant over the parameter `T` + = help: see for more information about variance + +error[E0308]: mismatched types + --> $DIR/relating-region-variance-fail.rs:23:5 + | +LL | x + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'a> fn(&'a ())` + found fn pointer `fn(&())` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/assumptions_on_binders/relating-region-variance-fail.normal.stderr b/tests/ui/assumptions_on_binders/relating-region-variance-fail.normal.stderr new file mode 100644 index 0000000000000..cf675df2e9878 --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-variance-fail.normal.stderr @@ -0,0 +1,53 @@ +error[E0308]: mismatched types + --> $DIR/relating-region-variance-fail.rs:23:5 + | +LL | fn higher_ranked(x: fn(&'static ())) -> for<'a> fn(&'a ()) { + | ------------------ expected `for<'a> fn(&'a ())` because of return type +LL | x + | ^ one type is more general than the other + | + = note: expected fn pointer `for<'a> fn(&'a ())` + found fn pointer `fn(&'static ())` + +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:8:5 + | +LL | fn covariant<'a: 'b, 'b>(x: &'b ()) -> &'a () { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:13:5 + | +LL | fn contravariant<'a: 'b, 'b>(x: fn(&'a ())) -> fn(&'b ()) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: lifetime may not live long enough + --> $DIR/relating-region-variance-fail.rs:18:5 + | +LL | fn invariant<'a: 'b, 'b>(x: Cell<&'a ()>) -> Cell<&'b ()> { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + = note: requirement occurs because of the type `Cell<&()>`, which makes the generic argument `&()` invariant + = note: the struct `Cell` is invariant over the parameter `T` + = help: see for more information about variance + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/assumptions_on_binders/relating-region-variance-fail.rs b/tests/ui/assumptions_on_binders/relating-region-variance-fail.rs new file mode 100644 index 0000000000000..f348119aa0910 --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-variance-fail.rs @@ -0,0 +1,27 @@ +//@ revisions: normal abby +//@ compile-flags: -Znext-solver=globally +//@ [abby] compile-flags: -Zassumptions-on-binders + +use std::cell::Cell; + +fn covariant<'a: 'b, 'b>(x: &'b ()) -> &'a () { + x + //~^ ERROR lifetime may not live long enough +} + +fn contravariant<'a: 'b, 'b>(x: fn(&'a ())) -> fn(&'b ()) { + x + //~^ ERROR lifetime may not live long enough +} + +fn invariant<'a: 'b, 'b>(x: Cell<&'a ()>) -> Cell<&'b ()> { + x + //~^ ERROR lifetime may not live long enough +} + +fn higher_ranked(x: fn(&'static ())) -> for<'a> fn(&'a ()) { + x + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/assumptions_on_binders/relating-region-variance.rs b/tests/ui/assumptions_on_binders/relating-region-variance.rs new file mode 100644 index 0000000000000..4dcb0e807d760 --- /dev/null +++ b/tests/ui/assumptions_on_binders/relating-region-variance.rs @@ -0,0 +1,28 @@ +//@ revisions: normal abby +//@ check-pass +//@ compile-flags: -Znext-solver=globally +//@ [abby] compile-flags: -Zassumptions-on-binders + +use std::cell::Cell; + +fn covariant<'a: 'b, 'b>(x: &'a ()) -> &'b () { + x +} + +fn contravariant<'a: 'b, 'b>(x: fn(&'b ())) -> fn(&'a ()) { + x +} + +fn invariant<'a: 'b, 'b: 'a>(x: Cell<&'a ()>) -> Cell<&'b ()> { + x +} + +fn nested<'a: 'b, 'b>(x: for<'c> fn(&'b &'c ())) -> for<'c> fn(&'a &'c ()) { + x +} + +fn higher_ranked(x: for<'a> fn(&'a ())) -> fn(&'static ()) { + x +} + +fn main() {} From 7530fc140bf8f60d2829086f669aed0fcffaaa45 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Tue, 3 Nov 2026 22:19:23 -0800 Subject: [PATCH 05/38] Mark the compile unit for `-Zdebuginfo-for-profiling` With `-Zdebuginfo-for-profiling`, set `debugInfoForProfiling` on the `DICompileUnit`, as Clang does for `-fdebug-info-for-profiling` (`CGDebugInfo.cpp`). Before this change, the flag only added the discriminators pass, and the compile unit flag was always false. --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 1 + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 1 + compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 5 +++-- tests/codegen-llvm/debuginfo-for-profiling.rs | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 752cbc67d5637..585d0b20420a4 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1007,6 +1007,7 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>( kind, 0, tcx.sess.opts.unstable_opts.split_dwarf_inlining, + tcx.sess.opts.unstable_opts.debuginfo_for_profiling, debug_name_table_kind, ); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 9c2ab218a02ec..28e401bf79d97 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2259,6 +2259,7 @@ unsafe extern "C" { kind: DebugEmissionKind, DWOId: u64, SplitDebugInlining: bool, + DebugInfoForProfiling: bool, DebugNameTableKind: DebugNameTableKind, ) -> &'a DIDescriptor; diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index b1d3b2131812d..d723d8aa97167 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1007,13 +1007,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit( const char *Producer, size_t ProducerLen, bool isOptimized, const char *Flags, unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, LLVMRustDebugEmissionKind Kind, uint64_t DWOId, - bool SplitDebugInlining, LLVMRustDebugNameTableKind TableKind) { + bool SplitDebugInlining, bool DebugInfoForProfiling, + LLVMRustDebugNameTableKind TableKind) { auto *File = unwrapDI(FileRef); return wrap(unwrap(Builder)->createCompileUnit( Lang, File, StringRef(Producer, ProducerLen), isOptimized, Flags, RuntimeVer, StringRef(SplitName, SplitNameLen), fromRust(Kind), DWOId, - SplitDebugInlining, false, fromRust(TableKind))); + SplitDebugInlining, DebugInfoForProfiling, fromRust(TableKind))); } extern "C" LLVMMetadataRef diff --git a/tests/codegen-llvm/debuginfo-for-profiling.rs b/tests/codegen-llvm/debuginfo-for-profiling.rs index f7e401415ac7e..38d87d4b95712 100644 --- a/tests/codegen-llvm/debuginfo-for-profiling.rs +++ b/tests/codegen-llvm/debuginfo-for-profiling.rs @@ -1,6 +1,7 @@ // Verify that additional discriminators are emitted for profiling with `-Zdebuginfo-for-profiling`: // - 0 discriminators are emitted without the flag in the test below // - at least 1 discriminator is emitted with the flag in the test below +// - the compile unit has `debugInfoForProfiling: true` only with the flag // // //@ add-minicore @@ -8,6 +9,8 @@ //@ compile-flags: -Copt-level=2 -Cdebuginfo=line-tables-only //@ [DEBUGINFO] compile-flags: -Zdebuginfo-for-profiling // DEFAULT-NOT: discriminator +// DEFAULT-NOT: debugInfoForProfiling +// DEBUGINFO: !DICompileUnit({{.*}}debugInfoForProfiling: true // DEBUGINFO-COUNT-1: discriminator #![feature(no_core)] From 9c6e03219cad6df3f589bbafda1b456d99a93478 Mon Sep 17 00:00:00 2001 From: Toni Peter Date: Sat, 3 Oct 2026 11:17:15 +0200 Subject: [PATCH 06/38] Move `trivial_field_reads` from trait to impl trait fn --- compiler/rustc_ast/src/ast.rs | 9 ++++ .../src/attributes/rustc_internal.rs | 3 +- compiler/rustc_attr_parsing/src/generated.rs | 1 + .../src/deriving/clone.rs | 5 ++- .../src/deriving/debug.rs | 5 ++- compiler/rustc_passes/src/dead.rs | 11 +++-- library/core/src/clone.rs | 3 +- library/core/src/fmt/mod.rs | 3 +- tests/ui/derives/deriving-all-codegen.stdout | 42 +++++++++++++++++++ tests/ui/stats/macro-stats.stderr | 4 +- .../traits/const-traits/auxiliary/minicore.rs | 1 - 11 files changed, 71 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 20d60887e2d5f..cf11e09e676f9 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -3494,6 +3494,7 @@ pub enum GeneratedAttr { DocHidden, CoverageOff, RustcTestMarker(Symbol), + RustcTrivialFieldReads, } impl GeneratedAttr { @@ -3509,6 +3510,7 @@ impl GeneratedAttr { GeneratedAttr::RustcTestMarker(test_path) => { format!("#[rustc_test_marker = \"{test_path}\"]") } + GeneratedAttr::RustcTrivialFieldReads => "#[rustc_trivial_field_reads]".into(), } } pub fn value_span(&self) -> Option { @@ -3519,6 +3521,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, GeneratedAttr::RustcTestMarker(_) => None, + GeneratedAttr::RustcTrivialFieldReads => None, } } @@ -3530,6 +3533,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => false, GeneratedAttr::CoverageOff => false, GeneratedAttr::RustcTestMarker(_) => false, + GeneratedAttr::RustcTrivialFieldReads => false, } } @@ -3541,6 +3545,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => &[sym::doc], GeneratedAttr::CoverageOff => &[sym::coverage], GeneratedAttr::RustcTestMarker(_) => &[sym::rustc_test_marker], + GeneratedAttr::RustcTrivialFieldReads => &[sym::rustc_trivial_field_reads], } } @@ -3552,6 +3557,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, GeneratedAttr::RustcTestMarker(_) => None, + GeneratedAttr::RustcTrivialFieldReads => None, } } @@ -3563,6 +3569,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => false, GeneratedAttr::CoverageOff => false, GeneratedAttr::RustcTestMarker(_) => false, + GeneratedAttr::RustcTrivialFieldReads => false, } } pub fn value_str(&self) -> Option { @@ -3573,6 +3580,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, GeneratedAttr::RustcTestMarker(test_path) => Some(*test_path), + GeneratedAttr::RustcTrivialFieldReads => None, } } @@ -3584,6 +3592,7 @@ impl GeneratedAttr { GeneratedAttr::DocHidden => None, GeneratedAttr::CoverageOff => None, GeneratedAttr::RustcTestMarker(_) => None, + GeneratedAttr::RustcTrivialFieldReads => None, } } diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs index d9ce3552138c8..708d9aa7156e8 100644 --- a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs @@ -420,7 +420,8 @@ pub(crate) struct RustcTrivialFieldReadsParser; impl NoArgsAttributeParser for RustcTrivialFieldReadsParser { const PATH: &[Symbol] = &[sym::rustc_trivial_field_reads]; - const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Trait)]); + const ALLOWED_TARGETS: AllowedTargets<'_> = + AllowedTargets::AllowList(&[Allow(Target::Method(MethodKind::TraitImpl))]); const STABILITY: AttributeStability = unstable!(rustc_attrs); const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcTrivialFieldReads; } diff --git a/compiler/rustc_attr_parsing/src/generated.rs b/compiler/rustc_attr_parsing/src/generated.rs index 3f2e4eec226fb..599291fab7ac5 100644 --- a/compiler/rustc_attr_parsing/src/generated.rs +++ b/compiler/rustc_attr_parsing/src/generated.rs @@ -42,6 +42,7 @@ impl GeneratedAttrState { GeneratedAttr::RustcTestMarker(test_marker) => { AttributeKind::RustcTestMarker(test_marker) } + GeneratedAttr::RustcTrivialFieldReads => AttributeKind::RustcTrivialFieldReads, }; self.state.push(attr); } diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index c0ebb2f20fa86..8de5e0b6c4512 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -92,7 +92,10 @@ pub(crate) fn expand_deriving_clone( nonself_args: SmallVec::new(), has_other_selflike_arg: false, ret_ty: cx.ty_self(span), - attributes: thin_vec![cx.generated_attr(span, ast::GeneratedAttr::Inline)], + attributes: thin_vec![ + cx.generated_attr(span, ast::GeneratedAttr::Inline), + cx.generated_attr(span, ast::GeneratedAttr::RustcTrivialFieldReads) + ], fieldless_variants_strategy: FieldlessVariantsStrategy::Default, combine_substructure: substructure, }], diff --git a/compiler/rustc_builtin_macros/src/deriving/debug.rs b/compiler/rustc_builtin_macros/src/deriving/debug.rs index 6cdde8e303062..8408c437b3907 100644 --- a/compiler/rustc_builtin_macros/src/deriving/debug.rs +++ b/compiler/rustc_builtin_macros/src/deriving/debug.rs @@ -42,7 +42,10 @@ pub(crate) fn expand_deriving_debug( nonself_args: smallvec![(fmtr, sym::f)], has_other_selflike_arg: false, ret_ty: cx.ty_path(path_std!(cx, span, fmt::Result)), - attributes: thin_vec![cx.generated_attr(span, ast::GeneratedAttr::Inline)], + attributes: thin_vec![ + cx.generated_attr(span, ast::GeneratedAttr::Inline), + cx.generated_attr(span, ast::GeneratedAttr::RustcTrivialFieldReads) + ], fieldless_variants_strategy: FieldlessVariantsStrategy::Default, combine_substructure: combine_substructure(|cx, span, substr| show_substructure( cx, diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index ffa3a7443ecc4..dbd75f0322697 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -449,13 +449,12 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { /// for discussion). fn should_ignore_impl_item(&mut self, impl_item: &hir::ImplItem<'_>) -> bool { if let hir::ImplItemImplKind::Trait { .. } = impl_item.impl_kind - && let impl_of = self.tcx.local_parent(impl_item.owner_id.def_id) - && self.tcx.is_automatically_derived(impl_of.to_def_id()) - && let trait_ref = - self.tcx.impl_trait_ref(impl_of).instantiate_identity().skip_norm_wip() - && find_attr!(self.tcx, trait_ref.def_id, RustcTrivialFieldReads) + && find_attr!(self.tcx, impl_item.owner_id, RustcTrivialFieldReads) { - if let ty::Adt(adt_def, _) = trait_ref.self_ty().kind() + if let impl_of = self.tcx.local_parent(impl_item.owner_id.def_id) + && let trait_ref = + self.tcx.impl_trait_ref(impl_of).instantiate_identity().skip_norm_wip() + && let ty::Adt(adt_def, _) = trait_ref.self_ty().kind() && let Some(adt_def_id) = adt_def.did().as_local() { self.ignored_derived_traits.entry(adt_def_id).or_default().insert(trait_ref.def_id); diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 61528873a38c7..5e0c74f2a6324 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -189,7 +189,6 @@ mod uninit; #[stable(feature = "rust1", since = "1.0.0")] #[lang = "clone"] #[rustc_diagnostic_item = "Clone"] -#[rustc_trivial_field_reads] #[rustc_const_unstable(feature = "const_clone", issue = "142757")] pub const trait Clone: Sized { /// Returns a duplicate of the value. @@ -285,7 +284,7 @@ pub const unsafe trait TrivialClone: [const] Clone {} /// Derive macro generating an impl of the trait `Clone`. #[rustc_builtin_macro] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -#[allow_internal_unstable(core_intrinsics, derive_clone_copy_internals, trivial_clone)] +#[allow_internal_unstable(core_intrinsics, derive_clone_copy_internals, trivial_clone, rustc_attrs)] pub macro Clone($item:item) { /* compiler built-in */ } diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index e37df5f3c2446..967b5a7c62194 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -1049,7 +1049,6 @@ impl Display for Arguments<'_> { )] #[doc(alias = "{:?}")] #[rustc_diagnostic_item = "Debug"] -#[rustc_trivial_field_reads] pub trait Debug: PointeeSized { #[doc = include_str!("fmt_trait_method_doc.md")] /// @@ -1089,7 +1088,7 @@ pub(crate) mod macros { /// Derive macro generating an impl of the trait `Debug`. #[rustc_builtin_macro] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] - #[allow_internal_unstable(core_intrinsics, fmt_helpers_for_derive)] + #[allow_internal_unstable(core_intrinsics, fmt_helpers_for_derive, rustc_attrs)] pub macro Debug($item:item) { /* compiler built-in */ } diff --git a/tests/ui/derives/deriving-all-codegen.stdout b/tests/ui/derives/deriving-all-codegen.stdout index 6ae27f3338e98..356e81b9a483e 100644 --- a/tests/ui/derives/deriving-all-codegen.stdout +++ b/tests/ui/derives/deriving-all-codegen.stdout @@ -32,6 +32,7 @@ unsafe impl ::core::clone::TrivialClone for Empty { } #[automatically_derived] impl ::core::clone::Clone for Empty { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { *self } } #[automatically_derived] @@ -39,6 +40,7 @@ impl ::core::marker::Copy for Empty { } #[automatically_derived] impl ::core::fmt::Debug for Empty { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::write_str(f, "Empty") } @@ -90,6 +92,7 @@ unsafe impl ::core::clone::TrivialClone for Point { } #[automatically_derived] impl ::core::clone::Clone for Point { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -100,6 +103,7 @@ impl ::core::marker::Copy for Point { } #[automatically_derived] impl ::core::fmt::Debug for Point { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field2_finish(f, "Point x y", &self.x, &&self.y) @@ -174,6 +178,7 @@ unsafe impl ::core::clone::TrivialClone for PackedPoint { } #[automatically_derived] impl ::core::clone::Clone for PackedPoint { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -184,6 +189,7 @@ impl ::core::marker::Copy for PackedPoint { } #[automatically_derived] impl ::core::fmt::Debug for PackedPoint { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field2_finish(f, "PackedPoint x y", &{ self.x }, &&{ self.y }) @@ -252,6 +258,7 @@ unsafe impl ::core::clone::TrivialClone for TupleSingleField { } #[automatically_derived] impl ::core::clone::Clone for TupleSingleField { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -262,6 +269,7 @@ impl ::core::marker::Copy for TupleSingleField { } #[automatically_derived] impl ::core::fmt::Debug for TupleSingleField { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field1_finish(f, "TupleSingleField", &&self.0) @@ -327,6 +335,7 @@ unsafe impl ::core::clone::TrivialClone for SingleField { } #[automatically_derived] impl ::core::clone::Clone for SingleField { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -337,6 +346,7 @@ impl ::core::marker::Copy for SingleField { } #[automatically_derived] impl ::core::fmt::Debug for SingleField { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field1_finish(f, "SingleField foo", &&self.foo) @@ -411,6 +421,7 @@ unsafe impl ::core::clone::TrivialClone for Big { } #[automatically_derived] impl ::core::clone::Clone for Big { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -421,6 +432,7 @@ impl ::core::marker::Copy for Big { } #[automatically_derived] impl ::core::fmt::Debug for Big { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { let names: &'static _ = "Big b1 b2 b3 b4 b5 b6 b7 b8"; let values: &[&dyn ::core::fmt::Debug] = @@ -624,6 +636,7 @@ struct NonCopy(u32); #[automatically_derived] impl ::core::clone::Clone for NonCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { NonCopy(::core::clone::Clone::clone(&self.0)) } } @@ -634,6 +647,7 @@ struct PackedNonCopy(u32); #[automatically_derived] impl ::core::clone::Clone for PackedNonCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { PackedNonCopy(::core::clone::Clone::clone(&{ self.0 })) } @@ -645,6 +659,7 @@ struct ManualCopy(u32); #[automatically_derived] impl ::core::clone::Clone for ManualCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { ManualCopy(::core::clone::Clone::clone(&self.0)) } @@ -658,6 +673,7 @@ struct PackedManualCopy(u32); #[automatically_derived] impl ::core::clone::Clone for PackedManualCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { PackedManualCopy(::core::clone::Clone::clone(&{ self.0 })) } @@ -669,6 +685,7 @@ struct Unsized([u32]); #[automatically_derived] impl ::core::fmt::Debug for Unsized { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field1_finish(f, "Unsized", &&self.0) @@ -732,6 +749,7 @@ struct Generic { impl ::core::clone::Clone for Generic where T::A: ::core::clone::Clone { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { Generic { t: ::core::clone::Clone::clone(&self.t), @@ -748,6 +766,7 @@ impl impl ::core::fmt::Debug for Generic where T::A: ::core::fmt::Debug { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field3_finish(f, "Generic t ta u", &self.t, &self.ta, &&self.u) @@ -851,6 +870,7 @@ impl where T::A: ::core::clone::Clone + ::core::marker::Copy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { PackedGeneric(::core::clone::Clone::clone(&{ self.0 }), ::core::clone::Clone::clone(&{ self.1 }), @@ -868,6 +888,7 @@ impl where T::A: ::core::fmt::Debug + ::core::marker::Copy { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_struct_field3_finish(f, "PackedGeneric", &{ self.0 }, &{ self.1 }, &&{ self.2 }) @@ -974,6 +995,7 @@ unsafe impl ::core::clone::TrivialClone for Enum0 { } #[automatically_derived] impl ::core::clone::Clone for Enum0 { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { *self } } #[automatically_derived] @@ -981,6 +1003,7 @@ impl ::core::marker::Copy for Enum0 { } #[automatically_derived] impl ::core::fmt::Debug for Enum0 { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match *self {} } @@ -1024,6 +1047,7 @@ enum Enum1 { #[automatically_derived] impl ::core::clone::Clone for Enum1 { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { match self { Self::Single { x: __self_0 } => @@ -1034,6 +1058,7 @@ impl ::core::clone::Clone for Enum1 { #[automatically_derived] impl ::core::fmt::Debug for Enum1 { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { Self::Single { x: __self_0 } => @@ -1101,11 +1126,13 @@ enum Fieldless1 { #[automatically_derived] impl ::core::clone::Clone for Fieldless1 { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { Fieldless1::A } } #[automatically_derived] impl ::core::fmt::Debug for Fieldless1 { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::write_str(f, "A") } @@ -1159,6 +1186,7 @@ unsafe impl ::core::clone::TrivialClone for Fieldless { } #[automatically_derived] impl ::core::clone::Clone for Fieldless { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { *self } } #[automatically_derived] @@ -1166,6 +1194,7 @@ impl ::core::marker::Copy for Fieldless { } #[automatically_derived] impl ::core::fmt::Debug for Fieldless { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::write_str(f, match self { @@ -1222,6 +1251,7 @@ enum Fieldless0 { A, BBB, CC, } #[automatically_derived] impl ::core::fmt::Debug for Fieldless0 { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::write_str(f, match self { @@ -1248,6 +1278,7 @@ enum Fieldless10 { #[automatically_derived] impl ::core::fmt::Debug for Fieldless10 { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::fmt::Formatter::debug_c_like_enum_write_str(f, "AAAAA BBBB CC DDDDDDDD E FFFFFFFFFFFFF GGGGGG Hatsune IIIIIII JJJJJJJJJ", @@ -1284,6 +1315,7 @@ unsafe impl ::core::clone::TrivialClone for Mixed { } #[automatically_derived] impl ::core::clone::Clone for Mixed { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; let _: ::core::clone::AssertParamIsClone>; @@ -1296,6 +1328,7 @@ impl ::core::marker::Copy for Mixed { } #[automatically_derived] impl ::core::fmt::Debug for Mixed { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { Self::P => ::core::fmt::Formatter::write_str(f, "P"), @@ -1462,6 +1495,7 @@ enum Fielded { X(u32), Y(bool), Z(Option), } #[automatically_derived] impl ::core::clone::Clone for Fielded { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { match self { Self::X(__self_0) => @@ -1476,6 +1510,7 @@ impl ::core::clone::Clone for Fielded { #[automatically_derived] impl ::core::fmt::Debug for Fielded { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { Self::X(__self_0) => @@ -1565,6 +1600,7 @@ enum EnumGeneric { One(T), Two(U), } impl ::core::clone::Clone for EnumGeneric { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { match self { Self::One(__self_0) => @@ -1582,6 +1618,7 @@ impl ::core::marker::Copy impl ::core::fmt::Debug for EnumGeneric { #[inline] + #[rustc_trivial_field_reads] fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { Self::One(__self_0) => @@ -1707,6 +1744,7 @@ unsafe impl ::core::clone::TrivialClone for Union { } #[automatically_derived] impl ::core::clone::Clone for Union { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsCopy; *self @@ -1724,6 +1762,7 @@ unsafe impl ::core::clone::TrivialClone for FooCopyClone { } #[automatically_derived] impl ::core::clone::Clone for FooCopyClone { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -1737,6 +1776,7 @@ unsafe impl ::core::clone::TrivialClone for FooCloneCopy { } #[automatically_derived] impl ::core::clone::Clone for FooCloneCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -1752,6 +1792,7 @@ unsafe impl ::core::clone::TrivialClone for FooCopyAndClone { } #[automatically_derived] impl ::core::clone::Clone for FooCopyAndClone { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { let _: ::core::clone::AssertParamIsClone; *self @@ -1769,6 +1810,7 @@ impl ::core::marker::Copy for FooCloneAndCopy { } #[automatically_derived] impl ::core::clone::Clone for FooCloneAndCopy { #[inline] + #[rustc_trivial_field_reads] fn clone(&self) -> Self { FooCloneAndCopy(::core::clone::Clone::clone(&self.0)) } diff --git a/tests/ui/stats/macro-stats.stderr b/tests/ui/stats/macro-stats.stderr index 4806b3ad82c90..09b72798039b7 100644 --- a/tests/ui/stats/macro-stats.stderr +++ b/tests/ui/stats/macro-stats.stderr @@ -2,14 +2,14 @@ macro-stats ==================================================================== macro-stats MACRO EXPANSION STATS: macro_stats macro-stats Macro Name Uses Lines Avg Lines Bytes Avg Bytes macro-stats ----------------------------------------------------------------------------------- -macro-stats #[derive(Clone)] 8 59 7.4 1_889 236.1 +macro-stats #[derive(Clone)] 8 67 8.4 2_153 269.1 macro-stats #[derive(Hash)] 2 15 7.5 534 267.0 macro-stats q! 1 26 26.0 519 519.0 macro-stats #[derive(Ord)] 1 14 14.0 504 504.0 macro-stats #[derive(Default)] 2 14 7.0 405 202.5 macro-stats #[derive(Eq)] 1 10 10.0 311 311.0 +macro-stats #[derive(Debug)] 1 8 8.0 300 300.0 macro-stats #[derive(PartialEq)] 1 7 7.0 267 267.0 -macro-stats #[derive(Debug)] 1 7 7.0 267 267.0 macro-stats #[derive(PartialOrd)] 1 7 7.0 255 255.0 macro-stats #[derive(Copy)] 1 1 1.0 60 60.0 macro-stats p! 1 3 3.0 32 32.0 diff --git a/tests/ui/traits/const-traits/auxiliary/minicore.rs b/tests/ui/traits/const-traits/auxiliary/minicore.rs index e1d1135e6d4ec..a357a727ef9b1 100644 --- a/tests/ui/traits/const-traits/auxiliary/minicore.rs +++ b/tests/ui/traits/const-traits/auxiliary/minicore.rs @@ -445,7 +445,6 @@ impl Deref for Ref<'_, T> { } #[lang = "clone"] -#[rustc_trivial_field_reads] pub const trait Clone: Sized { fn clone(&self) -> Self; fn clone_from(&mut self, source: &Self) From 2ee054c919ecf499e5a53c4d4f3dbadf328510ee Mon Sep 17 00:00:00 2001 From: waffle Date: Fri, 6 Nov 2026 20:50:06 +0100 Subject: [PATCH 07/38] stop using gce in a test --- .../ui/repeat-expr/zero_assoc_diverging_consts.rs | 14 +++++++------- .../repeat-expr/zero_assoc_diverging_consts.stderr | 9 ++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/ui/repeat-expr/zero_assoc_diverging_consts.rs b/tests/ui/repeat-expr/zero_assoc_diverging_consts.rs index fc57de8ed43bc..15608843a9bcb 100644 --- a/tests/ui/repeat-expr/zero_assoc_diverging_consts.rs +++ b/tests/ui/repeat-expr/zero_assoc_diverging_consts.rs @@ -6,21 +6,21 @@ // Issue: // //@ build-fail -#![feature(generic_const_exprs)] +#![feature(gca_min_const_items)] + +use std::gca; trait Trait { + #[rustc_always_gca] const ZERO: usize; } impl Trait for () { - const ZERO: usize = 0; + const ZERO: usize = gca!(0); } -fn ex_nihilo() -> u32 -where - [(); T::ZERO]:, -{ - [const { panic!() } as !; T::ZERO]; +fn ex_nihilo() -> u32 { + [const { panic!() } as !; gca!(T::ZERO)]; //~^ error: evaluation panicked: explicit panic } diff --git a/tests/ui/repeat-expr/zero_assoc_diverging_consts.stderr b/tests/ui/repeat-expr/zero_assoc_diverging_consts.stderr index 56e17fd03b3dc..38dc4dc533713 100644 --- a/tests/ui/repeat-expr/zero_assoc_diverging_consts.stderr +++ b/tests/ui/repeat-expr/zero_assoc_diverging_consts.stderr @@ -1,15 +1,14 @@ error[E0080]: evaluation panicked: explicit panic --> $DIR/zero_assoc_diverging_consts.rs:23:14 | -LL | fn ex_nihilo() -> u32 -... -LL | [const { panic!() } as !; T::ZERO]; - | ^^^^^^^^ evaluation of `ex_nihilo::<()>::{constant#1}` failed here +LL | fn ex_nihilo() -> u32 { +LL | [const { panic!() } as !; gca!(T::ZERO)]; + | ^^^^^^^^ evaluation of `ex_nihilo::<()>::{constant#0}` failed here note: erroneous constant encountered --> $DIR/zero_assoc_diverging_consts.rs:23:6 | -LL | [const { panic!() } as !; T::ZERO]; +LL | [const { panic!() } as !; gca!(T::ZERO)]; | ^^^^^^^^^^^^^^^^^^ note: the above error was encountered while instantiating `fn ex_nihilo::<()>` From 44a7763b6610270a7523d5227a113f729d1fefa8 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 6 Nov 2026 23:27:30 +0000 Subject: [PATCH 08/38] Upgrade bundled musl to 1.2.6 This also includes these 3 patches for musl CVEs: - [CVE-2026-6042]: denial of service in iconv - [CVE-2026-6042]: qsort stack buffer overflow - [CVE-2026-107891]: integer overflow in regcomp The first two were already being applied to our build of musl 1.2.5, the third one is new. [CVE-2026-6042]: https://www.openwall.com/lists/musl/2026/04/03/2 [CVE-2026-40200]: https://www.openwall.com/lists/musl/2026/04/10/3 [CVE-2026-107891]: https://www.openwall.com/lists/musl/2026/10/21/1 --- .../targets/aarch64_be_unknown_linux_musl.rs | 2 +- .../targets/aarch64_unknown_linux_musl.rs | 2 +- .../targets/arm_unknown_linux_musleabi.rs | 2 +- .../targets/arm_unknown_linux_musleabihf.rs | 2 +- .../targets/armv5te_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabihf.rs | 2 +- .../targets/hexagon_unknown_linux_musl.rs | 2 +- .../spec/targets/i686_unknown_linux_musl.rs | 2 +- .../targets/loongarch64_unknown_linux_musl.rs | 2 +- .../spec/targets/mips64_openwrt_linux_musl.rs | 2 +- .../targets/mips64_unknown_linux_muslabi64.rs | 2 +- .../mips64el_unknown_linux_muslabi64.rs | 2 +- .../spec/targets/mips_unknown_linux_musl.rs | 2 +- .../spec/targets/mipsel_unknown_linux_musl.rs | 2 +- .../targets/powerpc64_unknown_linux_musl.rs | 2 +- .../targets/powerpc64le_unknown_linux_musl.rs | 2 +- .../targets/powerpc_unknown_linux_musl.rs | 2 +- .../targets/riscv32gc_unknown_linux_musl.rs | 2 +- .../targets/riscv64gc_unknown_linux_musl.rs | 2 +- .../spec/targets/s390x_unknown_linux_musl.rs | 2 +- .../thumbv7neon_unknown_linux_musleabihf.rs | 2 +- .../targets/x86_64_unikraft_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_linux_musl.rs | 2 +- src/ci/docker/README.md | 18 +- .../dist-arm-linux-musl/Dockerfile | 2 - .../dist-i586-gnu-i586-i686-musl/Dockerfile | 1 + .../i586-linux-gnu.defconfig | 2 +- .../dist-loongarch64-linux/Dockerfile | 4 +- .../dist-loongarch64-musl/Dockerfile | 6 +- .../loongarch64-unknown-linux-musl.defconfig | 2 +- .../dist-powerpc64-linux-musl/Dockerfile | 4 +- .../powerpc64-unknown-linux-musl.defconfig | 2 +- .../dist-powerpc64le-linux-musl/Dockerfile | 4 +- .../powerpc64le-unknown-linux-musl.defconfig | 2 +- .../dist-riscv64-linux-musl/Dockerfile | 4 +- .../riscv64-unknown-linux-musl.defconfig | 2 +- .../host-x86_64/dist-various-1/Dockerfile | 1 + .../host-x86_64/dist-various-2/Dockerfile | 1 + .../host-x86_64/dist-x86_64-musl/Dockerfile | 2 - .../host-x86_64/test-various/Dockerfile | 2 - src/ci/docker/scripts/crosstool-ng-git.sh | 30 ---- src/ci/docker/scripts/crosstool-ng.sh | 10 +- .../docker/scripts/musl-cve-2026-107891.diff | 168 ++++++++++++++++++ src/ci/docker/scripts/musl-toolchain.sh | 17 +- src/ci/docker/scripts/musl.sh | 48 +---- src/doc/rustc/src/platform-support.md | 52 +++--- .../src/platform-support/loongarch-linux.md | 2 +- .../riscv64gc-unknown-linux-musl.md | 2 +- .../s390x-unknown-linux-musl.md | 2 +- 50 files changed, 273 insertions(+), 165 deletions(-) delete mode 100644 src/ci/docker/scripts/crosstool-ng-git.sh create mode 100644 src/ci/docker/scripts/musl-cve-2026-107891.diff diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs index d3bf641a747fa..5e9d64fc2040c 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()), + description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 6ba5112342c3e..439baa41fb1f5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux with musl 1.2.5".into()), + description: Some("ARM64 Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 5dce420428768..07e24361387ff 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.5".into()), + description: Some("Armv6 Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 5b1d1e2a5a48e..005123340a2fe 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.5, hardfloat".into()), + description: Some("Armv6 Linux with musl 1.2.6, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index b5a31a9821e2b..d5dfcc0c9af7f 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv5TE Linux with musl 1.2.5".into()), + description: Some("Armv5TE Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 66e1eb1115e50..ef49c26587d95 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.5".into()), + description: Some("Armv7-A Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 39c45161082ab..462945c6a0898 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.5, hardfloat".into()), + description: Some("Armv7-A Linux with musl 1.2.6, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index 92c477f53f8f3..37322eaae6d08 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("Hexagon Linux with musl 1.2.5".into()), + description: Some("Hexagon Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index 212c2b8db56da..28d57cf4a0e3e 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -33,7 +33,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("32-bit Linux with musl 1.2.5".into()), + description: Some("32-bit Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index 4030152071303..73ce78392d472 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.5".into()), + description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index ec91dbeb86ef9..d6cb6bb7003f1 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 for OpenWrt Linux musl 1.2.5".into()), + description: Some("MIPS64 for OpenWrt Linux musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index c83d371692e69..1dd1c9deeab3d 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 5685e84f140a4..32ba090486e2b 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index 7e3bebc60e9d3..fc9dfa35ade71 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS Linux with musl 1.2.5".into()), + description: Some("MIPS Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index c94f2fd87e589..c0151fd8e4fcf 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS (little endian) Linux with musl 1.2.5".into()), + description: Some("MIPS (little endian) Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 474d20d2f0544..9464665774db8 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.5".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index 0060a41d79d08..77cb5cdb147ff 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.5, Little Endian".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.6, Little Endian".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index 7e494e065a048..eaef449e4fd19 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("PowerPC Linux with musl 1.2.5".into()), + description: Some("PowerPC Linux with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index e5618ea6b20da..4f3942108f39f 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 5.4, musl 1.2.5)".into()), + description: Some("RISC-V Linux (kernel 5.4, musl 1.2.6)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 088d4821042d8..883b6839c5e55 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 4.20, musl 1.2.5)".into()), + description: Some("RISC-V Linux (kernel 4.20, musl 1.2.6)".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 5ff9f025ba1d9..422d80d8b1453 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("S390x Linux (kernel 3.2, musl 1.2.5)".into()), + description: Some("S390x Linux (kernel 3.2, musl 1.2.6)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index dc4f8987d5d24..1ae4daa6c9227 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.5".into()), + description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index c5421f3e6b748..7e57145705ed9 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Unikraft with musl 1.2.5".into()), + description: Some("64-bit Unikraft with musl 1.2.6".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index a664f22479913..bce0f174cde3d 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Linux with musl 1.2.5".into()), + description: Some("64-bit Linux with musl 1.2.6".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 167121a5a000c..d71c65f43e703 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -263,7 +263,7 @@ For targets: `loongarch64-unknown-linux-gnu` - Operating System > Linux kernel version = 5.19.16 - Binary utilities > Version of binutils = 2.46.1 - C-library > glibc version = 2.36 -- C compiler > gcc version = 16.1.0 +- C compiler > gcc version = 16.2.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `loongarch64-unknown-linux-musl.defconfig` @@ -278,8 +278,8 @@ For targets: `loongarch64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 5.19.16 - Binary utilities > Version of binutils = 2.46.1 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 16.1.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 16.2.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `mips-linux-gnu.defconfig` @@ -408,8 +408,8 @@ For targets: `powerpc64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.19 - Binary utilities > Version of binutils = 2.42 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 14.2.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `powerpc64le-unknown-linux-gnu.defconfig` @@ -426,7 +426,7 @@ For targets: `powerpc64le-unknown-linux-gnu` - Operating System > Linux kernel version = 3.10 - Binary utilities > Version of binutils = 2.42 - C-library > glibc version = 2.17 -- C compiler > gcc version = 14.2.0 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `powerpc64le-unknown-linux-musl.defconfig` @@ -442,8 +442,8 @@ For targets: `powerpc64le-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.19 - Binary utilities > Version of binutils = 2.42 -- C-library > musl version = 1.2.5 -- C compiler > gcc version = 14.2.0 +- C-library > musl version = 1.2.6 +- C compiler > gcc version = 14.4.0 - C compiler > C++ = ENABLE -- to cross compile LLVM ### `riscv64-unknown-linux-gnu.defconfig` @@ -474,7 +474,7 @@ For targets: `riscv64-unknown-linux-musl` - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.20.17 - Binary utilities > Version of binutils = 2.40 -- C-library > musl version = 1.2.5 +- C-library > musl version = 1.2.6 - C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM diff --git a/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile index a34b97d9b3b7a..99667d68ab7ad 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-arm-linux-musl/Dockerfile @@ -6,8 +6,6 @@ RUN sh /scripts/cross-apt-packages.sh WORKDIR /build COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well RUN CFLAGS="-Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ CXXFLAGS="-Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index 00506601c4319..682664136dc1d 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -42,6 +42,7 @@ WORKDIR /build/ COPY scripts/musl.sh /build/ COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \ CXX=g++ CXXFLAGS="-m32 -Wa,-mrelax-relocations=no" \ bash musl.sh i686 --target=i686 && \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig index ac9c40f77873e..78544ea69e89f 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig @@ -15,4 +15,4 @@ CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-compressed-debug-sections=none" CT_GLIBC_V_2_17=y CT_GCC_V_8=y CT_CC_LANG_CXX=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile index 06dc3db645205..a94b9dbc062d3 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile @@ -12,9 +12,9 @@ RUN apt-get update && \ llvm-23 \ lld-23 -COPY scripts/crosstool-ng-git.sh /scripts/ +COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng-git.sh +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile index 65406baddc70a..203d93ce93a5b 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/Dockerfile @@ -12,9 +12,11 @@ RUN apt-get update && \ llvm-23 \ lld-23 -COPY scripts/crosstool-ng-git.sh /scripts/ +COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng-git.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig index 07fed33600f29..4ca94af4d6a1e 100644 --- a/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig @@ -14,7 +14,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_5_19=y CT_LINUX_VERSION="5.19.16" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_46=y CT_GCC_V_16=y CT_CC_GCC_ENABLE_DEFAULT_PIE=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile index bfbad2c70de61..befe0be6a9d34 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig index 6a9e38a8902a8..7a83ad57e5e61 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux-musl/powerpc64-unknown-linux-musl.defconfig @@ -12,7 +12,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_19=y CT_LINUX_VERSION="4.19.325" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_42=y CT_GCC_V_14=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile index 615f41028dbc0..69b86ee27860d 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig index c141dbb00eaca..c3aab5574a6de 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux-musl/powerpc64le-unknown-linux-musl.defconfig @@ -13,7 +13,7 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_19=y CT_LINUX_VERSION="4.19.325" CT_LIBC_MUSL=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_BINUTILS_V_2_42=y CT_GCC_V_14=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile index bb7537fc7d279..a497762acb9b7 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/Dockerfile @@ -5,7 +5,9 @@ RUN sh /scripts/cross-apt-packages.sh COPY scripts/crosstool-ng.sh /scripts/ COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/ -RUN sh /scripts/crosstool-ng.sh +COPY scripts/musl-cve-2026-40200.diff /scripts/ +COPY scripts/musl-cve-2026-107891.diff /scripts/ +RUN sh /scripts/crosstool-ng.sh musl COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig index 435a2bea80d36..9dab511ab1e6d 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig @@ -11,6 +11,6 @@ CT_KERNEL_LINUX=y CT_LINUX_V_4_20=y CT_LIBC_MUSL=y CT_BINUTILS_V_2_40=y -CT_MUSL_V_1_2_5=y +CT_MUSL_V_1_2_6=y CT_GCC_V_8=y CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index 1d06128948aae..b9a4d1b46a34d 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -67,6 +67,7 @@ ENV STAGING_DIR=/tmp COPY scripts/musl.sh /build COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN env \ CC=arm-linux-gnueabi-gcc CFLAGS="-march=armv5te -marm -mfloat-abi=soft" \ CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv5te -marm -mfloat-abi=soft" \ diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index 6be97366544cf..077213154310f 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -66,6 +66,7 @@ WORKDIR /build COPY scripts/musl.sh /build COPY scripts/musl-cve-2026-6042.diff /build/ COPY scripts/musl-cve-2026-40200.diff /build/ +COPY scripts/musl-cve-2026-107891.diff /build/ RUN env \ CC=arm-linux-gnueabi-gcc-9 CFLAGS="-march=armv7-a" \ CXX=arm-linux-gnueabi-g++-9 CXXFLAGS="-march=armv7-a" \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile index aaca6b2bb9afa..68f914a81552d 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile @@ -25,8 +25,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /build/ COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ CXXFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 3136e38da5a43..dc6ba8e592dcd 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -35,8 +35,6 @@ ENV PATH="/node/bin:${PATH}" WORKDIR /build/ COPY scripts/musl-toolchain.sh /build/ -COPY scripts/musl-cve-2026-6042.diff /build/ -COPY scripts/musl-cve-2026-40200.diff /build/ RUN bash musl-toolchain.sh x86_64 && rm -rf build WORKDIR / diff --git a/src/ci/docker/scripts/crosstool-ng-git.sh b/src/ci/docker/scripts/crosstool-ng-git.sh deleted file mode 100644 index faccd7dc9bbf5..0000000000000 --- a/src/ci/docker/scripts/crosstool-ng-git.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -ex - -# ignore-tidy-file-linelength - -URL=https://github.com/crosstool-ng/crosstool-ng -REV=27cd8380e72bb1cf3e7cf4a06a9cdbdc57df6f72 - -mkdir crosstool-ng -cd crosstool-ng -git init -git fetch --depth=1 ${URL} ${REV} -git reset --hard FETCH_HEAD - -# https://github.com/crosstool-ng/crosstool-ng/issues/1832 -# "download source of zlib is invalid now" -sed -e "s|zlib.net/'|zlib.net/fossils'|" -i packages/zlib/package.desc - -# FIXME(#158718): patch crosstools-ng known-good kernel artifact SHA256 -# checksums to the artifacts we mirror in `ci-mirrors`. -# See -# . -patch -p1 . patch -p1 = 1.2.7. + cp /scripts/musl-cve-2026-40200.diff packages/musl/1.2.6/0002-cve-2026-40200.patch + cp /scripts/musl-cve-2026-107891.diff packages/musl/1.2.6/0003-cve-2026-107891.patch +fi + ./bootstrap ./configure --prefix=/usr/local make -j$(nproc) diff --git a/src/ci/docker/scripts/musl-cve-2026-107891.diff b/src/ci/docker/scripts/musl-cve-2026-107891.diff new file mode 100644 index 0000000000000..2abae19db458c --- /dev/null +++ b/src/ci/docker/scripts/musl-cve-2026-107891.diff @@ -0,0 +1,168 @@ +>From 7813e9119eb5fe681b6750b8a033a0490bca0941 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Thu, 23 Apr 2026 21:22:18 +0000 +Subject: [PATCH] regex: avoid int overflow in regcomp + +regcomp has many int arith ops that may overflow. before tre_expand_ast +int values are limited by 2x the input length n, e.g.: + + input ERE int field max value + aaaaaaaaaaaa... position n + ()()()()()()... submatch_id n/2+1 + ()||||||||||... num_tags 2n-3 + +so overflow before expand requires large n (and a lot of memory). later +some values can become big due to repetitions: + + input ERE int field that overflows + (((a{255}){255}){255}){255} position + ((a|b*){255,}){255,} num_transitions + +num_transitions and memory use can be big without {k,} repetitions too: + + input ERE what max value + (a|a|a|a...|a)* num_transitions n^2/4 + (()|a|a|...|a)* sum tnfa tags > n^3/16 - n^2 + +so memory can run out quickly as n grows (with 31bit va space 1700 long +input is enough even without {k,}) about half is tnfa and half is ast +firstpos/lastpos data. but overflow can happen before allocations fail. + +fix early overflow by limiting n. the stack usage is in [n,11n] without +repetitions, usually 7n, so the stack limit got adjusted too. the limit +is such that almost all inputs that worked before still work. + +overflows during and after expand are fixed by explicit checks via a +check_add helper and xcalloc instead of xmalloc. +--- + src/regex/regcomp.c | 41 +++++++++++++++++++++++++++++++++++------ + 1 file changed, 35 insertions(+), 6 deletions(-) + +diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c +index b4b81968..a7115b12 100644 +--- a/src/regex/regcomp.c ++++ b/src/regex/regcomp.c +@@ -1680,6 +1680,12 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, + AST to TNFA compilation routines. + */ + ++/* check if a+b overflows for a,b in [0,INT_MAX] */ ++static int check_add(unsigned a, unsigned b) ++{ ++ return a + b > INT_MAX; ++} ++ + typedef enum { + COPY_RECURSE, + COPY_SET_RESULT_PTR +@@ -1731,6 +1737,8 @@ tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + /* XXX - e.g. [ab] has only one position but two + nodes, so we are creating holes in the state space + here. Not fatal, just wastes memory. */ ++ if (check_add(pos, *pos_add)) ++ return REG_ESPACE; + pos += *pos_add; + num_copied++; + } +@@ -1826,6 +1834,8 @@ tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + break; + } + } ++ if (check_add(*pos_add, num_copied)) ++ return REG_ESPACE; + *pos_add += num_copied; + return status; + } +@@ -1870,6 +1880,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + tre_literal_t *lit= node->obj; + if (!IS_SPECIAL(lit) || IS_BACKREF(lit)) + { ++ if (check_add(lit->position, pos_add)) ++ return REG_ESPACE; + lit->position += pos_add; + if (lit->position > max_pos) + max_pos = lit->position; +@@ -1998,6 +2010,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + } + + iter_depth--; ++ if (check_add(pos_add_total, pos_add - pos_add_last)) ++ return REG_ESPACE; + pos_add_total += pos_add - pos_add_last; + if (iter_depth == 0) + pos_add = pos_add_total; +@@ -2010,6 +2024,8 @@ tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, + } + } + ++ if (check_add(*position, pos_add_total)) ++ return REG_ESPACE; + *position += pos_add_total; + + /* `max_pos' should never be larger than `*position' if the above +@@ -2711,9 +2727,19 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + /* Parse context. */ + tre_parse_ctx_t parse_ctx; + ++ /* Limits: before tre_expand_ast, int values like position, subid or ++ * num_tags are bounded by 2x input length, used stack entries are ++ * bounded by 16x input length. input length is checked upfront to ++ * avoid overflows before expand. later, values that can grow big are ++ * bounds checked via check_add and xcalloc. */ ++ const int input_limit = 1024000; ++ const int stack_limit = 8*input_limit; ++ if (strnlen(regex, input_limit) >= input_limit) ++ return REG_ESPACE; ++ + /* Allocate a stack used throughout the compilation process for various + purposes. */ +- stack = tre_stack_new(512, 1024000, 128); ++ stack = tre_stack_new(512, stack_limit, 128); + if (!stack) + return REG_ESPACE; + /* Allocate a fast memory allocator. */ +@@ -2801,9 +2827,12 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + for example "a*" or "ab*". Figure out a simple way to detect + this possibility. */ + tmp_ast_l = tree; +- tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++); ++ tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position); + if (tmp_ast_r == NULL) + ERROR_EXIT(REG_ESPACE); ++ if (check_add(parse_ctx.position, 1)) ++ ERROR_EXIT(REG_ESPACE); ++ parse_ctx.position++; + + tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r); + if (tree == NULL) +@@ -2813,22 +2842,22 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags) + if (errcode != REG_OK) + ERROR_EXIT(errcode); + +- counts = xmalloc(sizeof(int) * parse_ctx.position); ++ counts = xcalloc(sizeof(int), parse_ctx.position); + if (counts == NULL) + ERROR_EXIT(REG_ESPACE); + +- offs = xmalloc(sizeof(int) * parse_ctx.position); ++ offs = xcalloc(sizeof(int), parse_ctx.position); + if (offs == NULL) + ERROR_EXIT(REG_ESPACE); + +- for (i = 0; i < parse_ctx.position; i++) +- counts[i] = 0; + tre_ast_to_tnfa(tree, NULL, counts, NULL); + + add = 0; + for (i = 0; i < parse_ctx.position; i++) + { + offs[i] = add; ++ if (check_add(add, counts[i] + 1)) ++ ERROR_EXIT(REG_ESPACE); + add += counts[i] + 1; + counts[i] = 0; + } +-- +2.21.0 + + diff --git a/src/ci/docker/scripts/musl-toolchain.sh b/src/ci/docker/scripts/musl-toolchain.sh index 9e527e269360b..a9802211847e5 100644 --- a/src/ci/docker/scripts/musl-toolchain.sh +++ b/src/ci/docker/scripts/musl-toolchain.sh @@ -4,7 +4,7 @@ # # Versions of the toolchain components are configurable in `musl-cross-make/Makefile` and # musl unlike GLIBC is forward compatible so upgrading it shouldn't break old distributions. -# Right now we have: Binutils 2.31.1, GCC 9.2.0, musl 1.2.5. +# Right now we have: Binutils 2.44, GCC 9.4.0, musl 1.2.6. # ignore-tidy-file-linelength @@ -45,17 +45,12 @@ export CFLAGS="-fPIC -g1 $CFLAGS" git clone https://github.com/richfelker/musl-cross-make # -b v0.9.9 cd musl-cross-make -# A version that includes support for building musl 1.2.5 -git checkout 3635262e4524c991552789af6f36211a335a77b3 +# A version that includes musl 1.2.6 and patches for CVE-2026-6042, +# CVE-2026-40200, and CVE-2026-107891. +git checkout 5e8042e63de29f8473fc3b0b831a587ba284e1a8 -# Patch CVE-2026-6042: https://www.openwall.com/lists/oss-security/2026/04/09/19 -# Patch CVE-2026-40200: https://www.openwall.com/lists/musl/2026/04/10/3 -# These should be removed when musl-cross-make adds them, or we upgrade to musl >= 1.2.7. -cp /build/musl-cve-2026-6042.diff ./patches/musl-1.2.5/0003-cve-2026-6042.diff -cp /build/musl-cve-2026-40200.diff ./patches/musl-1.2.5/0004-cve-2026-40200.diff - -hide_output make -j$(nproc) TARGET=$TARGET MUSL_VER=1.2.5 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER -hide_output make install TARGET=$TARGET MUSL_VER=1.2.5 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER OUTPUT=$OUTPUT +hide_output make -j$(nproc) TARGET=$TARGET MUSL_VER=1.2.6 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER +hide_output make install TARGET=$TARGET MUSL_VER=1.2.6 LINUX_HEADERS_SITE=$LINUX_HEADERS_SITE LINUX_VER=$LINUX_VER OUTPUT=$OUTPUT cd - diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh index 2402ec6ae34bf..738c45057b658 100644 --- a/src/ci/docker/scripts/musl.sh +++ b/src/ci/docker/scripts/musl.sh @@ -1,6 +1,4 @@ #!/bin/sh -# ignore-tidy-file-tab -# ignore-tidy-file-linelength set -ex hide_output() { @@ -27,52 +25,13 @@ shift # Apparently applying `-fPIC` everywhere allows them to link successfully. export CFLAGS="-fPIC $CFLAGS" -MUSL=musl-1.2.5 +MUSL=musl-1.2.6 # may have been downloaded in a previous run if [ ! -d $MUSL ]; then curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf - - # Apply patches for CVE-2025-26519. At the time of adding these patches no release containing them - # has been published by the musl project, so we just apply them directly on top of the version we - # were distributing already. The patches should be removed once we upgrade to musl >= 1.2.6. - # - # Advisory: https://www.openwall.com/lists/musl/2025/02/13/1 - # - # Patches applied: - # - https://www.openwall.com/lists/musl/2025/02/13/1/1 - # - https://www.openwall.com/lists/musl/2025/02/13/1/2 - # - patch -p1 -d $MUSL <= 93 || d >= 94) { - c += (0xa1-0x81); - d += 0xa1; -- if (c >= 93 || c>=0xc6-0x81 && d>0x52) -+ if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52) - goto ilseq; - if (d-'A'<26) d = d-'A'; - else if (d-'a'<26) d = d-'a'+26; -EOF - patch -p1 -d $MUSL <4) goto ilseq; - *out += k; - *outb -= k; - break; -EOF - - # Apply patches for CVE-2026-6042 and CVE-2026-40200. + # Apply patches for CVE-2026-6042, CVE-2026-40200 and CVE-2026-107891. # # At the time of adding these patches no release containing them has been published by the musl # project, so we just apply them directly on top of the version we were distributing already. The @@ -86,6 +45,9 @@ EOF # Advisory: https://www.openwall.com/lists/musl/2026/04/10/3 # Patches: https://www.openwall.com/lists/musl/2026/04/10/3/1 patch -p1 -d $MUSL <"$MUSL_PATCH_DIR/musl-cve-2026-40200.diff" + # Advisory: https://www.openwall.com/lists/musl/2026/10/21/1 + # Patch: https://www.openwall.com/lists/musl/2026/10/21/1/1 + patch -p1 -d $MUSL <"$MUSL_PATCH_DIR/musl-cve-2026-107891.diff" fi cd $MUSL diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index f81a7a54a6b44..d880bff40ba6d 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -93,27 +93,27 @@ target | notes -------|------- [`aarch64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ARM64 MinGW (Windows 10+), LLVM ABI [`aarch64-unknown-freebsd`](platform-support/freebsd.md) | ARM64 FreeBSD -[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.5 +[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.6 [`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ARM64 OpenHarmony `arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2+, glibc 2.17) `arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-gnueabihf`](platform-support/armv7-unknown-linux-gnueabi.md) | Armv7-A Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | Armv7-A OpenHarmony [`loongarch64-unknown-linux-gnu`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, glibc 2.36), LSX required -[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.5), LSX required +[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.6), LSX required `powerpc-unknown-linux-gnu` | PowerPC Linux (kernel 3.2+, glibc 2.17) `powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2+, glibc 2.17) -[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.5) +[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.6) [`powerpc64le-unknown-linux-gnu`](platform-support/powerpc64le-unknown-linux-gnu.md) | PPC64LE Linux (kernel 3.10+, glibc 2.17) -[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.5) +[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.6) [`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20+, glibc 2.29) -[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.5) +[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.6) [`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2+, glibc 2.17) [`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+) [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | 64-bit x86 MinGW (Windows 10+), LLVM ABI [`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD [`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos -`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.5 +`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.6 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64 [`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4 @@ -164,15 +164,15 @@ target | std | notes [`aarch64-unknown-none-softfloat`](platform-support/aarch64-unknown-none.md) | * | Bare ARM64, softfloat [`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | ARM64 UEFI [`arm-linux-androideabi`](platform-support/android.md) | ✓ | Armv6 Android -`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.5 -`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.5, hardfloat +`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.6 +`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.6, hardfloat [`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ✓ | Arm64EC Windows MSVC [`armv5te-unknown-linux-gnueabi`](platform-support/armv5te-unknown-linux-gnueabi.md) | ✓ | Armv5TE Linux (kernel 4.4+, glibc 2.23) -`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.5 +`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.6 [`armv7-linux-androideabi`](platform-support/android.md) | ✓ | Armv7-A Android [`armv7-unknown-linux-gnueabi`](platform-support/armv7-unknown-linux-gnueabi.md) | ✓ | Armv7-A Linux (kernel 4.15+, glibc 2.27) -`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.5 -`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.5, hardfloat +`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.6 +`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.6, hardfloat [`armv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A [`armv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A, hardfloat [`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R @@ -184,12 +184,12 @@ target | std | notes [`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Thumb-mode Bare Armv7-R, hardfloat [`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | Thumb-mode Bare Armv8-R, hardfloat `i586-unknown-linux-gnu` | ✓ | 32-bit Linux (kernel 3.2+, glibc 2.17, original Pentium) [^x86_32-floats-x87] -`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.5, original Pentium) [^x86_32-floats-x87] +`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.6, original Pentium) [^x86_32-floats-x87] [`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([Pentium 4 plus various extensions](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI] [`i686-pc-windows-gnu`](platform-support/windows-gnu.md) | ✓ | 32-bit MinGW (Windows 10+, Windows Server 2016+, Pentium 4) [^x86_32-floats-return-ABI] [^win32-msvc-alignment] [`i686-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI] [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI] -`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.5 (Pentium 4) [^x86_32-floats-return-ABI] +`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.6 (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 32-bit UEFI (Pentium 4, softfloat) [^win32-msvc-alignment] [`loongarch32-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32D ABI) [`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32S ABI) @@ -297,7 +297,7 @@ target | std | host | notes [`aarch64_be-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit (big-endian) `aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian) `aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI) -[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.5 +[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.6 [`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian) [`aarch64_be-unknown-none-softfloat`](platform-support/aarch64_be-unknown-none-softfloat.md) | * | | Bare big-endian ARM64, softfloat [`amdgcn-amd-amdhsa`](platform-support/amdgcn-amd-amdhsa.md) | * | | `-Ctarget-cpu=gfx...` to specify [the AMD GPU] to compile for @@ -337,7 +337,7 @@ target | std | host | notes [`bpfel-unknown-none`](platform-support/bpf-unknown-none.md) | * | | BPF (little endian) [`csky-unknown-linux-gnuabiv2`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux (little endian) [`csky-unknown-linux-gnuabiv2hf`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian) -[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.5 +[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.6 [`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX) [`hexagon-unknown-qurt`](platform-support/hexagon-unknown-qurt.md)| * | | Hexagon QuRT [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] @@ -360,17 +360,17 @@ target | std | host | notes [`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux [`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0 `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 [^snan-inverted] +`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.6 [^snan-inverted] `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc [^snan-inverted] -[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 [^snan-inverted] +[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.6 [^snan-inverted] `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 [^snan-inverted] +[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.6 [^snan-inverted] `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 [^snan-inverted] +`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.6 [^snan-inverted] `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) [^snan-inverted] [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) [^snan-inverted] [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 [^snan-inverted] +`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.6 [^snan-inverted] `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc [^snan-inverted] [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support [^snan-inverted] `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat [^snan-inverted] @@ -384,8 +384,8 @@ target | std | host | notes [`powerpc-unknown-freebsd`](platform-support/freebsd.md) | ? | | PowerPC FreeBSD [`powerpc-unknown-helenos`](platform-support/helenos.md) | ✓ | | PowerPC HelenOS [`powerpc-unknown-linux-gnuspe`](platform-support/powerpc-unknown-linux-gnuspe.md) | ✓ | | PowerPC SPE Linux -`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.5 -[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.5 +`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.6 +[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.6 [`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems [`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | | [`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | @@ -402,7 +402,7 @@ target | std | host | notes [`riscv32em-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EM ISA) [`riscv32emc-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EMC ISA) `riscv32gc-unknown-linux-gnu` | ✓ | | RISC-V Linux (kernel 5.4, glibc 2.33) -`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.5) +`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.6) [`riscv32im-risc0-zkvm-elf`](platform-support/riscv32im-risc0-zkvm-elf.md) | ? | | RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA) [`riscv32ima-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMA ISA) [`riscv32imfc-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMFC ISA, hardware single-float, no atomics) @@ -426,7 +426,7 @@ target | std | host | notes [`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS [`riscv64im-unknown-none-elf`](platform-support/riscv64-unknown-none-elf.md) | * | | Bare RISC-V (RV64IM ISA) [`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX -[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.5) +[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.6) `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux [`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+ [`sparc64-unknown-helenos`](platform-support/helenos.md) | ✓ | | sparc64 HelenOS @@ -444,7 +444,7 @@ target | std | host | notes [`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX [`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat [`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX -`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5 +`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.6 [`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX [`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX [`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat @@ -459,7 +459,7 @@ target | std | host | notes [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with default network stack (io-pkt) | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with new network stack (io-sock) | [`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | -[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 +[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.6 `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku [`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit diff --git a/src/doc/rustc/src/platform-support/loongarch-linux.md b/src/doc/rustc/src/platform-support/loongarch-linux.md index 7817ce6138a04..358a720e7daf1 100644 --- a/src/doc/rustc/src/platform-support/loongarch-linux.md +++ b/src/doc/rustc/src/platform-support/loongarch-linux.md @@ -8,7 +8,7 @@ LoongArch is a RISC ISA developed by Loongson Technology Corporation Limited. | Target | Description | |--------|-------------| | `loongarch64-unknown-linux-gnu` | LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36), LSX required | -| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.5), LSX required | +| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.6), LSX required | These support both native and cross builds, and have full support for `std`. diff --git a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md index 12872b74b6820..6f8ca68c4504b 100644 --- a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md @@ -16,7 +16,7 @@ Linux musl libc RISC-V target using the *RV64I* base instruction set with the This target requires: * Linux Kernel version 4.20 or later -* musl libc 1.2.5 or later +* musl libc 1.2.6 or later ## Building the target diff --git a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md index cb7d055154530..5306c391d80ad 100644 --- a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md @@ -14,7 +14,7 @@ IBM z/Architecture (s390x) targets (including IBM Z and LinuxONE) running Linux. This target requires: * Linux Kernel version 3.2 or later -* musl 1.2.5 or later +* musl 1.2.6 or later Code generated by the target uses the z/Architecture ISA assuming a minimum architecture level of z10 (Eighth Edition of the z/Architecture Principles From 6d1c8f167dec7db227cd68fb5b4de3bab4daa994 Mon Sep 17 00:00:00 2001 From: zannabianca1997 Date: Fri, 6 Nov 2026 22:53:01 +0100 Subject: [PATCH 09/38] Feat: move trait gate add the trait and the trait gate --- compiler/rustc_attr_ir/src/lang_items.rs | 2 + compiler/rustc_feature/src/unstable.rs | 2 + compiler/rustc_middle/src/ty/context.rs | 11 +++++- .../src/ty/context/impl_interner.rs | 1 + .../src/solve/trait_goals.rs | 13 +++++++ compiler/rustc_span/src/symbol.rs | 1 + compiler/rustc_type_ir/src/inherent.rs | 2 + compiler/rustc_type_ir/src/lang_items.rs | 1 + library/core/src/lib.rs | 1 + library/core/src/marker.rs | 38 +++++++++++++++++++ .../feature-gates/feature-gate-move-trait.rs | 18 +++++++++ 11 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 tests/ui/feature-gates/feature-gate-move-trait.rs diff --git a/compiler/rustc_attr_ir/src/lang_items.rs b/compiler/rustc_attr_ir/src/lang_items.rs index 844daa32a04ac..0cdd28adcbaa0 100644 --- a/compiler/rustc_attr_ir/src/lang_items.rs +++ b/compiler/rustc_attr_ir/src/lang_items.rs @@ -279,6 +279,8 @@ language_item_table! { Unpin, sym::unpin, unpin_trait, Target::Trait, GenericRequirement::None; Pin, kw::Pin, pin_type, Target::Struct, GenericRequirement::None; + Move, sym::move_trait, move_trait, Target::Trait, GenericRequirement::None; + OrderingEnum, sym::Ordering, ordering_enum, Target::Enum, GenericRequirement::Exact(0); PartialEq, sym::eq, eq_trait, Target::Trait, GenericRequirement::Exact(1); PartialOrd, sym::partial_ord, partial_ord_trait, Target::Trait, GenericRequirement::Exact(1); diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index ed2bf64263c67..14784cefe2c2a 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -654,6 +654,8 @@ declare_features! ( (unstable, movdiri_target_feature, "CURRENT_RUSTC_VERSION", Some(163741)), /// Allows `move(expr)` in closures. (incomplete, move_expr, "1.97.0", Some(155050)), + /// The `Move` autotrait. + (incomplete, move_trait, "CURRENT_RUSTC_VERSION", Some(149607)), /// The `movrs` target feature on x86. (unstable, movrs_target_feature, "1.88.0", Some(137976)), /// Allows the `multiple_supertrait_upcastable` lint. diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index ef9020cf6ea56..007d12b5e8fa8 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -122,6 +122,10 @@ impl<'tcx> rustc_type_ir::inherent::Features> for &'tcx rustc_featu self.coroutine_clone() } + fn move_trait(self) -> bool { + self.move_trait() + } + fn feature_bound_holds_in_crate(self, symbol: Symbol) -> bool { // We don't consider feature bounds to hold in the crate when `staged_api` feature is // enabled, even if it is enabled through `#[feature]`. @@ -964,10 +968,15 @@ impl<'tcx> TyCtxt<'tcx> { including_sized: IncludeSizedImplicitBounds, ) -> bool { self.is_default_trait(def_id) - // NOTE: add move and forget here later + // NOTE: add forget here later + || self.is_move_trait(def_id) || (matches!(including_sized, IncludeSizedImplicitBounds::Yes) && self.is_sizedness_trait(def_id)) } + pub fn is_move_trait(self, def_id: DefId) -> bool { + matches!(self.as_lang_item(def_id), Some(LangItem::Move)) + } + pub fn is_sizedness_trait(self, def_id: DefId) -> bool { matches!(self.as_lang_item(def_id), Some(LangItem::Sized | LangItem::MetaSized)) } diff --git a/compiler/rustc_middle/src/ty/context/impl_interner.rs b/compiler/rustc_middle/src/ty/context/impl_interner.rs index c62bdcebec389..c71d13962bc5a 100644 --- a/compiler/rustc_middle/src/ty/context/impl_interner.rs +++ b/compiler/rustc_middle/src/ty/context/impl_interner.rs @@ -849,6 +849,7 @@ bidirectional_lang_item_map! { Future, Iterator, MetaSized, + Move, PointeeSized, PointeeTrait, Sized, diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index 685897188a6bf..6b40996eb6d65 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -212,6 +212,19 @@ where return Err(NoSolution.into()); } + // Fast path: when the feature is disabled, + // assume all types implement `Move`. + // + // This will trivially make the addition of + // `Move` backward compatible with trait bounds + if !cx.features().move_trait() + && cx.is_trait_lang_item(goal.predicate.def_id(), SolverTraitLangItem::Move) + { + return ecx + .probe_builtin_trait_candidate(BuiltinImplSource::Trivial) + .enter(|ecx| ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)); + } + if let Some(result) = ecx.disqualify_auto_trait_candidate_due_to_possible_impl(goal) { return result; } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index a7f8e37687b18..6ed555b0ae246 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1412,6 +1412,7 @@ symbols! { move_expr, move_ref_pattern, move_size_limit, + move_trait, movrs_target_feature, msa, msp430, diff --git a/compiler/rustc_type_ir/src/inherent.rs b/compiler/rustc_type_ir/src/inherent.rs index cc65dd25e5af4..a43ff4c1a2141 100644 --- a/compiler/rustc_type_ir/src/inherent.rs +++ b/compiler/rustc_type_ir/src/inherent.rs @@ -597,6 +597,8 @@ pub trait Features: Copy { fn coroutine_clone(self) -> bool; + fn move_trait(self) -> bool; + fn feature_bound_holds_in_crate(self, symbol: I::Symbol) -> bool; } diff --git a/compiler/rustc_type_ir/src/lang_items.rs b/compiler/rustc_type_ir/src/lang_items.rs index 246d6241ec8ba..fb6f6ba0fbb19 100644 --- a/compiler/rustc_type_ir/src/lang_items.rs +++ b/compiler/rustc_type_ir/src/lang_items.rs @@ -51,6 +51,7 @@ pub enum SolverTraitLangItem { Future, Iterator, MetaSized, + Move, PointeeSized, PointeeTrait, Sized, diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 634b89885bca4..822e62b5867ac 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -141,6 +141,7 @@ #![feature(macro_metavar_expr_concat)] #![feature(marker_trait_attr)] #![feature(min_specialization)] +#![feature(move_trait)] #![feature(multiple_supertrait_upcastable)] #![feature(must_not_suspend)] #![feature(negative_impls)] diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 4c9f49a195fde..c925b7b5f3c76 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1421,3 +1421,41 @@ pub macro CoerceShared($item:item) { pub unsafe auto trait Forget { // Empty. } +/// Marks a type as freely movable to another address in memory. +/// +/// By default, all types are assumed to be `Move`. Similar to [`Sized`], the +/// syntax `T: ?Move` can be used to relax this bound for some type `T`. However, +/// `Move` bounds are implicitly added in *all* cases unless explicitly opted out +/// of - notably, in trait definitions and associated types. If the `move_trait` +/// feature is enabled, these can similarly be opted out of: +/// ``` +/// #![feature(move_trait)] +/// use std::marker::Move; +/// +/// trait Foo: ?Move { +/// type Bar: ?Move; +/// } +/// ``` +#[lang = "move_trait"] +#[rustc_specialization_trait] +#[rustc_coinductive] +#[diagnostic::on_unimplemented( + message = "values of type `{Self}` may not be movable", + label = "may not be movable" +)] +#[unstable(feature = "move_trait", issue = "149607")] +pub unsafe auto trait Move { + // Empty. +} + +marker_impls! { + #[unstable(feature = "move_trait", issue = "149607")] + unsafe Move for + {T: PointeeSized + ?Move} *const T, + {T: PointeeSized + ?Move} *mut T, + {T: PointeeSized + ?Move} &T, + {T: PointeeSized + ?Move} &mut T, + {T: PointeeSized + ?Move} PhantomData, + {T: PointeeSized + ?Move} pattern_type!(*const T is !null), + {T: PointeeSized + ?Move} pattern_type!(*mut T is !null), +} diff --git a/tests/ui/feature-gates/feature-gate-move-trait.rs b/tests/ui/feature-gates/feature-gate-move-trait.rs new file mode 100644 index 0000000000000..d7e2d85cb9749 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-move-trait.rs @@ -0,0 +1,18 @@ +//@ run-pass +#![feature(move_trait)] +#![feature(negative_impls)] +#![feature(min_specialization)] + +use std::marker::Move; + +struct A; +struct B; +impl !Move for B {} + +fn main() { + let a = A; + let _new_a = a; + + let b = B; + let _new_b = b; +} From aafd1741510ab380267e4ad8eeac15932d20cb4a Mon Sep 17 00:00:00 2001 From: zannabianca1997 Date: Fri, 6 Nov 2026 23:33:07 +0100 Subject: [PATCH 10/38] Fix: rustdoc tests see similar fixes on the forget --- .../auto-trait-bounds-by-associated-type-50159.rs | 2 +- tests/rustdoc-html/empty-section.rs | 13 ++++++++++++- tests/rustdoc-html/synthetic_auto/basic.rs | 2 +- tests/rustdoc-html/synthetic_auto/manual.rs | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/rustdoc-html/auto/auto-trait-bounds-by-associated-type-50159.rs b/tests/rustdoc-html/auto/auto-trait-bounds-by-associated-type-50159.rs index e0498758cca1f..762f14a24b04b 100644 --- a/tests/rustdoc-html/auto/auto-trait-bounds-by-associated-type-50159.rs +++ b/tests/rustdoc-html/auto/auto-trait-bounds-by-associated-type-50159.rs @@ -20,7 +20,7 @@ where //@ has - '//h3[@class="code-header"]' 'impl Send for Switchwhere ::Item: Send' //@ has - '//h3[@class="code-header"]' 'impl Sync for Switchwhere ::Item: Sync' //@ count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 -//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 8 +//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 9 // The number here will need updating when new auto traits are added: ^ pub struct Switch { pub inner: ::Item2, diff --git a/tests/rustdoc-html/empty-section.rs b/tests/rustdoc-html/empty-section.rs index f837635b83eb3..c964e1161be93 100644 --- a/tests/rustdoc-html/empty-section.rs +++ b/tests/rustdoc-html/empty-section.rs @@ -1,5 +1,15 @@ #![crate_name = "foo"] -#![feature(negative_impls, freeze_impls, freeze, unsafe_unpin, forget_trait, min_specialization)] + +// tidy-alphabetical-start +#![feature(forget_trait)] +#![feature(freeze)] +#![feature(freeze_impls)] +#![feature(min_specialization)] +#![feature(move_trait)] +#![feature(negative_impls)] +#![feature(unsafe_unpin)] +// tidy-alphabetical-end + #![allow(incomplete_features)] pub struct Foo; @@ -15,3 +25,4 @@ impl !std::marker::Unpin for Foo {} impl !std::panic::RefUnwindSafe for Foo {} impl !std::panic::UnwindSafe for Foo {} impl !std::marker::Forget for Foo {} +impl !std::marker::Move for Foo {} diff --git a/tests/rustdoc-html/synthetic_auto/basic.rs b/tests/rustdoc-html/synthetic_auto/basic.rs index 06a3167f5c0be..edf3cf4c9861e 100644 --- a/tests/rustdoc-html/synthetic_auto/basic.rs +++ b/tests/rustdoc-html/synthetic_auto/basic.rs @@ -2,7 +2,7 @@ //@ has - '//h3[@class="code-header"]' 'impl Send for Foowhere T: Send' //@ has - '//h3[@class="code-header"]' 'impl Sync for Foowhere T: Sync' //@ count - '//*[@id="implementations-list"]//*[@class="impl"]' 0 -//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 8 +//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 9 // The number here will need updating when new auto traits are added: ^ pub struct Foo { field: T, diff --git a/tests/rustdoc-html/synthetic_auto/manual.rs b/tests/rustdoc-html/synthetic_auto/manual.rs index be549a524950a..4911b5109d4f1 100644 --- a/tests/rustdoc-html/synthetic_auto/manual.rs +++ b/tests/rustdoc-html/synthetic_auto/manual.rs @@ -6,7 +6,7 @@ // 'impl Send for Foo' // //@ count - '//*[@id="trait-implementations-list"]//*[@class="impl"]' 1 -//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 7 +//@ count - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]' 8 // The number here will need updating when new auto traits are added: ^ pub struct Foo { field: T, From 45b068b07d0cea04a56f987627bb655c93b9aaac Mon Sep 17 00:00:00 2001 From: zannabianca1997 Date: Fri, 6 Nov 2026 23:50:17 +0100 Subject: [PATCH 11/38] Fix: core doctests need the relaxed bound policy --- compiler/rustc_ast_lowering/src/item.rs | 10 +++++++++- library/core/src/marker.rs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index a7f138c992517..89ff04d78008e 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -452,13 +452,21 @@ impl<'hir> LoweringContext<'_, 'hir> { let constness = self.lower_constness(attrs, *constness); let impl_restriction = self.lower_impl_restriction(impl_restriction, hir_id); let ident = self.lower_ident(*ident); + // FIXME(move_trait): We likely want to not add an implicit `Move` super trait + // at which point we shouldn't allow relaxed bounds here. Even if we do, we should + // make sure to only allow `?Move`. + let policy = if self.tcx.features().move_trait() { + RelaxedBoundPolicy::Allowed(&mut Default::default()) + } else { + RelaxedBoundPolicy::Forbidden(RelaxedBoundForbiddenReason::SuperTrait) + }; let (generics, (safety, items, bounds)) = self.lower_generics( generics, ImplTraitContext::Disallowed(ImplTraitPosition::Generic), |this| { let bounds = this.lower_param_bounds( bounds, - RelaxedBoundPolicy::Forbidden(RelaxedBoundForbiddenReason::SuperTrait), + policy, ImplTraitContext::Disallowed(ImplTraitPosition::Bound), ); let items = this.arena.alloc_from_iter( diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index c925b7b5f3c76..d435e53cdd07b 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1429,6 +1429,7 @@ pub unsafe auto trait Forget { /// of - notably, in trait definitions and associated types. If the `move_trait` /// feature is enabled, these can similarly be opted out of: /// ``` +/// #![allow(incomplete_features)] /// #![feature(move_trait)] /// use std::marker::Move; /// From 9882511e4abf08c9e962143b47452f4bf8e76ecf Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sat, 7 Nov 2026 10:32:52 +0000 Subject: [PATCH 12/38] Keep the minimum required musl version at 1.2.5 --- .../targets/aarch64_be_unknown_linux_musl.rs | 2 +- .../targets/aarch64_unknown_linux_musl.rs | 2 +- .../targets/arm_unknown_linux_musleabi.rs | 2 +- .../targets/arm_unknown_linux_musleabihf.rs | 2 +- .../targets/armv5te_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabi.rs | 2 +- .../targets/armv7_unknown_linux_musleabihf.rs | 2 +- .../targets/hexagon_unknown_linux_musl.rs | 2 +- .../spec/targets/i686_unknown_linux_musl.rs | 2 +- .../targets/loongarch64_unknown_linux_musl.rs | 2 +- .../spec/targets/mips64_openwrt_linux_musl.rs | 2 +- .../targets/mips64_unknown_linux_muslabi64.rs | 2 +- .../mips64el_unknown_linux_muslabi64.rs | 2 +- .../spec/targets/mips_unknown_linux_musl.rs | 2 +- .../spec/targets/mipsel_unknown_linux_musl.rs | 2 +- .../targets/powerpc64_unknown_linux_musl.rs | 2 +- .../targets/powerpc64le_unknown_linux_musl.rs | 2 +- .../targets/powerpc_unknown_linux_musl.rs | 2 +- .../targets/riscv32gc_unknown_linux_musl.rs | 2 +- .../targets/riscv64gc_unknown_linux_musl.rs | 2 +- .../spec/targets/s390x_unknown_linux_musl.rs | 2 +- .../thumbv7neon_unknown_linux_musleabihf.rs | 2 +- .../targets/x86_64_unikraft_linux_musl.rs | 2 +- .../spec/targets/x86_64_unknown_linux_musl.rs | 2 +- src/doc/rustc/src/platform-support.md | 52 +++++++++---------- .../src/platform-support/loongarch-linux.md | 2 +- .../riscv64gc-unknown-linux-musl.md | 2 +- .../s390x-unknown-linux-musl.md | 2 +- 28 files changed, 53 insertions(+), 53 deletions(-) diff --git a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs index 5e9d64fc2040c..d3bf641a747fa 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_musl.rs @@ -19,7 +19,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64_be-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.6".into()), + description: Some("ARM64 Linux (big-endian) with musl-libc 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs index 439baa41fb1f5..6ba5112342c3e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "aarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("ARM64 Linux with musl 1.2.6".into()), + description: Some("ARM64 Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 07e24361387ff..5dce420428768 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.6".into()), + description: Some("Armv6 Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 005123340a2fe..5b1d1e2a5a48e 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv6 Linux with musl 1.2.6, hardfloat".into()), + description: Some("Armv6 Linux with musl 1.2.5, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index d5dfcc0c9af7f..b5a31a9821e2b 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -4,7 +4,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv5te-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv5TE Linux with musl 1.2.6".into()), + description: Some("Armv5TE Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index ef49c26587d95..66e1eb1115e50 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabi".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.6".into()), + description: Some("Armv7-A Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 462945c6a0898..39c45161082ab 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "arm-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Armv7-A Linux with musl 1.2.6, hardfloat".into()), + description: Some("Armv7-A Linux with musl 1.2.5, hardfloat".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs index 37322eaae6d08..92c477f53f8f3 100644 --- a/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "hexagon-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("Hexagon Linux with musl 1.2.6".into()), + description: Some("Hexagon Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs index 28d57cf4a0e3e..212c2b8db56da 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs @@ -33,7 +33,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "i686-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("32-bit Linux with musl 1.2.6".into()), + description: Some("32-bit Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index 73ce78392d472..4030152071303 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "loongarch64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.6".into()), + description: Some("LoongArch64 Linux (LP64D ABI) with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs index d6cb6bb7003f1..ec91dbeb86ef9 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs @@ -14,7 +14,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 for OpenWrt Linux musl 1.2.6".into()), + description: Some("MIPS64 for OpenWrt Linux musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs index 1dd1c9deeab3d..c83d371692e69 100644 --- a/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs @@ -11,7 +11,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs index 32ba090486e2b..5685e84f140a4 100644 --- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs +++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs @@ -9,7 +9,7 @@ pub(crate) fn target() -> Target { // LLVM doesn't recognize "muslabi64" yet. llvm_target: "mips64el-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS64 Linux, N64 ABI, musl 1.2.6".into()), + description: Some("MIPS64 Linux, N64 ABI, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs index fc9dfa35ade71..7e3bebc60e9d3 100644 --- a/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mips-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS Linux with musl 1.2.6".into()), + description: Some("MIPS Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs index c0151fd8e4fcf..c94f2fd87e589 100644 --- a/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "mipsel-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("MIPS (little endian) Linux with musl 1.2.6".into()), + description: Some("MIPS (little endian) Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs index 9464665774db8..474d20d2f0544 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.6".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs index 77cb5cdb147ff..0060a41d79d08 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs @@ -17,7 +17,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit PowerPC Linux with musl 1.2.6, Little Endian".into()), + description: Some("64-bit PowerPC Linux with musl 1.2.5, Little Endian".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs index eaef449e4fd19..7e494e065a048 100644 --- a/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs @@ -13,7 +13,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "powerpc-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("PowerPC Linux with musl 1.2.6".into()), + description: Some("PowerPC Linux with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs index 4f3942108f39f..e5618ea6b20da 100644 --- a/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv32-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 5.4, musl 1.2.6)".into()), + description: Some("RISC-V Linux (kernel 5.4, musl 1.2.5)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs index 883b6839c5e55..088d4821042d8 100644 --- a/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs @@ -8,7 +8,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "riscv64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("RISC-V Linux (kernel 4.20, musl 1.2.6)".into()), + description: Some("RISC-V Linux (kernel 4.20, musl 1.2.5)".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs index 422d80d8b1453..5ff9f025ba1d9 100644 --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs @@ -18,7 +18,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "s390x-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("S390x Linux (kernel 3.2, musl 1.2.6)".into()), + description: Some("S390x Linux (kernel 3.2, musl 1.2.5)".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index 1ae4daa6c9227..dc4f8987d5d24 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "armv7-unknown-linux-musleabihf".into(), metadata: TargetMetadata { - description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.6".into()), + description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs index 7e57145705ed9..c5421f3e6b748 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs @@ -6,7 +6,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Unikraft with musl 1.2.6".into()), + description: Some("64-bit Unikraft with musl 1.2.5".into()), tier: Some(3), host_tools: Some(false), std: Some(true), diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs index bce0f174cde3d..a664f22479913 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs @@ -23,7 +23,7 @@ pub(crate) fn target() -> Target { Target { llvm_target: "x86_64-unknown-linux-musl".into(), metadata: TargetMetadata { - description: Some("64-bit Linux with musl 1.2.6".into()), + description: Some("64-bit Linux with musl 1.2.5".into()), tier: Some(2), host_tools: Some(true), std: Some(true), diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index d880bff40ba6d..f81a7a54a6b44 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -93,27 +93,27 @@ target | notes -------|------- [`aarch64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ARM64 MinGW (Windows 10+), LLVM ABI [`aarch64-unknown-freebsd`](platform-support/freebsd.md) | ARM64 FreeBSD -[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.6 +[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.5 [`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ARM64 OpenHarmony `arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2+, glibc 2.17) `arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-gnueabihf`](platform-support/armv7-unknown-linux-gnueabi.md) | Armv7-A Linux, hardfloat (kernel 3.2+, glibc 2.17) [`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | Armv7-A OpenHarmony [`loongarch64-unknown-linux-gnu`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, glibc 2.36), LSX required -[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.6), LSX required +[`loongarch64-unknown-linux-musl`](platform-support/loongarch-linux.md) | LoongArch64 Linux, LP64D ABI (kernel 5.19+, musl 1.2.5), LSX required `powerpc-unknown-linux-gnu` | PowerPC Linux (kernel 3.2+, glibc 2.17) `powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2+, glibc 2.17) -[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.6) +[`powerpc64-unknown-linux-musl`](platform-support/powerpc64-unknown-linux-musl.md) | PPC64 Linux (kernel 4.19+, musl 1.2.5) [`powerpc64le-unknown-linux-gnu`](platform-support/powerpc64le-unknown-linux-gnu.md) | PPC64LE Linux (kernel 3.10+, glibc 2.17) -[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.6) +[`powerpc64le-unknown-linux-musl`](platform-support/powerpc64le-unknown-linux-musl.md) | PPC64LE Linux (kernel 4.19+, musl 1.2.5) [`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20+, glibc 2.29) -[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.6) +[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20+, musl 1.2.5) [`s390x-unknown-linux-gnu`](platform-support/s390x-unknown-linux-gnu.md) | S390x Linux (kernel 3.2+, glibc 2.17) [`x86_64-apple-darwin`](platform-support/apple-darwin.md) | 64-bit macOS (10.12+, Sierra+) [`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | 64-bit x86 MinGW (Windows 10+), LLVM ABI [`x86_64-unknown-freebsd`](platform-support/freebsd.md) | 64-bit x86 FreeBSD [`x86_64-unknown-illumos`](platform-support/illumos.md) | illumos -`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.6 +`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.5 [`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony [`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64 [`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4 @@ -164,15 +164,15 @@ target | std | notes [`aarch64-unknown-none-softfloat`](platform-support/aarch64-unknown-none.md) | * | Bare ARM64, softfloat [`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | ? | ARM64 UEFI [`arm-linux-androideabi`](platform-support/android.md) | ✓ | Armv6 Android -`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.6 -`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.6, hardfloat +`arm-unknown-linux-musleabi` | ✓ | Armv6 Linux with musl 1.2.5 +`arm-unknown-linux-musleabihf` | ✓ | Armv6 Linux with musl 1.2.5, hardfloat [`arm64ec-pc-windows-msvc`](platform-support/arm64ec-pc-windows-msvc.md) | ✓ | Arm64EC Windows MSVC [`armv5te-unknown-linux-gnueabi`](platform-support/armv5te-unknown-linux-gnueabi.md) | ✓ | Armv5TE Linux (kernel 4.4+, glibc 2.23) -`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.6 +`armv5te-unknown-linux-musleabi` | ✓ | Armv5TE Linux with musl 1.2.5 [`armv7-linux-androideabi`](platform-support/android.md) | ✓ | Armv7-A Android [`armv7-unknown-linux-gnueabi`](platform-support/armv7-unknown-linux-gnueabi.md) | ✓ | Armv7-A Linux (kernel 4.15+, glibc 2.27) -`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.6 -`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.6, hardfloat +`armv7-unknown-linux-musleabi` | ✓ | Armv7-A Linux with musl 1.2.5 +`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.5, hardfloat [`armv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A [`armv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | Bare Armv7-A, hardfloat [`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R @@ -184,12 +184,12 @@ target | std | notes [`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Thumb-mode Bare Armv7-R, hardfloat [`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | Thumb-mode Bare Armv8-R, hardfloat `i586-unknown-linux-gnu` | ✓ | 32-bit Linux (kernel 3.2+, glibc 2.17, original Pentium) [^x86_32-floats-x87] -`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.6, original Pentium) [^x86_32-floats-x87] +`i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.5, original Pentium) [^x86_32-floats-x87] [`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([Pentium 4 plus various extensions](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI] [`i686-pc-windows-gnu`](platform-support/windows-gnu.md) | ✓ | 32-bit MinGW (Windows 10+, Windows Server 2016+, Pentium 4) [^x86_32-floats-return-ABI] [^win32-msvc-alignment] [`i686-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI] [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI] -`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.6 (Pentium 4) [^x86_32-floats-return-ABI] +`i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.5 (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 32-bit UEFI (Pentium 4, softfloat) [^win32-msvc-alignment] [`loongarch32-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32D ABI) [`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32S ABI) @@ -297,7 +297,7 @@ target | std | host | notes [`aarch64_be-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit (big-endian) `aarch64_be-unknown-linux-gnu` | ✓ | ✓ | ARM64 Linux (big-endian) `aarch64_be-unknown-linux-gnu_ilp32` | ✓ | ✓ | ARM64 Linux (big-endian, ILP32 ABI) -[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.6 +[`aarch64_be-unknown-linux-musl`](platform-support/aarch64_be-unknown-linux-musl.md) | ✓ | ✓ | ARM64 Linux (big-endian) with musl-libc 1.2.5 [`aarch64_be-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | ARM64 NetBSD (big-endian) [`aarch64_be-unknown-none-softfloat`](platform-support/aarch64_be-unknown-none-softfloat.md) | * | | Bare big-endian ARM64, softfloat [`amdgcn-amd-amdhsa`](platform-support/amdgcn-amd-amdhsa.md) | * | | `-Ctarget-cpu=gfx...` to specify [the AMD GPU] to compile for @@ -337,7 +337,7 @@ target | std | host | notes [`bpfel-unknown-none`](platform-support/bpf-unknown-none.md) | * | | BPF (little endian) [`csky-unknown-linux-gnuabiv2`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux (little endian) [`csky-unknown-linux-gnuabiv2hf`](platform-support/csky-unknown-linux-gnuabiv2.md) | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian) -[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.6 +[`hexagon-unknown-linux-musl`](platform-support/hexagon-unknown-linux-musl.md) | ✓ | | Hexagon Linux with musl 1.2.5 [`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX) [`hexagon-unknown-qurt`](platform-support/hexagon-unknown-qurt.md)| * | | Hexagon QuRT [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] @@ -360,17 +360,17 @@ target | std | host | notes [`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux [`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0 `mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.6 [^snan-inverted] +`mips-unknown-linux-musl` | ✓ | | MIPS Linux with musl 1.2.5 [^snan-inverted] `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc [^snan-inverted] -[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.6 [^snan-inverted] +[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux musl 1.2.5 [^snan-inverted] `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.6 [^snan-inverted] +[`mips64-unknown-linux-muslabi64`](platform-support/mips64-unknown-linux-muslabi64.md) | ✓ | ✓ | MIPS64 Linux, N64 ABI, musl 1.2.5 [^snan-inverted] `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (little endian) Linux, N64 ABI (kernel 4.4, glibc 2.23) [^snan-inverted] -`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.6 [^snan-inverted] +`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl 1.2.5 [^snan-inverted] `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) [^snan-inverted] [`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX) [^snan-inverted] [`mipsel-unknown-linux-gnu`](platform-support/mipsel-unknown-linux-gnu.md) | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23) [^snan-inverted] -`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.6 [^snan-inverted] +`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl 1.2.5 [^snan-inverted] `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc [^snan-inverted] [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support [^snan-inverted] `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat [^snan-inverted] @@ -384,8 +384,8 @@ target | std | host | notes [`powerpc-unknown-freebsd`](platform-support/freebsd.md) | ? | | PowerPC FreeBSD [`powerpc-unknown-helenos`](platform-support/helenos.md) | ✓ | | PowerPC HelenOS [`powerpc-unknown-linux-gnuspe`](platform-support/powerpc-unknown-linux-gnuspe.md) | ✓ | | PowerPC SPE Linux -`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.6 -[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.6 +`powerpc-unknown-linux-musl` | ? | | PowerPC Linux with musl 1.2.5 +[`powerpc-unknown-linux-muslspe`](platform-support/powerpc-unknown-linux-muslspe.md) | ? | | PowerPC SPE Linux with musl 1.2.5 [`powerpc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD 32-bit powerpc systems [`powerpc-unknown-openbsd`](platform-support/powerpc-unknown-openbsd.md) | * | | [`powerpc-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | @@ -402,7 +402,7 @@ target | std | host | notes [`riscv32em-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EM ISA) [`riscv32emc-unknown-none-elf`](platform-support/riscv32e-unknown-none-elf.md) | * | | Bare RISC-V (RV32EMC ISA) `riscv32gc-unknown-linux-gnu` | ✓ | | RISC-V Linux (kernel 5.4, glibc 2.33) -`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.6) +`riscv32gc-unknown-linux-musl` | ? | | RISC-V Linux (kernel 5.4, musl 1.2.5) [`riscv32im-risc0-zkvm-elf`](platform-support/riscv32im-risc0-zkvm-elf.md) | ? | | RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA) [`riscv32ima-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMA ISA) [`riscv32imfc-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMFC ISA, hardware single-float, no atomics) @@ -426,7 +426,7 @@ target | std | host | notes [`riscv64gc-unknown-redox`](platform-support/redox.md) | ✓ | | RISC-V 64bit Redox OS [`riscv64im-unknown-none-elf`](platform-support/riscv64-unknown-none-elf.md) | * | | Bare RISC-V (RV64IM ISA) [`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 64bit with NuttX -[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.6) +[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.5) `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux [`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+ [`sparc64-unknown-helenos`](platform-support/helenos.md) | ✓ | | sparc64 HelenOS @@ -444,7 +444,7 @@ target | std | host | notes [`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX [`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat [`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX -`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.6 +`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5 [`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX [`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX [`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat @@ -459,7 +459,7 @@ target | std | host | notes [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with default network stack (io-pkt) | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 7.1 with new network stack (io-sock) | [`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | -[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.6 +[`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku [`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit diff --git a/src/doc/rustc/src/platform-support/loongarch-linux.md b/src/doc/rustc/src/platform-support/loongarch-linux.md index 358a720e7daf1..7817ce6138a04 100644 --- a/src/doc/rustc/src/platform-support/loongarch-linux.md +++ b/src/doc/rustc/src/platform-support/loongarch-linux.md @@ -8,7 +8,7 @@ LoongArch is a RISC ISA developed by Loongson Technology Corporation Limited. | Target | Description | |--------|-------------| | `loongarch64-unknown-linux-gnu` | LoongArch64 Linux, LP64D ABI (kernel 5.19, glibc 2.36), LSX required | -| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.6), LSX required | +| `loongarch64-unknown-linux-musl` | LoongArch64 Linux, LP64D ABI (kernel 5.19, musl 1.2.5), LSX required | These support both native and cross builds, and have full support for `std`. diff --git a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md index 6f8ca68c4504b..12872b74b6820 100644 --- a/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/riscv64gc-unknown-linux-musl.md @@ -16,7 +16,7 @@ Linux musl libc RISC-V target using the *RV64I* base instruction set with the This target requires: * Linux Kernel version 4.20 or later -* musl libc 1.2.6 or later +* musl libc 1.2.5 or later ## Building the target diff --git a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md index 5306c391d80ad..cb7d055154530 100644 --- a/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md +++ b/src/doc/rustc/src/platform-support/s390x-unknown-linux-musl.md @@ -14,7 +14,7 @@ IBM z/Architecture (s390x) targets (including IBM Z and LinuxONE) running Linux. This target requires: * Linux Kernel version 3.2 or later -* musl 1.2.6 or later +* musl 1.2.5 or later Code generated by the target uses the z/Architecture ISA assuming a minimum architecture level of z10 (Eighth Edition of the z/Architecture Principles From ad13cdfa5f8d7bbc85b523bf14ad090430ed7a8c Mon Sep 17 00:00:00 2001 From: malezjaa Date: Sun, 8 Nov 2026 15:28:58 +0100 Subject: [PATCH 13/38] fix NumScalableVectors::from_field_count --- compiler/rustc_abi/src/lib.rs | 8 ++++---- compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e9f24e0feb82..cff90e454c0ca 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1778,12 +1778,12 @@ impl NumScalableVectors { NumScalableVectors(1) } - // Returns `NumScalableVectors` for values of two through eight, which are a valid number of - // fields for a tuple of scalable vectors to have. `1` is a valid value of `NumScalableVectors` - // but not for a tuple which would have a field count. + /// Returns `NumScalableVectors` for values of two through eight, which are a valid number of + /// fields for a tuple of scalable vectors to have. `1` is a valid value of `NumScalableVectors` + /// but not for a tuple which would have a field count. pub fn from_field_count(count: usize) -> Option { match count { - 2..8 => Some(NumScalableVectors(count as u8)), + 2..=8 => Some(NumScalableVectors(count as u8)), _ => None, } } diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 594f4cbcf759d..a0fc49da6195e 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -744,7 +744,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { assert_matches!( self.layout_of(fn_args.type_at(0)).backend_repr, BackendRepr::SimdScalableVector { - number_of_vectors: NumScalableVectors(2 | 3 | 4 | 5 | 6 | 7 | 8), + number_of_vectors: NumScalableVectors(2..=8), .. } ); @@ -765,7 +765,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { assert_matches!( self.layout_of(fn_args.type_at(0)).backend_repr, BackendRepr::SimdScalableVector { - number_of_vectors: NumScalableVectors(2 | 3 | 4 | 5 | 6 | 7 | 8), + number_of_vectors: NumScalableVectors(2..=8), .. } ); From a79fce1e15f730bd1f43e5a9e1fd548dc0ec588c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 23 Sep 2026 16:11:02 +0200 Subject: [PATCH 14/38] add `core::arch::{x86, x86_64}::x87_f80` --- compiler/rustc_abi/src/callconv/reg.rs | 11 +- compiler/rustc_abi/src/layout/ty.rs | 17 + compiler/rustc_abi/src/lib.rs | 28 +- compiler/rustc_attr_ir/src/lang_items.rs | 2 + .../rustc_codegen_cranelift/src/common.rs | 1 + compiler/rustc_codegen_gcc/src/builder.rs | 6 +- compiler/rustc_codegen_gcc/src/int.rs | 4 +- compiler/rustc_codegen_gcc/src/type_.rs | 6 + compiler/rustc_codegen_llvm/src/abi.rs | 2 + compiler/rustc_codegen_llvm/src/intrinsic.rs | 4 + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 1 + compiler/rustc_codegen_llvm/src/type_.rs | 4 + compiler/rustc_codegen_llvm/src/type_of.rs | 7 +- compiler/rustc_codegen_llvm/src/va_arg.rs | 5 +- .../rustc_codegen_ssa/src/mir/naked_asm.rs | 1 + .../rustc_codegen_ssa/src/traits/type_.rs | 2 + compiler/rustc_middle/src/ty/layout.rs | 11 + compiler/rustc_public/src/abi.rs | 2 + .../src/unstable/convert/stable/abi.rs | 1 + compiler/rustc_span/src/symbol.rs | 2 + compiler/rustc_target/src/callconv/mips.rs | 2 +- compiler/rustc_target/src/callconv/mips64.rs | 6 +- compiler/rustc_target/src/callconv/sparc64.rs | 1 + compiler/rustc_target/src/callconv/x86.rs | 11 +- compiler/rustc_target/src/callconv/x86_64.rs | 69 +++- compiler/rustc_ty_utils/src/layout.rs | 25 ++ library/core/src/num/imp/mod.rs | 1 + library/core/src/num/imp/x87_f80.rs | 36 ++ library/stdarch/crates/core_arch/src/lib.rs | 1 + .../stdarch/crates/core_arch/src/x86/mod.rs | 73 +++++ tests/assembly-llvm/x87_f80.rs | 171 ++++++++++ tests/auxiliary/minicore.rs | 26 ++ tests/codegen-llvm/x86-abi/x87_f80.rs | 308 ++++++++++++++++++ 33 files changed, 820 insertions(+), 27 deletions(-) create mode 100644 library/core/src/num/imp/x87_f80.rs create mode 100644 tests/assembly-llvm/x87_f80.rs create mode 100644 tests/codegen-llvm/x86-abi/x87_f80.rs diff --git a/compiler/rustc_abi/src/callconv/reg.rs b/compiler/rustc_abi/src/callconv/reg.rs index 5c6715c43caa7..ca614ac168c36 100644 --- a/compiler/rustc_abi/src/callconv/reg.rs +++ b/compiler/rustc_abi/src/callconv/reg.rs @@ -27,9 +27,9 @@ impl RegKind { match primitive { Primitive::Int(..) | Primitive::Pointer(_) => RegKind::Integer, Primitive::Float(Float::PpcF128) => RegKind::PpcF128, - Primitive::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { - RegKind::Float - } + Primitive::Float( + Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::X87F80 | Float::F128, + ) => RegKind::Float, } } } @@ -60,6 +60,7 @@ impl Reg { reg_ctor!(f16, Float, 16); reg_ctor!(f32, Float, 32); reg_ctor!(f64, Float, 64); + reg_ctor!(x87_f80, Float, 80); reg_ctor!(f128, Float, 128); /// A vector of the given size with an unknown (and irrelevant) element type. @@ -86,6 +87,10 @@ impl Reg { 16 => dl.f16_align, 32 => dl.f32_align, 64 => dl.f64_align, + // This alignment is not a multiple of 80 bits, but the alignment + // here is only used to align the alloca of a cast, and there the + // full alignment of x87_f80 should be used. + 80 => dl.x87_f80_align, 128 => dl.f128_align, _ => panic!("unsupported float: {self:?}"), }, diff --git a/compiler/rustc_abi/src/layout/ty.rs b/compiler/rustc_abi/src/layout/ty.rs index 64bc32ad7584a..4a8dabbf724df 100644 --- a/compiler/rustc_abi/src/layout/ty.rs +++ b/compiler/rustc_abi/src/layout/ty.rs @@ -122,6 +122,7 @@ pub trait TyAbiInterface<'a, C>: Sized + std::fmt::Debug + std::fmt::Display { fn is_unit(this: TyAndLayout<'a, Self>) -> bool; fn is_transparent(this: TyAndLayout<'a, Self>) -> bool; fn is_complex_number_lang_item(this: TyAndLayout<'a, Self>, cx: &C) -> bool; + fn is_x87_f80_lang_item(this: TyAndLayout<'a, Self>, cx: &C) -> bool; fn is_scalable_vector(this: TyAndLayout<'a, Self>) -> bool; /// See [`TyAndLayout::pass_indirectly_in_non_rustic_abis`] for details. fn is_pass_indirectly_in_non_rustic_abis_flag_set(this: TyAndLayout<'a, Self>) -> bool; @@ -232,6 +233,17 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { Ty::is_scalable_vector(self) } + /// Returns `true` if this type is the `x87_f80` lang item. + /// + /// Note that this function returns `false` for the `x87_f80_raw` lang item. + pub fn is_x87_f80(self, cx: &C) -> bool + where + Ty: TyAbiInterface<'a, C> + Copy, + { + // A 1-ZST is never x87_f80. + Ty::is_x87_f80_lang_item(self.peel_transparent_wrappers_from_non_1zst(cx), cx) + } + /// If this method returns `true`, then this type should always have a `PassMode` of /// `Indirect { mode: IndirectMode::Pointer, .. }` when being used as the argument type of a /// function with a non-Rustic ABI (this is true for structs annotated with the @@ -339,6 +351,10 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { let component = complex.field(cx, 0).peel_transparent_wrappers_from_non_1zst(cx); + if component.is_x87_f80(cx) { + return Some(Numeric::Float(Float::X87F80)); + } + let BackendRepr::Scalar(scalar) = component.backend_repr else { return None; }; @@ -353,6 +369,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { Primitive::Float( float @ (Float::F16 | Float::F32 | Float::F64 | Float::F128 | Float::PpcF128), ) => Some(Numeric::Float(float)), + Primitive::Float(Float::X87F80) => None, // x87_f80_raw has incorrect alignment. Primitive::Pointer(..) | Primitive::Float(Float::F16B) => None, } } diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e9f24e0feb82..1a88afe3782f2 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -327,6 +327,7 @@ pub struct TargetDataLayout { pub f16_align: Align, pub f32_align: Align, pub f64_align: Align, + pub x87_f80_align: Align, pub f128_align: Align, pub aggregate_align: Align, @@ -367,6 +368,7 @@ impl Default for TargetDataLayout { f16_align: align(16), f32_align: align(32), f64_align: align(64), + x87_f80_align: align(128), f128_align: align(128), aggregate_align: align(8), vector_align: vec![ @@ -510,6 +512,7 @@ impl TargetDataLayout { ["f16", a @ ..] => dl.f16_align = parse_align_seq(a, "f16")?, ["f32", a @ ..] => dl.f32_align = parse_align_seq(a, "f32")?, ["f64", a @ ..] => dl.f64_align = parse_align_seq(a, "f64")?, + ["f80", a @ ..] => dl.x87_f80_align = parse_align_seq(a, "f80")?, ["f128", a @ ..] => dl.f128_align = parse_align_seq(a, "f128")?, [p, s, a @ ..] if p.starts_with("p") => { let mut p = p.strip_prefix('p').unwrap(); @@ -1387,10 +1390,22 @@ pub enum Float { F16B, F32, F64, + /// `x87_f80`. This is not a builtin type in Rust (it is exposed as a lang item), + /// but it is a builtin type in LLVM so needs to be explicitly represented + /// in the backend. + /// + /// Here we define the 80-bit scalar value that corresponds to the `x87_f80_raw` lang item. + /// In `core::arch::{x86, x86_64}` this type is wrapped by the `x87_f80` lang item that adds + /// the proper alignment and bumps the size to either 12 or 16 bytes depending on the target. + /// + /// Only used on x86 and x86_64 targets. + X87F80, F128, /// `ppcf128`. This is not a builtin type in Rust (it is exposed as a lang item), /// but it is a builtin type in LLVM so needs to be explicitly represented /// in the backend. + /// + /// Only used on powerpc and powerpc64 targets. PpcF128, } @@ -1403,6 +1418,7 @@ impl Float { F16B => Size::from_bits(16), F32 => Size::from_bits(32), F64 => Size::from_bits(64), + X87F80 => Size::from_bits(80), F128 => Size::from_bits(128), PpcF128 => Size::from_bits(128), } @@ -1416,6 +1432,9 @@ impl Float { F16 | F16B => dl.f16_align, F32 => dl.f32_align, F64 => dl.f64_align, + // Use an alignment of 1 for x87_f80_raw, + // so that its size really is 80 bits in memory. + X87F80 => Align::ONE, F128 => dl.f128_align, PpcF128 => dl.f128_align, } @@ -1429,6 +1448,7 @@ impl Float { F16B => "f16b", F32 => "f32", F64 => "f64", + X87F80 => "x87_f80", F128 => "f128", PpcF128 => "ppcf128", } @@ -1439,7 +1459,7 @@ impl Float { match self { F16 | F32 | F64 | F128 => true, - F16B | PpcF128 => false, + F16B | X87F80 | PpcF128 => false, } } } @@ -1465,9 +1485,9 @@ impl Numeric { match self { Numeric::Int(_, _) => RegKind::Integer, Numeric::Float(Float::PpcF128) => RegKind::PpcF128, - Numeric::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { - RegKind::Float - } + Numeric::Float( + Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::X87F80 | Float::F128, + ) => RegKind::Float, } } } diff --git a/compiler/rustc_attr_ir/src/lang_items.rs b/compiler/rustc_attr_ir/src/lang_items.rs index b576c5038404d..a09b0266f04ea 100644 --- a/compiler/rustc_attr_ir/src/lang_items.rs +++ b/compiler/rustc_attr_ir/src/lang_items.rs @@ -240,6 +240,8 @@ language_item_table! { Complex, sym::complex, complex, Target::Struct, GenericRequirement::Exact(1); PpcF128, sym::ppcf128, ppcf128, Target::Struct, GenericRequirement::None; + X87F80, sym::x87_f80, x87_f80, Target::Struct, GenericRequirement::None; + X87F80Raw, sym::x87_f80_raw, x87_f80_raw, Target::Struct, GenericRequirement::None; Deref, kw::Deref, deref_trait, Target::Trait, GenericRequirement::Exact(0); DerefMut, sym::deref_mut, deref_mut_trait, Target::Trait, GenericRequirement::Exact(0); diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index d59fb0f93ed4f..dcd367a4ba97a 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -38,6 +38,7 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type { Float::F16B => bug!("f16b is not supported by the Cranelift codegen backend"), Float::F32 => types::F32, Float::F64 => types::F64, + Float::X87F80 => bug!("cranelift does not support x87 floats"), Float::F128 => types::F128, Float::PpcF128 => bug!("cranelift does not support powerpc"), }, diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 1f7436ff87853..531ff0da6922b 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -872,7 +872,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { ); return self.context.new_call(self.location, fmodf128, &[a, b]); } - Some(float @ (abi::Float::F16B | abi::Float::PpcF128)) => { + Some(float @ (abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128)) => { bug!("frem unsupported on {float:?}") } None => (), @@ -2022,7 +2022,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { abi::Float::F32 => bx.cx().const_u32(bits as u32), abi::Float::F64 => bx.cx().const_u64(bits as u64), abi::Float::F128 => bx.cx().const_u128(bits), - abi::Float::F16B | abi::Float::PpcF128 => { + abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128 => { bug!("unsupported float width {float_type:?}") } }; @@ -2033,7 +2033,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { abi::Float::F32 => compute_clamp_bounds::(signed, int_width), abi::Float::F64 => compute_clamp_bounds::(signed, int_width), abi::Float::F128 => compute_clamp_bounds::(signed, int_width), - abi::Float::F16B | abi::Float::PpcF128 => { + abi::Float::F16B | abi::Float::X87F80 | abi::Float::PpcF128 => { bug!("unsupported float width {float_type:?}") } }; diff --git a/compiler/rustc_codegen_gcc/src/int.rs b/compiler/rustc_codegen_gcc/src/int.rs index 097c248c70baa..bef1af78c6a7a 100644 --- a/compiler/rustc_codegen_gcc/src/int.rs +++ b/compiler/rustc_codegen_gcc/src/int.rs @@ -986,7 +986,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { Some(Float::F32) => "tisf", Some(Float::F64) => "tidf", Some(Float::F128) => "titf", - None | Some(Float::F16B | Float::PpcF128) => { + None | Some(Float::F16B | Float::X87F80 | Float::PpcF128) => { panic!("cannot cast a non-native integer to type {dest_typ:?}") } }; @@ -1037,7 +1037,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { Some(Float::F16 | Float::F32) => "sfti", Some(Float::F64) => "dfti", Some(Float::F128) => "tfti", - None | Some(Float::F16B | Float::PpcF128) => { + None | Some(Float::F16B | Float::X87F80 | Float::PpcF128) => { bug!("cannot cast a {value_type:?} to non-native integer") } }; diff --git a/compiler/rustc_codegen_gcc/src/type_.rs b/compiler/rustc_codegen_gcc/src/type_.rs index 6d815b9111600..bdebc9f467f56 100644 --- a/compiler/rustc_codegen_gcc/src/type_.rs +++ b/compiler/rustc_codegen_gcc/src/type_.rs @@ -304,6 +304,12 @@ impl<'gcc, 'tcx> BaseTypeCodegenMethods for CodegenCx<'gcc, 'tcx> { bug!("unsupported ppcf128 type") } + fn type_x87_f80(&self) -> Type<'gcc> { + // FIXME(x87_f80): The GCC gcc_jit_types enum (which CType is based on) does not + // have __float80. It does have long double but it may not correspond to x87 f80. + bug!("unsupported x87_f80 type") + } + fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> { self.context.new_function_pointer_type(None, return_type, params, false) } diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 6270ce19a69b5..42ec3fbbce657 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -144,6 +144,7 @@ impl LlvmType for Reg { 16 => cx.type_f16(), 32 => cx.type_f32(), 64 => cx.type_f64(), + 80 => cx.type_x87_f80(), 128 => cx.type_f128(), _ => bug!("unsupported float: {:?}", self), }, @@ -167,6 +168,7 @@ impl LlvmType for Reg { Float::F64 => cx.type_f64(), Float::F128 => cx.type_f128(), Float::PpcF128 => bug!("ppcf128 is not a valid vector element type"), + Float::X87F80 => bug!("x87_f80 is not a valid vector element type"), }, Primitive::Pointer(_) => cx.type_ptr(), }; diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 23065419f9f1d..7d22ca1290164 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -301,6 +301,10 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { Primitive::Float(Float::PpcF128) => { // Supported on powerpc and powerpc64 targets. } + Primitive::Float(Float::X87F80) => { + // FIXME(x87_f80) we should support this. + bug!("the va_arg intrinsic does not currently support `x87_f80`") + } } emit_va_arg(self, args[0], result_layout) diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 08a63c5b48bd7..a40334af68102 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -951,6 +951,7 @@ unsafe extern "C" { // Operations on non-IEEE real types pub(crate) fn LLVMBFloatTypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; + pub(crate) fn LLVMX86FP80TypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; pub(crate) fn LLVMPPCFP128TypeInContext<'ll>(C: Context<'ll>) -> Type<'ll>; // Operations on function types diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index dc36ef2b1536a..55c546538611b 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -229,6 +229,10 @@ impl<'ll, CX: Borrow>> BaseTypeCodegenMethods for GenericCx<'ll, CX> { unsafe { llvm::LLVMPPCFP128TypeInContext(self.llcx()) } } + fn type_x87_f80(&self) -> Type<'ll> { + unsafe { llvm::LLVMX86FP80TypeInContext(self.llcx()) } + } + fn type_func(&self, args: &[Type<'ll>], ret: Type<'ll>) -> Type<'ll> { unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, FALSE) } } diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index b003c322640dd..509415baf7619 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -1,7 +1,7 @@ use std::fmt::Write; use rustc_abi::Primitive::{Float, Int, Pointer}; -use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, Variants}; +use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, TyAbiInterface, Variants}; use rustc_codegen_ssa::traits::*; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; @@ -46,6 +46,11 @@ fn uncached_llvm_type<'ll, 'tcx>( BackendRepr::Memory { .. } | BackendRepr::ScalarPair { .. } => {} } + // Map `core::arch::{x86, x86_64}::x87_f80` to LLVM's `x86_fp80`. + if Ty::is_x87_f80_lang_item(layout, cx) { + return cx.type_x87_f80(); + } + let name = match layout.ty.kind() { // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). diff --git a/compiler/rustc_codegen_llvm/src/va_arg.rs b/compiler/rustc_codegen_llvm/src/va_arg.rs index bef94359fa2e5..7c2c20c2671e4 100644 --- a/compiler/rustc_codegen_llvm/src/va_arg.rs +++ b/compiler/rustc_codegen_llvm/src/va_arg.rs @@ -95,7 +95,7 @@ fn get_param_type_alignment<'ll, 'tcx>( Integer::I128 => return Align::EIGHT, }, Primitive::Float(float) => match float { - Float::F16 | Float::F16B | Float::F32 => unreachable!(), + Float::F16 | Float::F16B | Float::F32 | Float::X87F80 => unreachable!(), Float::F64 | Float::F128 => { /* fall through */ } Float::PpcF128 => { return if is_powerpc_softfloat_abi(&bx.cx.tcx.sess.target) { @@ -494,6 +494,9 @@ fn emit_s390x_va_arg<'ll, 'tcx>( Primitive::Float(Float::PpcF128) => { bug!("`ppcf128` use in varadics unsupported on s390x") } + Primitive::Float(Float::X87F80) => { + bug!("`x87_f80` use in varadics unsupported on s390x") + } }, _ => false, diff --git a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs index 691d573739364..06d385998a9dd 100644 --- a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs +++ b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs @@ -514,6 +514,7 @@ fn wasm_primitive(primitive: Primitive, ptr_type: &'static str) -> &'static str Float::F16B => bug!("`f16b` unsupported on wasm"), Float::F16 | Float::F32 => "f32", Float::F64 => "f64", + Float::X87F80 => bug!("`x87_f80` unsupported on wasm"), Float::F128 => "i64, i64", Float::PpcF128 => bug!("`ppcf128` unsupported on wasm"), }, diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index 549a58cd74ec5..c4e52fcd2c0ba 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -22,6 +22,7 @@ pub trait BaseTypeCodegenMethods: BackendTypes { fn type_f64(&self) -> Self::Type; fn type_f128(&self) -> Self::Type; fn type_ppcf128(&self) -> Self::Type; + fn type_x87_f80(&self) -> Self::Type; fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::FunctionSignature; fn type_ptr(&self) -> Self::Type; @@ -79,6 +80,7 @@ pub trait DerivedTypeCodegenMethods<'tcx>: F16B => self.type_f16b(), F32 => self.type_f32(), F64 => self.type_f64(), + X87F80 => self.type_x87_f80(), F128 => self.type_f128(), PpcF128 => self.type_ppcf128(), } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index ce1c36c5468a8..80bfbb5b551e0 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -144,6 +144,11 @@ impl abi::Float { ), F32 => tcx.types.f32, F64 => tcx.types.f64, + X87F80 => Ty::new_adt( + tcx, + tcx.adt_def(tcx.require_lang_item(LangItem::X87F80Raw, DUMMY_SP)), + ty::GenericArgs::empty(), + ), F128 => tcx.types.f128, PpcF128 => Ty::new_adt( tcx, @@ -1255,6 +1260,12 @@ where cx.tcx().is_lang_item(def.did(), LangItem::Complex) } + /// Is this type `core::arch::{x86, x86_64}::x87_f80`? + fn is_x87_f80_lang_item(this: TyAndLayout<'tcx>, cx: &C) -> bool { + let Some(def) = this.ty.ty_adt_def() else { return false }; + cx.tcx().is_lang_item(def.did(), LangItem::X87F80) + } + fn is_scalable_vector(this: TyAndLayout<'tcx>) -> bool { this.ty.is_scalable_vector() } diff --git a/compiler/rustc_public/src/abi.rs b/compiler/rustc_public/src/abi.rs index 70d48c3782b7d..d98c12d0fe9f9 100644 --- a/compiler/rustc_public/src/abi.rs +++ b/compiler/rustc_public/src/abi.rs @@ -538,6 +538,7 @@ pub enum FloatLength { F16B, F32, F64, + X87F80, F128, PpcF128, } @@ -560,6 +561,7 @@ impl FloatLength { FloatLength::F16 | FloatLength::F16B => 16, FloatLength::F32 => 32, FloatLength::F64 => 64, + FloatLength::X87F80 => 80, FloatLength::F128 => 128, FloatLength::PpcF128 => 128, } diff --git a/compiler/rustc_public/src/unstable/convert/stable/abi.rs b/compiler/rustc_public/src/unstable/convert/stable/abi.rs index 48489f5bbde96..93c9cc4aa38b1 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/abi.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/abi.rs @@ -510,6 +510,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Float { rustc_abi::Float::F16B => FloatLength::F16B, rustc_abi::Float::F32 => FloatLength::F32, rustc_abi::Float::F64 => FloatLength::F64, + rustc_abi::Float::X87F80 => FloatLength::X87F80, rustc_abi::Float::F128 => FloatLength::F128, rustc_abi::Float::PpcF128 => FloatLength::PpcF128, } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 2170f610f0939..b9d5cb2af6c33 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2441,6 +2441,8 @@ symbols! { x86, x86_64, x86_amx_intrinsics, + x87_f80, + x87_f80_raw, x87_reg, x87_target_feature, xcoff, diff --git a/compiler/rustc_target/src/callconv/mips.rs b/compiler/rustc_target/src/callconv/mips.rs index 720d17d5dbf99..28ea8bd23163c 100644 --- a/compiler/rustc_target/src/callconv/mips.rs +++ b/compiler/rustc_target/src/callconv/mips.rs @@ -17,7 +17,7 @@ where Numeric::Int(Integer::I128, _) => false, Numeric::Float(Float::F32 | Float::F64) => true, Numeric::Float(Float::F16 | Float::F128) => false, - Numeric::Float(Float::F16B | Float::PpcF128) => bug!("unsupported on mips"), + Numeric::Float(Float::F16B | Float::X87F80 | Float::PpcF128) => bug!("unsupported on mips"), }; if let Some(component) = ret.layout.complex_number(cx) diff --git a/compiler/rustc_target/src/callconv/mips64.rs b/compiler/rustc_target/src/callconv/mips64.rs index 8c141bc7de616..1ef6403532232 100644 --- a/compiler/rustc_target/src/callconv/mips64.rs +++ b/compiler/rustc_target/src/callconv/mips64.rs @@ -36,6 +36,7 @@ where Float::F64 => Some(Reg::f64()), Float::F128 => Some(Reg::f128()), Float::F16B => unreachable!("`f16b` unsupported on mips64"), + Float::X87F80 => unreachable!("`x87_f80` unsupported on mips64"), Float::PpcF128 => unreachable!("`ppcf128` unsupported on mips64"), } } @@ -142,8 +143,9 @@ where match component { Numeric::Float(Float::F16B) => unreachable!("Complex is not C-compatible"), - Numeric::Float(Float::F16) => unreachable!("not supported on mips64"), - Numeric::Float(Float::PpcF128) => unreachable!("not supported on mips64"), + Numeric::Float(Float::F16 | Float::X87F80 | Float::PpcF128) => { + unreachable!("not supported on mips64") + } Numeric::Float(Float::F32 | Float::F64) => { // Only pass a Complex/Complex in FPRs when two argument slots are free. if curr_offset.bytes() / slot.bytes() + 2 <= NUM_ARG_SLOTS { diff --git a/compiler/rustc_target/src/callconv/sparc64.rs b/compiler/rustc_target/src/callconv/sparc64.rs index 00b9ef25e9fbc..0ef57cf54e449 100644 --- a/compiler/rustc_target/src/callconv/sparc64.rs +++ b/compiler/rustc_target/src/callconv/sparc64.rs @@ -59,6 +59,7 @@ fn classify<'a, Ty, C>( // Match LLVM by passing `f16` in integer registers. } Float::F16B => unreachable!("`f16b` unsupported on sparc64"), + Float::X87F80 => unreachable!("`x87_f80` unsupported on sparc64"), Float::PpcF128 => unreachable!("`ppcf128` unsupported on sparc64"), } } else { diff --git a/compiler/rustc_target/src/callconv/x86.rs b/compiler/rustc_target/src/callconv/x86.rs index d19f3f0db715b..e458458fbf256 100644 --- a/compiler/rustc_target/src/callconv/x86.rs +++ b/compiler/rustc_target/src/callconv/x86.rs @@ -55,6 +55,10 @@ where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, { + if ret.layout.is_x87_f80(cx) { + ret.cast_to(Reg::x87_f80()); + return; + } if ret.layout.is_aggregate() && ret.layout.is_sized() { // Returning a structure. Most often, this will use // a hidden first argument. On some platforms, though, @@ -107,7 +111,11 @@ where let align_4 = Align::from_bytes(4).unwrap(); let align_16 = Align::from_bytes(16).unwrap(); - if arg.layout.is_aggregate() { + if arg.layout.is_x87_f80(cx) { + // This branch and cast are not technically required, but it makes the IR more readable. + arg.cast_to(Reg::x87_f80()); + return; + } else if arg.layout.is_aggregate() { // We need to compute the alignment of the `byval` argument. The rules can be found in // `X86_32ABIInfo::getTypeStackAlignInBytes` in Clang's `TargetInfo.cpp`. Summarized // here, they are: @@ -232,6 +240,7 @@ pub(crate) fn fill_inregs<'a, Ty, C>( PassMode::Ignore | PassMode::Indirect { attrs: _, address_space: _, mode: _ } => { continue; } + PassMode::Cast { .. } if arg.layout.is_x87_f80(cx) => continue, PassMode::Direct(ref mut attrs) => attrs, PassMode::Pair(..) | PassMode::IndirectUnsized { attrs: _, meta_attrs: _ } diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index e495afc803b2d..5439d24a573fb 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -2,7 +2,7 @@ // https://github.com/jckarter/clay/blob/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/compiler/externals.cpp use rustc_abi::{ - BackendRepr, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface, TyAndLayout, + BackendRepr, Float, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface, TyAndLayout, Variants, }; @@ -10,13 +10,34 @@ use crate::callconv::{ArgAbi, CastTarget, FnAbi}; use crate::spec::HasTargetSpec; /// Classification of "eightbyte" components. -// N.B., the order of the variants is from general to specific, -// such that `unify(a, b)` is the "smaller" of `a` and `b`. +/// +/// N.B., the order of the variants is from general to specific, +/// such that `merge(a, b)` is the "smaller" of `a` and `b`, unless it is an error. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] enum Class { Int, Sse, SseUp, + X87, + X87Up, +} + +impl Class { + fn upper_half(self) -> Class { + match self { + Class::Sse | Class::SseUp => Class::SseUp, + Class::X87 | Class::X87Up => Class::X87Up, + Class::Int => Class::Int, + } + } + + fn merge(self, other: Self) -> Result { + match (self, other) { + (Class::X87 | Class::X87Up, Class::Sse | Class::SseUp) => Err(Memory), + (Class::Sse | Class::SseUp, Class::X87 | Class::X87Up) => Err(Memory), + _ => Ok(Ord::min(self, other)), + } + } } #[derive(Clone, Copy, Debug)] @@ -54,6 +75,7 @@ where let mut c = match layout.backend_repr { BackendRepr::Scalar(scalar) => match scalar.primitive() { Primitive::Int(..) | Primitive::Pointer(_) => Class::Int, + Primitive::Float(Float::X87F80) => Class::X87, Primitive::Float(_) => Class::Sse, }, @@ -85,13 +107,13 @@ where let first = (off.bytes() / 8) as usize; let last = ((off.bytes() + layout.size.bytes() - 1) / 8) as usize; for cls in &mut cls[first..=last] { - *cls = Some(cls.map_or(c, |old| old.min(c))); + *cls = match cls { + Some(old) => Some(Class::merge(*old, c)?), + None => Some(c), + }; - // Everything after the first Sse "eightbyte" - // component is the upper half of a register. - if c == Class::Sse { - c = Class::SseUp; - } + // Everything after the first "eightbyte" component is the upper half of a register. + c = c.upper_half(); } Ok(()) @@ -127,6 +149,17 @@ where } } + // If X87UP is not preceded by X87, the whole argument is passed in memory. + if let [Some(Class::X87Up), ..] = cls { + return Err(Memory); + } + + for [prev, curr] in cls[..n].array_windows() { + if *curr == Some(Class::X87Up) && *prev != Some(Class::X87) { + return Err(Memory); + } + } + Ok(cls) } @@ -153,6 +186,13 @@ fn reg_component(cls: &[Option], i: &mut usize, size: Size) -> Option { + let consumed = + 1 + cls[*i + 1..].iter().take_while(|&&c| c == Some(Class::X87Up)).count(); + assert_eq!(consumed, 2); + *i += consumed; + Some(Reg::x87_f80()) + } c => unreachable!("reg_component: unhandled class {:?}", c), } } @@ -193,10 +233,21 @@ where arg.make_indirect(); return; } + if is_arg && arg.layout.is_x87_f80(cx) { + // This branch and cast are not technically required, but it makes the IR more readable. + arg.cast_to(Reg::x87_f80()); + return; + } let mut cls_or_mem = classify_arg(cx, arg); if is_arg { if let Ok(cls) = cls_or_mem { + // An argument of class X87 is passed in memory. + if cls.contains(&Some(Class::X87)) { + std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); + cls_or_mem = Err(Memory); + } + let mut needed_int = 0; let mut needed_sse = 0; for c in cls { diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 926314b2c5cf7..6404a062f2731 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -25,6 +25,7 @@ use rustc_middle::ty::{ use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo}; use rustc_span::{Symbol, bug, sym}; use rustc_structures::Limit; +use rustc_target::spec::{Arch, HasTargetSpec}; use tracing::{debug, instrument}; use crate::diagnostics::NonPrimitiveSimdType; @@ -823,13 +824,37 @@ fn layout_of_uncached<'tcx>( layout.backend_repr = BackendRepr::Scalar(bfloat); } + let arch = &tcx.target_spec().arch; + if tcx.is_lang_item(def.did(), LangItem::PpcF128) { + std::assert_matches!(arch, Arch::PowerPC | Arch::PowerPC64); + let ppcf128 = scalar_unit(Primitive::Float(abi::Float::PpcF128)); assert_eq!(layout.size, abi::Float::PpcF128.size()); layout.align = abi::Float::PpcF128.align(cx); layout.backend_repr = BackendRepr::Scalar(ppcf128); } + if tcx.is_lang_item(def.did(), LangItem::X87F80Raw) { + std::assert_matches!(arch, Arch::X86 | Arch::X86_64); + + // The lang item has no fields: give it a scalar layout. + return Ok(scalar(Primitive::Float(abi::Float::X87F80))); + } + + if tcx.is_lang_item(def.did(), LangItem::X87F80) { + std::assert_matches!(arch, Arch::X86 | Arch::X86_64); + + // A wrapper around `x87_f80_raw` that adds the target-specific alignment. + // It is an ordinary aggregate with trailing padding. + assert_eq!(layout.size, abi::Float::X87F80.size()); + layout.align = cx.data_layout().x87_f80_align; + layout.unadjusted_abi_align = layout.align; + layout.size = layout.size.align_to(layout.align); + layout.backend_repr = BackendRepr::Memory { sized: true }; + layout.largest_niche = None; + } + tcx.mk_layout(layout) } diff --git a/library/core/src/num/imp/mod.rs b/library/core/src/num/imp/mod.rs index e04f3cd93ba5f..843a800267ffb 100644 --- a/library/core/src/num/imp/mod.rs +++ b/library/core/src/num/imp/mod.rs @@ -13,6 +13,7 @@ pub mod fmt; // Public for core_arch. pub mod ppcf128; +pub mod x87_f80; pub(crate) mod int_bits; pub(crate) mod int_log10; diff --git a/library/core/src/num/imp/x87_f80.rs b/library/core/src/num/imp/x87_f80.rs new file mode 100644 index 0000000000000..4b9f07d1ba599 --- /dev/null +++ b/library/core/src/num/imp/x87_f80.rs @@ -0,0 +1,36 @@ +/// The raw x87 80-bit extended-precision floating-point type. +/// +/// This type has a size of 80 bits, and corresponds to the store size (what a load/store touches) +/// of x87_f80. This is different to what LLVM calls the alloc size, the number of bytes used to +/// calculate field offsets or the size of an alloca. +/// +/// The `x87_f80` wrapper type below corresponds to the alloc size: it applies the target-specific +/// alignment, raising the total size to 12 or 16. +/// +/// NOTE: this type should not be used anywhere except in the x87_f80 wrapper below. The backend +/// can handle it fine, but callconv calculation will likely panic. +#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), lang = "x87_f80_raw")] +#[allow(non_camel_case_types)] +#[derive(Clone, Copy)] +struct x87_f80_raw {} + +/// The x87 80-bit extended-precision floating-point lang item. +/// +/// Here we define just the lang item, the public-facing type is defined +/// in core_arch. It transparently wraps this definition. +/// +/// This x87_f80 type should only be used on x86 and x86_64 targets, but is always defined +/// for the purpose of doc builds, specifically doc builds in the stdarch repo. +#[doc(hidden)] +#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), lang = "x87_f80")] +#[unstable(feature = "num_internals", issue = "none")] +#[allow(non_camel_case_types, dead_code)] +#[derive(Clone, Copy)] +pub struct x87_f80(x87_f80_raw); + +#[unstable(feature = "num_internals", issue = "none")] +impl crate::fmt::Debug for x87_f80 { + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + f.debug_tuple("x87_f80").finish() + } +} diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs index c7e2d93b886a7..c2357eaab5aa0 100644 --- a/library/stdarch/crates/core_arch/src/lib.rs +++ b/library/stdarch/crates/core_arch/src/lib.rs @@ -46,6 +46,7 @@ any(target_arch = "powerpc", target_arch = "powerpc64"), feature(powerpc_ppcf128) )] +#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(x87_f80))] #![cfg_attr( test, feature( diff --git a/library/stdarch/crates/core_arch/src/x86/mod.rs b/library/stdarch/crates/core_arch/src/x86/mod.rs index e6875a628fbf0..ca5551ca6c1e4 100644 --- a/library/stdarch/crates/core_arch/src/x86/mod.rs +++ b/library/stdarch/crates/core_arch/src/x86/mod.rs @@ -5,6 +5,79 @@ use crate::mem::transmute; #[macro_use] mod macros; +/// The x87 80-bit extended-precision floating-point type. +/// +/// FIXME: extend the documentation. +#[doc(alias = "long double")] +#[doc(alias = "x86_fp80")] +#[doc(alias = "__float80")] +#[unstable(feature = "x87_f80", issue = "163982")] +#[allow(non_camel_case_types)] +#[doc(cfg(any(target_arch = "x86", target_arch = "x86_64")))] +#[derive(Clone, Copy)] +#[repr(transparent)] +pub struct x87_f80(crate::num::imp::x87_f80::x87_f80); + +const _: () = assert!( + size_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 12, + }, + target_arch = "x86_64" => 16, + _ => size_of::(), // for doc builds + } +); + +const _: () = assert!( + align_of::() + == cfg_select! { + target_arch = "x86" => cfg_select! { + target_vendor = "apple" => 16, + target_env = "msvc" => 16, + _ => 4, + }, + target_arch = "x86_64" => 16, + _ => align_of::(), // for doc builds + } +); + +#[unstable(feature = "x87_f80", issue = "163982")] +impl crate::fmt::Debug for x87_f80 { + #[inline] + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + let mut bytes = [0u8; 16]; + bytes[..10].copy_from_slice(&self.to_ne_bytes()); + write!(f, "x87_f80({:#022x})", u128::from_ne_bytes(bytes)) + } +} + +impl x87_f80 { + /// Returns the memory representation of this floating point number as a byte array in + /// native byte order. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn to_ne_bytes(self) -> [u8; 10] { + // SAFETY: the first 10 bytes are initialized. + unsafe { (&raw const self).cast::<[u8; 10]>().read() } + } + + /// Creates a floating point value from its representation as a byte array in native endian. + #[unstable(feature = "x87_f80", issue = "163982")] + #[inline] + pub const fn from_ne_bytes(bytes: [u8; 10]) -> Self { + // SAFETY: we initialize the first 10 bytes, the remaining bytes remain uninitialized. + // That is exactly the layout of x87_f80. + unsafe { + let mut this = crate::mem::MaybeUninit::::uninit(); + this.as_mut_ptr().cast::<[u8; 10]>().write(bytes); + this.assume_init() + } + } +} + types! { #![stable(feature = "simd_x86", since = "1.27.0")] diff --git a/tests/assembly-llvm/x87_f80.rs b/tests/assembly-llvm/x87_f80.rs new file mode 100644 index 0000000000000..356ec2f410201 --- /dev/null +++ b/tests/assembly-llvm/x87_f80.rs @@ -0,0 +1,171 @@ +//@ add-minicore +//@ assembly-output: emit-asm +// +//@ revisions: X86 X86_64 DARWIN WIN64 WIN32 +//@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib +//@ needs-llvm-components: x86 + +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +#[cfg(target_arch = "x86")] +use minicore::arch::x86::x87_f80; +#[cfg(target_arch = "x86_64")] +use minicore::arch::x86_64::x87_f80; + +// CHECK-LABEL: identity +// +// X86: .cfi_startproc +// X86-NEXT: fldt 4(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 8(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 8(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps (%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 8(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn identity(x: x87_f80) -> x87_f80 { + x +} + +// CHECK-LABEL: mixed +// +// X86: .cfi_startproc +// X86-NEXT: fldl 4(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: movsd 8(%rsp), %xmm0 +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldl 8(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movsd (%rcx), %xmm0 +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldl 8(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn mixed(value: Mixed) -> f64 { + value.a +} + +#[repr(C)] +struct Mixed { + a: f64, + b: x87_f80, +} + +// CHECK-LABEL: pair +// +// X86: .cfi_startproc +// X86-NEXT: fldt 16(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 24(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 24(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps 16(%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 20(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn pair(value: Pair) -> x87_f80 { + value.b +} + +#[repr(C)] +struct Pair { + a: x87_f80, + b: x87_f80, +} + +// CHECK-LABEL: quad +// +// X86: .cfi_startproc +// X86-NEXT: fldt 40(%esp) +// X86-NEXT: retl +// +// X86_64: .cfi_startproc +// X86_64-NEXT: fldt 56(%rsp) +// X86_64-NEXT: retq +// +// DARWIN: .cfi_startproc +// DARWIN-NEXT: pushl %ebp +// DARWIN: movl %esp, %ebp +// DARWIN: fldt 56(%ebp) +// DARWIN-NEXT: popl %ebp +// DARWIN-NEXT: retl +// +// WIN64: movq %rcx, %rax +// WIN64-NEXT: movaps 48(%rdx), %xmm0 +// WIN64-NEXT: movaps %xmm0, (%rcx) +// WIN64-NEXT: retq +// +// WIN32: .cfi_startproc +// WIN32-NEXT: pushl %ebp +// WIN32: movl %esp, %ebp +// WIN32: fldt 44(%ebp) +// WIN32-NEXT: popl %ebp +// WIN32-NEXT: retl +#[unsafe(no_mangle)] +pub extern "C" fn quad(value: Quad) -> x87_f80 { + value.d +} + +#[repr(C)] +struct Quad { + a: x87_f80, + b: x87_f80, + c: x87_f80, + d: x87_f80, +} diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index e7e924f9ebc08..3d7a325a5e61c 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -131,6 +131,32 @@ pub mod arch { impl crate::Copy for ppcf128 {} } + + #[cfg(target_arch = "x86")] + pub mod x86 { + // Public in minicore for testing purposes. + #[lang = "x87_f80_raw"] + pub struct x87_f80_raw {} + + #[lang = "x87_f80"] + pub struct x87_f80(x87_f80_raw); + + impl crate::Copy for x87_f80_raw {} + impl crate::Copy for x87_f80 {} + } + + #[cfg(target_arch = "x86_64")] + pub mod x86_64 { + // Public in minicore for testing purposes. + #[lang = "x87_f80_raw"] + pub struct x87_f80_raw {} + + #[lang = "x87_f80"] + pub struct x87_f80(x87_f80_raw); + + impl crate::Copy for x87_f80_raw {} + impl crate::Copy for x87_f80 {} + } } #[lang = "phantom_data"] diff --git a/tests/codegen-llvm/x86-abi/x87_f80.rs b/tests/codegen-llvm/x86-abi/x87_f80.rs new file mode 100644 index 0000000000000..ace21aa6e7ad3 --- /dev/null +++ b/tests/codegen-llvm/x86-abi/x87_f80.rs @@ -0,0 +1,308 @@ +//@ add-minicore +// +//@ revisions: X86 X86_64 DARWIN WIN64 WIN32 +//@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib -Zmerge-functions=disabled +//@ needs-llvm-components: x86 + +#![feature(no_core)] +#![no_std] +#![no_core] +#![allow(non_camel_case_types)] + +extern crate minicore; +#[cfg(target_arch = "x86")] +use minicore::arch::x86::{x87_f80, x87_f80_raw}; +#[cfg(target_arch = "x86_64")] +use minicore::arch::x86_64::{x87_f80, x87_f80_raw}; +use minicore::simd::f64x2; +use minicore::{Copy, MaybeUninit, mem}; + +// CHECK-LABEL: size_of_raw_array +#[unsafe(no_mangle)] +pub fn size_of_raw_array() -> usize { + // CHECK: ret {{i32|i64}} 20 + const { mem::size_of::<[x87_f80_raw; 2]>() } +} + +// CHECK-LABEL: raw_array_stride +// CHECK-SAME: dereferenceable(20) +#[unsafe(no_mangle)] +pub fn raw_array_stride(arr: &[x87_f80_raw; 2]) -> x87_f80_raw { + // CHECK: getelementptr inbounds nuw i8, ptr %arr, {{i32|i64}} 10 + let [_, b] = *arr; + b +} + +#[repr(C)] +struct Single { + a: x87_f80, +} + +#[repr(C)] +struct Pair { + a: x87_f80, + b: x87_f80, +} + +#[repr(C)] +struct Mixed { + a: f64, + b: x87_f80, +} + +// X86-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @scalar_second(ptr {{.*}}sret([16 x i8]) {{.*}}, ptr {{.*}}, ptr {{.*}}) +// WIN32-LABEL: x86_fp80 @scalar_second(x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn scalar_second(_a: x87_f80, b: x87_f80) -> x87_f80 { + b +} + +// X86-LABEL: void @single(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: x86_fp80 @single(ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @single(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @single(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @single(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn single(x: Single) -> Single { + x +} + +// X86-LABEL: void @pair(ptr {{.*}}sret([24 x i8]) align 4 {{.*}}, ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}byval([32 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}byval([32 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @pair(ptr {{.*}}sret([32 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @pair(ptr {{.*}}sret([24 x i8]) align 4 {{.*}}, ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn pair(x: Pair) -> Pair { + x +} + +// Projecting an x87_f80 out of an aggregate used to ICE, because code asserted that +// a field has the same size as the scalar it contains. +// +// CHECK: @pair_first( +#[unsafe(no_mangle)] +fn pair_first(x: Pair) -> x87_f80 { + x.a +} + +// CHECK: @pair_second( +#[unsafe(no_mangle)] +fn pair_second(x: Pair) -> x87_f80 { + x.b +} + +// X86-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([20 x i8]) align 4 {{.*}}) +// X86_64-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([32 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([32 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @mixed(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: x86_fp80 @mixed(ptr {{.*}}byval([24 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn mixed(x: Mixed) -> x87_f80 { + x.b +} + +// X86-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @many(ptr {{.*}}sret([16 x i8]) {{.*}} +// WIN32-LABEL: x86_fp80 @many(x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 %{{[0-9]+}}, x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn many( + _a: x87_f80, + _b: x87_f80, + _c: x87_f80, + _d: x87_f80, + _e: x87_f80, + _f: x87_f80, + _g: x87_f80, + _h: x87_f80, + i: x87_f80, +) -> x87_f80 { + i +} + +/// Unions test the overlapping of X87 with SSE/INTEGER register classes. +/// +/// The ABI logic processes the fields in lexicographical order, so check +/// both the x87_f80 coming first and coming last. +#[repr(C)] +union X87Before { + a: x87_f80, + b: T, +} + +#[repr(C)] +union X87After { + b: T, + a: x87_f80, +} + +// X86-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @union_x87_with_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn union_x87_with_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([12 x i8]) align 4 {{.*}}, ptr {{.*}}byval([12 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @union_x87_with_u64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn union_x87_with_u64(x: X87Before) -> X87Before { + x +} + +#[repr(C)] +struct F64F64(f64, f64); +impl Copy for F64F64 {} + +// X86-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_f64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_f64_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_f64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_f64_f64(x: X87After) -> X87After { + x +} + +#[repr(C)] +struct U64F64(u64, f64); +impl Copy for U64F64 {} + +// X86-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_u64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_u64_f64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_u64_f64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_u64_f64(x: X87After) -> X87After { + x +} + +#[repr(C)] +struct U64U64(u64, u64); +impl Copy for U64U64 {} + +// X86-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 4 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: { i64, i64 } @x87_before_u64_u64({ i64, i64 } {{.*}}) +// DARWIN-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// WIN64-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_u64_u64(ptr {{.*}}sret([16 x i8]) align 8 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_u64_u64(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// WIN64-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_before_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_before_f64x2(x: X87Before) -> X87Before { + x +} + +// X86-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +// X86_64-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// DARWIN-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 16 {{.*}}) +// WIN64-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}) +// WIN32-LABEL: void @x87_after_f64x2(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}byval([16 x i8]) align 4 {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn x87_after_f64x2(x: X87After) -> X87After { + x +} + +// X86-LABEL: x86_fp80 @array_third( +// X86: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 24 +// X86-NEXT: load x86_fp80, ptr {{.*}}, align 4 +// +// X86_64-LABEL: x86_fp80 @array_third( +// X86_64: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i64 32 +// X86_64-NEXT: load x86_fp80, ptr {{.*}}, align 16 +// +// DARWIN-LABEL: x86_fp80 @array_third( +// DARWIN: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 32 +// DARWIN-NEXT: load x86_fp80, ptr {{.*}}, align 16 +// +// WIN64-LABEL: void @array_third(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}%xs) +// WIN64: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i64 32 +// WIN64-NEXT: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 16, i1 false) +// +// WIN32-LABEL: x86_fp80 @array_third( +// WIN32: getelementptr inbounds{{( nuw)?}} i8, ptr %xs, i32 24 +// WIN32-NEXT: load x86_fp80, ptr {{.*}}, align 4 +#[unsafe(no_mangle)] +extern "C" fn array_third(xs: &[x87_f80; 4]) -> x87_f80 { + let [_, _, c, _] = *xs; + c +} + +// CHECK-LABEL: @array_copy( +// X86: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 48, i1 false) +// X86_64: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 64, i1 false) +// DARWIN: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 64, i1 false) +// WIN64: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i64 64, i1 false) +// WIN32: call void @llvm.memcpy{{.*}}(ptr {{.*}}, ptr {{.*}}, i32 48, i1 false) +#[unsafe(no_mangle)] +fn array_copy(xs: &[x87_f80; 4], ys: &mut [x87_f80; 4]) { + *ys = *xs; +} + +#[repr(transparent)] +struct TransparentWrapper(T); + +// X86-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @transparent_struct(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}) +// WIN32-LABEL: x86_fp80 @transparent_struct(x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn transparent_struct(x: TransparentWrapper) -> TransparentWrapper { + x +} + +// X86-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// X86_64-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// DARWIN-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +// WIN64-LABEL: void @transparent_union(ptr {{.*}}sret([16 x i8]) align 16 {{.*}}, ptr {{.*}}align 16 {{.*}}) +// WIN32-LABEL: x86_fp80 @transparent_union(x86_fp80 returned %{{[0-9]+}}) +#[unsafe(no_mangle)] +extern "C" fn transparent_union(x: MaybeUninit) -> MaybeUninit { + x +} From 9da70e9cef701affbfcf09e250aad2020c2b62c2 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 2 Nov 2026 01:00:35 +0100 Subject: [PATCH 15/38] rename `Reg::align` and `Uniform::align` to `scratch_align` --- compiler/rustc_abi/src/callconv/reg.rs | 3 ++- compiler/rustc_target/src/callconv/mod.rs | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_abi/src/callconv/reg.rs b/compiler/rustc_abi/src/callconv/reg.rs index ca614ac168c36..dda7a45f9c2b7 100644 --- a/compiler/rustc_abi/src/callconv/reg.rs +++ b/compiler/rustc_abi/src/callconv/reg.rs @@ -71,7 +71,8 @@ impl Reg { } impl Reg { - pub fn align(&self, cx: &C) -> Align { + /// Alignment used for the scratch space when this type is part of a `PassMode::Cast`. + pub fn scratch_align(&self, cx: &C) -> Align { let dl = cx.data_layout(); match self.kind { RegKind::Integer => match self.size.bits() { diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs index 5dbee88b12f27..52a38f55b1fb3 100644 --- a/compiler/rustc_target/src/callconv/mod.rs +++ b/compiler/rustc_target/src/callconv/mod.rs @@ -260,8 +260,9 @@ impl From for Uniform { } impl Uniform { - pub fn align(&self, cx: &C) -> Align { - self.unit.align(cx) + /// Alignment used for the scratch space when this type is part of a `PassMode::Cast`. + pub fn scratch_align(&self, cx: &C) -> Align { + self.unit.scratch_align(cx) } /// Pass using one or more values of the given type, without requiring them to be consecutive. @@ -358,12 +359,10 @@ impl CastTarget { } pub fn align(&self, cx: &C) -> Align { - self.prefix - .iter() - .map(|reg| reg.align(cx)) - .fold(cx.data_layout().aggregate_align.max(self.rest.align(cx)), |acc, align| { - acc.max(align) - }) + self.prefix.iter().map(|reg| reg.scratch_align(cx)).fold( + cx.data_layout().aggregate_align.max(self.rest.scratch_align(cx)), + |acc, align| acc.max(align), + ) } /// Checks if these two `CastTarget` are equal enough to be considered "the same for all From 3592132ab2c7db6d62906ab633f54876495cb057 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 2 Nov 2026 00:51:44 +0100 Subject: [PATCH 16/38] use `type_padding_filler` for `x87_f80_raw` in arrays and structs --- compiler/rustc_codegen_llvm/src/type_of.rs | 30 +++++++++---- compiler/rustc_target/src/callconv/x86_64.rs | 14 +++--- tests/codegen-llvm/x86-abi/x87_f80.rs | 45 ++++++++++++++++++++ 3 files changed, 72 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index 509415baf7619..d914998c75a43 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -1,7 +1,7 @@ use std::fmt::Write; -use rustc_abi::Primitive::{Float, Int, Pointer}; -use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, TyAbiInterface, Variants}; +use rustc_abi::Primitive::{self, Float, Int, Pointer}; +use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, Variants}; use rustc_codegen_ssa::traits::*; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; @@ -46,11 +46,6 @@ fn uncached_llvm_type<'ll, 'tcx>( BackendRepr::Memory { .. } | BackendRepr::ScalarPair { .. } => {} } - // Map `core::arch::{x86, x86_64}::x87_f80` to LLVM's `x86_fp80`. - if Ty::is_x87_f80_lang_item(layout, cx) { - return cx.type_x87_f80(); - } - let name = match layout.ty.kind() { // FIXME(eddyb) producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). @@ -90,7 +85,16 @@ fn uncached_llvm_type<'ll, 'tcx>( } } } - FieldsShape::Array { count, .. } => cx.type_array(layout.field(cx, 0).llvm_type(cx), count), + FieldsShape::Array { count, .. } => { + let element_ty = layout.field(cx, 0); + if let BackendRepr::Scalar(scalar) = element_ty.backend_repr + && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) + { + cx.type_padding_filler(element_ty.size * count, element_ty.align) + } else { + cx.type_array(element_ty.llvm_type(cx), count) + } + } FieldsShape::Arbitrary { .. } => match name { None => { let (llfields, packed) = struct_llfields(cx, layout); @@ -140,7 +144,15 @@ fn struct_llfields<'ll, 'tcx>( result.push(cx.type_padding_filler(padding, padding_align)); debug!(" padding before: {:?}", padding); } - result.push(field.llvm_type(cx)); + + if let BackendRepr::Scalar(scalar) = field.backend_repr + && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) + { + result.push(cx.type_padding_filler(field.size, field.align)); + } else { + result.push(field.llvm_type(cx)); + } + offset = target_offset + field.size; prev_effective_align = effective_field_align; } diff --git a/compiler/rustc_target/src/callconv/x86_64.rs b/compiler/rustc_target/src/callconv/x86_64.rs index 5439d24a573fb..26ee1c5d8f7b3 100644 --- a/compiler/rustc_target/src/callconv/x86_64.rs +++ b/compiler/rustc_target/src/callconv/x86_64.rs @@ -240,14 +240,12 @@ where } let mut cls_or_mem = classify_arg(cx, arg); - if is_arg { - if let Ok(cls) = cls_or_mem { - // An argument of class X87 is passed in memory. - if cls.contains(&Some(Class::X87)) { - std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); - cls_or_mem = Err(Memory); - } - + if is_arg && let Ok(cls) = cls_or_mem { + if cls.contains(&Some(Class::X87)) { + // An argument of class X87 is always passed in memory. + std::assert_matches!(cls, [Some(Class::X87), Some(Class::X87Up), ..]); + cls_or_mem = Err(Memory); + } else { let mut needed_int = 0; let mut needed_sse = 0; for c in cls { diff --git a/tests/codegen-llvm/x86-abi/x87_f80.rs b/tests/codegen-llvm/x86-abi/x87_f80.rs index ace21aa6e7ad3..7c5ee0676e442 100644 --- a/tests/codegen-llvm/x86-abi/x87_f80.rs +++ b/tests/codegen-llvm/x86-abi/x87_f80.rs @@ -2,10 +2,15 @@ // //@ revisions: X86 X86_64 DARWIN WIN64 WIN32 //@ [X86] compile-flags: --target i686-unknown-linux-gnu +//@ [X86] filecheck-flags: --check-prefix ALIGN4 //@ [X86_64] compile-flags: --target x86_64-unknown-linux-gnu +//@ [X86_64] filecheck-flags: --check-prefix ALIGN16 //@ [DARWIN] compile-flags: --target i686-apple-darwin +//@ [DARWIN] filecheck-flags: --check-prefix ALIGN16 //@ [WIN32] compile-flags: --target i686-pc-windows-gnu +//@ [WIN32] filecheck-flags: --check-prefix ALIGN4 //@ [WIN64] compile-flags: --target x86_64-pc-windows-gnu +//@ [WIN64] filecheck-flags: --check-prefix ALIGN16 //@ compile-flags: -Copt-level=3 --crate-type=lib -Zmerge-functions=disabled //@ needs-llvm-components: x86 @@ -22,6 +27,46 @@ use minicore::arch::x86_64::{x87_f80, x87_f80_raw}; use minicore::simd::f64x2; use minicore::{Copy, MaybeUninit, mem}; +#[repr(C)] +pub struct RawStruct(x87_f80_raw, u8); + +#[repr(C)] +pub struct WrappedStruct(x87_f80, u8); + +// CHECK: @RAW = external global [10 x i8] +// CHECK: @RAW_ARRAY = external global [30 x i8] +// CHECK: @RAW_STRUCT = external global [11 x i8] +#[allow(improper_ctypes)] +unsafe extern "C" { + static RAW: x87_f80_raw; + static RAW_ARRAY: [x87_f80_raw; 3]; + static RAW_STRUCT: RawStruct; +} + +#[unsafe(no_mangle)] +pub fn use_raw_statics() -> (&'static x87_f80_raw, &'static [x87_f80_raw; 3], &'static RawStruct) { + unsafe { (&RAW, &RAW_ARRAY, &RAW_STRUCT) } +} + +// ALIGN4: @WRAPPED = external global [12 x i8] +// ALIGN4: @WRAPPED_ARRAY = external global [36 x i8] +// ALIGN4: @WRAPPED_STRUCT = external global [16 x i8] +// +// ALIGN16: @WRAPPED = external global [16 x i8] +// ALIGN16: @WRAPPED_ARRAY = external global [48 x i8] +// ALIGN16: @WRAPPED_STRUCT = external global [32 x i8] +#[allow(improper_ctypes)] +unsafe extern "C" { + static WRAPPED: x87_f80; + static WRAPPED_ARRAY: [x87_f80; 3]; + static WRAPPED_STRUCT: WrappedStruct; +} + +#[unsafe(no_mangle)] +pub fn use_wrapped_statics() -> (&'static x87_f80, &'static [x87_f80; 3], &'static WrappedStruct) { + unsafe { (&WRAPPED, &WRAPPED_ARRAY, &WRAPPED_STRUCT) } +} + // CHECK-LABEL: size_of_raw_array #[unsafe(no_mangle)] pub fn size_of_raw_array() -> usize { From cc199fabecba87527f62907b1488b4ca88ea6741 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 4 Nov 2026 11:32:15 +0100 Subject: [PATCH 17/38] add assert that we never cast to `x87_f80` --- compiler/rustc_codegen_llvm/src/abi.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 42ec3fbbce657..d29fb14e5bd40 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -212,6 +212,10 @@ impl LlvmType for CastTarget { return rest_ll_unit; } + // The x87_f80 type has a store size of 10 bytes, but an allocation size of 12 or 16 + // bytes. Ensure we don't cast to it, because that could have unintened behavior. + assert!(rest_ll_unit != cx.type_x87_f80()); + return cx.type_array(rest_ll_unit, rest_count); } @@ -219,6 +223,11 @@ impl LlvmType for CastTarget { let prefix_args = self.prefix.iter().map(|reg| reg.llvm_type(cx)); let rest_args = (0..rest_count).map(|_| rest_ll_unit); let args: Vec<_> = prefix_args.chain(rest_args).collect(); + + // The x87_f80 type has a store size of 10 bytes, but an allocation size of 12 or 16 bytes. + // Ensure we don't cast to it, because that could have unintened behavior. + assert!(args.iter().all(|a| *a != cx.type_x87_f80())); + cx.type_struct(&args) } } From 802a33e67e71b83f057774cc65f68020d6e2be77 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 4 Nov 2026 11:55:40 +0100 Subject: [PATCH 18/38] adjust comments on backend type functions --- compiler/rustc_codegen_llvm/src/type_of.rs | 8 +++++--- compiler/rustc_codegen_ssa/src/traits/type_.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index d914998c75a43..190cbe32ac65b 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -209,12 +209,14 @@ pub(crate) trait LayoutLlvmExt<'tcx> { impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> { /// Gets the LLVM type corresponding to a Rust type, i.e., `rustc_middle::ty::Ty`. - /// The pointee type of the pointer in `PlaceRef` is always this type. - /// For sized types, it is also the right LLVM type for an `alloca` - /// containing a value of that type, and most immediates (except `bool`). + /// + /// For sized types, this is the in-memory type that is used for stores and loads. + /// The type used for immediates may be different, see [`Self::immediate_llvm_type`]. + /// /// Unsized types, however, are represented by a "minimal unit", e.g. /// `[T]` becomes `T`, while `str` and `Trait` turn into `i8` - this /// is useful for indexing slices, as `&[T]`'s data pointer is `T*`. + /// /// If the type is an unsized struct, the regular layout is generated, /// with the innermost trailing unsized field using the "minimal unit" /// of that field's type - this is useful for taking the address of diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index c4e52fcd2c0ba..11f3250ded648 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -123,8 +123,12 @@ impl<'tcx, T> DerivedTypeCodegenMethods<'tcx> for T where } pub trait LayoutTypeCodegenMethods<'tcx>: BackendTypes { - /// The backend type used for a rust type when it's in memory, - /// such as when it's stack-allocated or when it's being loaded or stored. + /// The backend type used for a Rust type when it is being loaded from or + /// stored to memory. + /// + /// Note that this type may be different from the type used for allocas. + /// For instance for x87_f80 the store size and allocation size is different, + /// so different types are used to represent it in memory versus on the stack. fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type; fn cast_backend_type(&self, ty: &CastTarget) -> Self::Type; fn fn_decl_backend_type(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> Self::FunctionSignature; From 7274b42c8de374e93342decc539343d29fc7e9f5 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 5 Nov 2026 11:59:50 +0100 Subject: [PATCH 19/38] support x87_f80 in const eval's `try_visit_primitive` Without it, reads are reported as UB because the tracking of what bytes are initialized is incorect --- .../src/interpret/validity.rs | 12 +++++++ src/tools/miri/tests/pass/x87_f80.rs | 32 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/tools/miri/tests/pass/x87_f80.rs diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 67fe133f147f3..43a05b617cfb9 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -16,6 +16,7 @@ use rustc_abi::{ WrappingRange, }; use rustc_ast::Mutability; +use rustc_attr_ir::LangItem; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_middle::mir::interpret::{ @@ -902,6 +903,17 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> { } interp_ok(true) } + ty::Adt(adt_def, _) + if self.ecx.tcx.is_lang_item(adt_def.did(), LangItem::X87F80Raw) => + { + // The x87_f80_raw lang item is effectively a primitive. + self.read_scalar(value, ExpectedKind::Float)?; + if self.reset_provenance_and_padding { + self.ecx.clear_provenance(value)?; + self.add_data_range_place(value); + } + interp_ok(true) + } ty::RawPtr(pointee, ..) => { let ptr = self.read_immediate(value, ExpectedKind::RawPtr)?; if self.reset_provenance_and_padding { diff --git a/src/tools/miri/tests/pass/x87_f80.rs b/src/tools/miri/tests/pass/x87_f80.rs new file mode 100644 index 0000000000000..211a480796789 --- /dev/null +++ b/src/tools/miri/tests/pass/x87_f80.rs @@ -0,0 +1,32 @@ +//@only-target: x86_64 i686 +#![feature(x87_f80)] + +#[cfg(target_arch = "x86")] +use std::arch::x86::x87_f80; +#[cfg(target_arch = "x86_64")] +use std::arch::x86_64::x87_f80; + +static STATIC: x87_f80 = x87_f80::from_ne_bytes([0xAA; 10]); +static STATIC_AGGREGATE: (u8, x87_f80, i32) = (3, x87_f80::from_ne_bytes([0xBB; 10]), 4); +static STATIC_ARRAY: [x87_f80; 3] = [ + x87_f80::from_ne_bytes([0x11; 10]), + x87_f80::from_ne_bytes([0x22; 10]), + x87_f80::from_ne_bytes([0x33; 10]), +]; + +fn identity(x: x87_f80) -> x87_f80 { + x +} + +fn main() { + assert_eq!(STATIC.to_ne_bytes(), [0xAA; 10]); + assert_eq!(STATIC_AGGREGATE.1.to_ne_bytes(), [0xBB; 10]); + assert_eq!(STATIC_ARRAY[1].to_ne_bytes(), [0x22; 10]); + + let mut m = std::mem::MaybeUninit::::uninit(); + unsafe { m.as_mut_ptr().cast::<[u8; 10]>().write([0xCC; 10]) }; + let i = unsafe { m.assume_init() }; + assert_eq!(i.to_ne_bytes(), [0xCC; 10]); + + assert_eq!(identity(i).to_ne_bytes(), [0xCC; 10]); +} From e7007d3aaaa6a6ca1bcd95f1f10c9411693a3628 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 11:22:26 +0100 Subject: [PATCH 20/38] interpret: ensure newly created unions have uninit in their padding --- .../rustc_const_eval/src/interpret/step.rs | 14 ++++++-- .../uninit/union-aggregate-init-padding.rs | 34 +++++++++++++++++++ .../union-aggregate-init-padding.stderr | 18 ++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs create mode 100644 src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 25de62f948520..901f1f0655378 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -340,6 +340,16 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { if active_field_index.is_some() { assert_eq!(operands.len(), 1); } + // We generally rely on the `reset_provenance_and_padding` below to ensure that all padding + // is uninit. However, if we are creating a new union, everything outside the initialized + // field should be uninit -- but validity cannot know this as it cannot look into unions. So + // for unions we have to additionally reset everything before writing the fields. + // We skip this for non-unions for two reasons: (a) performance, and (b) to keep assignments + // where LHS and RHS overlap working for scalar types. + if dest.layout.ty.is_union() { + self.write_uninit(dest)?; + } + // Initialize the fields. for (field_index, operand) in operands.iter_enumerated() { let field_index = active_field_index.unwrap_or(field_index); let field_dest = self.project_field(&variant_dest, field_index)?; @@ -347,9 +357,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // We validate manually below so we don't have to do it here. self.copy_op_no_validate(&op, &field_dest, /*allow_transmute*/ false)?; } + // At the end, write the discriminant. self.write_discriminant(variant_index, dest)?; - // Validate that the entire thing is valid, and reset padding that might be in between the - // fields. + // Validate that the entire thing is valid, and reset padding. if M::enforce_validity(self, dest.layout()) { self.validate_place( dest, diff --git a/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs new file mode 100644 index 0000000000000..2751e978e9f09 --- /dev/null +++ b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.rs @@ -0,0 +1,34 @@ +//! Ensure that initalizing an aggregate resets padding to uninit. +//! Regression test for . +#![feature(custom_mir, core_intrinsics)] +#![allow(internal_features, unused)] + +use std::intrinsics::mir::*; + +#[derive(Clone, Copy)] +union U { + a: u8, + b: u32, +} + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn f() -> u32 { + mir! { + let u: U; + let x: u32; + { + x = 0x01020304_u32; + u = U { b: x }; + // This creates a new union value where `a` is initialized and the remaining bytes + // remain uninitialized. That then gets stored into `u`. As a result, this assignment + // should reset the padding bytes of `U::a` in `u` to uninit. + u = U { a: 9_u8 }; + RET = CastTransmute::(u); //~ERROR: uninitialized + Return() + } + } +} + +fn main() { + f(); +} diff --git a/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr new file mode 100644 index 0000000000000..575bee4c3652b --- /dev/null +++ b/src/tools/miri/tests/fail/uninit/union-aggregate-init-padding.stderr @@ -0,0 +1,18 @@ +error: Undefined Behavior: constructing invalid value of type u32: encountered uninitialized memory, but expected an integer + --> tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + | +LL | RET = CastTransmute::(u); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + = note: stack backtrace: + 0: f + at tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + 1: main + at tests/fail/uninit/union-aggregate-init-padding.rs:LL:CC + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to 1 previous error + From a4016e0a28937ce9ae4f9f7344639ae92e1a90b6 Mon Sep 17 00:00:00 2001 From: zannabianca1997 Date: Mon, 9 Nov 2026 19:59:22 +0100 Subject: [PATCH 21/38] Fix: fast path for rustdoc added a fast path in the rustdoc helper, assuming that move is implemented everywhere if the feature is off --- compiler/rustc_trait_selection/src/traits/auto_trait.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index ab16ec5ad167e..7b23b6dd4d1b4 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -82,7 +82,10 @@ impl<'tcx> AutoTraitFinder<'tcx> { let tcx = self.tcx; // Without `#![feature(forget_trait)]`, assume absolutely all types are forget. - if !tcx.features().forget_trait() && tcx.is_forget_trait(trait_did) { + // Without `#![feature(move_trait)]`, assume absolutely all types are move. + if !tcx.features().forget_trait() && tcx.is_forget_trait(trait_did) + || !tcx.features().move_trait() && tcx.is_move_trait(trait_did) + { let info = AutoTraitInfo { full_user_env: typing_env.param_env, region_data: Default::default(), From 3cf3c878a2fb6e3667187622096d944190eda03a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 29 Oct 2026 10:31:31 +0100 Subject: [PATCH 22/38] std Miri testing: use skip_unsupported_miri_tests to control when tests should be skipped in Miri due to missing shims --- library/std/Cargo.toml | 2 ++ library/std/src/fs/tests.rs | 3 ++- library/std/src/net/socket_addr/tests.rs | 2 ++ library/std/src/net/tcp/tests.rs | 4 ++++ library/std/src/net/tests.rs | 1 + library/std/src/net/udp/tests.rs | 2 ++ library/std/src/os/darwin/fs/dirs.rs | 1 + library/std/src/os/fd/owned.rs | 2 +- library/std/src/os/net/linux_ext/tests.rs | 2 ++ library/std/src/os/unix/fs/tests.rs | 2 ++ library/std/src/os/unix/net/tests.rs | 2 ++ library/std/src/os/windows/fs/dirs.rs | 1 + library/std/src/process/tests.rs | 2 ++ library/std/src/sys/fs/windows/tests.rs | 2 ++ .../src/sys/net/connection/socket/tests.rs | 2 ++ library/std/src/sys/pal/unix/conf/tests.rs | 1 + .../src/sys/platform_version/darwin/tests.rs | 2 ++ .../std/src/sys/process/unix/common/tests.rs | 2 ++ .../std/src/sys/process/unix/pidfd/tests.rs | 2 ++ .../std/src/sys/process/unix/unix/tests.rs | 2 ++ library/std/src/sys/process/windows/tests.rs | 2 ++ library/std/tests/create_dir_all_bare.rs | 2 +- library/std/tests/env_modify.rs | 5 ++-- library/std/tests/pipe_subprocess.rs | 2 +- library/std/tests/process_spawning.rs | 2 +- library/std/tests/switch-stdout.rs | 2 +- library/std/tests/thread.rs | 2 +- library/std/tests/thread_local/tests.rs | 2 +- library/std/tests/win_delete_self.rs | 2 +- library/std/tests/windows_unix_socket.rs | 2 +- src/bootstrap/mk/Makefile.in | 23 +++++++------------ .../test-x86_64-gnu-miri/check-miri.sh | 5 ++-- .../miri/src/shims/windows/foreign_items.rs | 8 +++++++ src/tools/miri/tests/pass/shims/io.rs | 3 ++- 34 files changed, 71 insertions(+), 30 deletions(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 2f21b78352abb..6248f3c79fb57 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -166,6 +166,8 @@ check-cfg = [ 'cfg(target_has_reliable_f16_math)', 'cfg(target_has_reliable_f128)', 'cfg(target_has_reliable_f128_math)', + # Controlling which tests we run in Miri. + 'cfg(skip_unsupported_miri_tests)', ] [lints.cargo] diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 01977792b5751..82e1441e59462 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty + use rand::RngCore; use super::Dir; @@ -2567,7 +2569,6 @@ fn test_eq_windows_file_type() { /// Regression test for https://github.com/rust-lang/rust/issues/50619. #[test] #[cfg(target_os = "linux")] -#[cfg_attr(miri, ignore)] // Cannot spawn processes on Miri fn test_read_dir_infinite_loop() { use crate::io::ErrorKind; use crate::process::Command; diff --git a/library/std/src/net/socket_addr/tests.rs b/library/std/src/net/socket_addr/tests.rs index 2f3e3add5c22d..3eedb86b1650c 100644 --- a/library/std/src/net/socket_addr/tests.rs +++ b/library/std/src/net/socket_addr/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use crate::net::tests::{sa4, sa6, tsa}; use crate::net::*; diff --git a/library/std/src/net/tcp/tests.rs b/library/std/src/net/tcp/tests.rs index 9aeddff864918..de62bd66c5c74 100644 --- a/library/std/src/net/tcp/tests.rs +++ b/library/std/src/net/tcp/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use rand::Rng; use crate::io::prelude::*; @@ -898,6 +900,7 @@ fn ttl() { #[test] #[cfg_attr(target_env = "sgx", ignore)] #[cfg(any(target_family = "unix", target_os = "windows"))] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn hop_limit() { let hlim = 100; @@ -979,6 +982,7 @@ fn connect_timeout_valid() { // macOS with `EINVAL`; `write_all` should now transfer it via short sends. #[test] #[cfg(all(target_pointer_width = "64", unix))] +#[cfg(not(skip_unsupported_miri_tests))] // read-only mmap not supported by Miri fn write_buffer_larger_than_c_int_max() { const LEN: usize = crate::ffi::c_int::MAX as usize + 1; diff --git a/library/std/src/net/tests.rs b/library/std/src/net/tests.rs index 213c9a5a3e3a1..f07a7f6e8894a 100644 --- a/library/std/src/net/tests.rs +++ b/library/std/src/net/tests.rs @@ -88,6 +88,7 @@ impl Drop for ZeroedMmap { } #[test] +#[cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows fn hostname_smoketest() { // Just a smoke test to ensure it can be called. let name = crate::net::hostname(); diff --git a/library/std/src/net/udp/tests.rs b/library/std/src/net/udp/tests.rs index 6296e07044c55..f5dd0464f430b 100644 --- a/library/std/src/net/udp/tests.rs +++ b/library/std/src/net/udp/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // UDP sockets are not supported in Miri + use crate::io::ErrorKind; use crate::net::tests::{LOCALHOST_IP4, LOCALHOST_IP6, compare_ignore_zoneid}; use crate::net::*; diff --git a/library/std/src/os/darwin/fs/dirs.rs b/library/std/src/os/darwin/fs/dirs.rs index 6aaa910981b0b..d5d1449d9973b 100644 --- a/library/std/src/os/darwin/fs/dirs.rs +++ b/library/std/src/os/darwin/fs/dirs.rs @@ -291,6 +291,7 @@ mod sys { #[cfg(test)] #[cfg(target_vendor = "apple")] +#[cfg(not(skip_unsupported_miri_tests))] // macOS sysdir APIs are not supported in Miri mod tests { use super::*; diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index fa775a9373427..594de872a17de 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -94,7 +94,7 @@ impl BorrowedFd<'_> { /// Converts a `BorrowedFd` into a reference to a file-like type. /// - #[cfg_attr(all(unix, not(miri)), doc = "```")] + #[cfg_attr(unix, doc = "```")] #[cfg_attr(not(unix), doc = "```ignore (needs unix)")] /// # #![feature(fd_view)] /// # use std::fs::File; diff --git a/library/std/src/os/net/linux_ext/tests.rs b/library/std/src/os/net/linux_ext/tests.rs index a63524e63b6d8..e76cc1e44d7f5 100644 --- a/library/std/src/os/net/linux_ext/tests.rs +++ b/library/std/src/os/net/linux_ext/tests.rs @@ -1,4 +1,5 @@ #[test] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn quickack() { use crate::net::tests::LOCALHOST_IP4; use crate::net::{TcpListener, TcpStream}; @@ -28,6 +29,7 @@ fn quickack() { #[test] #[cfg(target_os = "linux")] +#[cfg(not(skip_unsupported_miri_tests))] // socket flag not supported by Miri fn deferaccept() { use crate::net::tests::LOCALHOST_IP4; use crate::net::{TcpListener, TcpStream}; diff --git a/library/std/src/os/unix/fs/tests.rs b/library/std/src/os/unix/fs/tests.rs index 52e0fe940a81f..3b7b0ef0ce0ba 100644 --- a/library/std/src/os/unix/fs/tests.rs +++ b/library/std/src/os/unix/fs/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // fs API support in Miri is quite spotty + use super::*; #[test] diff --git a/library/std/src/os/unix/net/tests.rs b/library/std/src/os/unix/net/tests.rs index 4014767461389..d310aa81db3e5 100644 --- a/library/std/src/os/unix/net/tests.rs +++ b/library/std/src/os/unix/net/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // Unix domain sockets are not supported in Miri + use super::*; use crate::io::prelude::*; use crate::io::{self, ErrorKind, IoSlice, IoSliceMut}; diff --git a/library/std/src/os/windows/fs/dirs.rs b/library/std/src/os/windows/fs/dirs.rs index 52710375e6eb2..56cf055d3299b 100644 --- a/library/std/src/os/windows/fs/dirs.rs +++ b/library/std/src/os/windows/fs/dirs.rs @@ -287,6 +287,7 @@ mod sys { } #[cfg(test)] +#[cfg(not(skip_unsupported_miri_tests))] // Windows known directory APIs are not supported in Miri mod tests { use super::*; diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs index e31cb002c0265..ecb42906e8ca8 100644 --- a/library/std/src/process/tests.rs +++ b/library/std/src/process/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::{Command, Output, Stdio}; use crate::io::prelude::*; use crate::io::{BorrowedBuf, ErrorKind}; diff --git a/library/std/src/sys/fs/windows/tests.rs b/library/std/src/sys/fs/windows/tests.rs index b53dfddecf627..dc57598d8984d 100644 --- a/library/std/src/sys/fs/windows/tests.rs +++ b/library/std/src/sys/fs/windows/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // Windows fs APIs are not supported in Miri + use super::{get_path_canonical, get_path_fallback}; use crate::env; use crate::fs::{File, canonicalize}; diff --git a/library/std/src/sys/net/connection/socket/tests.rs b/library/std/src/sys/net/connection/socket/tests.rs index cc072420b754b..d1c001d9d424d 100644 --- a/library/std/src/sys/net/connection/socket/tests.rs +++ b/library/std/src/sys/net/connection/socket/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(all(windows, skip_unsupported_miri_tests)))] // Miri has no net support on Windows + use super::*; use crate::collections::HashMap; diff --git a/library/std/src/sys/pal/unix/conf/tests.rs b/library/std/src/sys/pal/unix/conf/tests.rs index a84086037ce0b..76aed1c6e608b 100644 --- a/library/std/src/sys/pal/unix/conf/tests.rs +++ b/library/std/src/sys/pal/unix/conf/tests.rs @@ -26,6 +26,7 @@ fn test_parse_glibc_version() { // logic is correct. #[test] #[cfg(target_vendor = "apple")] +#[cfg(not(skip_unsupported_miri_tests))] // macOS conf API is not supported in Miri fn test_confstr() { for key in [libc::_CS_DARWIN_USER_TEMP_DIR, libc::_CS_PATH] { let value_nohint = super::confstr(key, None).unwrap_or_else(|e| { diff --git a/library/std/src/sys/platform_version/darwin/tests.rs b/library/std/src/sys/platform_version/darwin/tests.rs index 17b2cc18ec096..24895c73bf3d6 100644 --- a/library/std/src/sys/platform_version/darwin/tests.rs +++ b/library/std/src/sys/platform_version/darwin/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // macOS version APIs are not supported in Miri + use super::public_extern::*; use super::*; use crate::process::Command; diff --git a/library/std/src/sys/process/unix/common/tests.rs b/library/std/src/sys/process/unix/common/tests.rs index eacb4d2d43122..c652488d0570b 100644 --- a/library/std/src/sys/process/unix/common/tests.rs +++ b/library/std/src/sys/process/unix/common/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::*; use crate::ffi::OsStr; use crate::sys::{cvt, cvt_nz}; diff --git a/library/std/src/sys/process/unix/pidfd/tests.rs b/library/std/src/sys/process/unix/pidfd/tests.rs index 4cc2368c25a22..97578eea370f3 100644 --- a/library/std/src/sys/process/unix/pidfd/tests.rs +++ b/library/std/src/sys/process/unix/pidfd/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // pidfd is not supported in Miri + use super::PidFd as InternalPidFd; use crate::assert_matches; use crate::os::fd::AsRawFd; diff --git a/library/std/src/sys/process/unix/unix/tests.rs b/library/std/src/sys/process/unix/unix/tests.rs index e360b61851b2e..22b65bae4a6dc 100644 --- a/library/std/src/sys/process/unix/unix/tests.rs +++ b/library/std/src/sys/process/unix/unix/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use crate::os::unix::process::{CommandExt, ExitStatusExt}; use crate::panic::catch_unwind; use crate::process::Command; diff --git a/library/std/src/sys/process/windows/tests.rs b/library/std/src/sys/process/windows/tests.rs index bc5e0d5c7fc97..22b5334c76472 100644 --- a/library/std/src/sys/process/windows/tests.rs +++ b/library/std/src/sys/process/windows/tests.rs @@ -1,3 +1,5 @@ +#![cfg(not(skip_unsupported_miri_tests))] // process spawning is not supported in Miri + use super::child_pipe::{Pipes, child_pipe}; use super::{Arg, make_command_line}; use crate::ffi::{OsStr, OsString}; diff --git a/library/std/tests/create_dir_all_bare.rs b/library/std/tests/create_dir_all_bare.rs index 30f800c5aa2e6..c3e91b8c613c8 100644 --- a/library/std/tests/create_dir_all_bare.rs +++ b/library/std/tests/create_dir_all_bare.rs @@ -31,7 +31,7 @@ impl Drop for CurrentDir { } #[test] -#[cfg_attr(all(miri, windows), ignore)] // File system access on Windows not supported by Miri +#[cfg_attr(all(windows, skip_unsupported_miri_tests), ignore)] // File system access on Windows not supported by Miri fn create_dir_all_bare() { let tmpdir = common::tmpdir(); CurrentDir::with(tmpdir.path(), || { diff --git a/library/std/tests/env_modify.rs b/library/std/tests/env_modify.rs index 71d15bc1c47c0..9eefe0cc25126 100644 --- a/library/std/tests/env_modify.rs +++ b/library/std/tests/env_modify.rs @@ -179,8 +179,9 @@ fn env_home_dir() { } } -#[test] // miri shouldn't detect any data race in this fn -#[cfg_attr(any(not(miri), target_os = "emscripten"), ignore)] +// This is primarily a Miri test (ensuring there are no data races), but can also run natively. +#[test] +#[cfg_attr(target_os = "emscripten", ignore)] fn test_env_get_set_multithreaded() { let getter = thread::spawn(|| { for _ in 0..100 { diff --git a/library/std/tests/pipe_subprocess.rs b/library/std/tests/pipe_subprocess.rs index c14db690224db..35ad327ef4f48 100644 --- a/library/std/tests/pipe_subprocess.rs +++ b/library/std/tests/pipe_subprocess.rs @@ -1,7 +1,7 @@ fn main() { // No `Command` on Miri, emscripten or L4Re #[cfg(all( - not(miri), + not(skip_unsupported_miri_tests), any(unix, windows), not(any(target_os = "emscripten", target_os = "l4re")) ))] diff --git a/library/std/tests/process_spawning.rs b/library/std/tests/process_spawning.rs index b7a9a1077696b..e634ee5155eab 100644 --- a/library/std/tests/process_spawning.rs +++ b/library/std/tests/process_spawning.rs @@ -6,7 +6,7 @@ mod common; #[test] // Process spawning not supported by Miri, Emscripten and wasi -#[cfg_attr(any(miri, target_os = "emscripten", target_os = "wasi"), ignore)] +#[cfg_attr(any(skip_unsupported_miri_tests, target_os = "emscripten", target_os = "wasi"), ignore)] #[cfg_attr( any(target_os = "tvos", target_os = "watchos", target_os = "l4re"), ignore = "fork is prohibited" diff --git a/library/std/tests/switch-stdout.rs b/library/std/tests/switch-stdout.rs index 91fe0200f6cae..829909bc364d0 100644 --- a/library/std/tests/switch-stdout.rs +++ b/library/std/tests/switch-stdout.rs @@ -50,7 +50,7 @@ fn switch_stdout_to(file: OwnedHandle) -> OwnedHandle { } #[test] -#[cfg_attr(miri, ignore)] // dup/SetStdHandle not supported by Miri +#[cfg_attr(all(windows, skip_unsupported_miri_tests), ignore)] // SetStdHandle not supported by Miri fn switch_stdout() { let temp = common::tmpdir(); let path = temp.join("switch-stdout-output"); diff --git a/library/std/tests/thread.rs b/library/std/tests/thread.rs index ef13ce44d3180..433b804952694 100644 --- a/library/std/tests/thread.rs +++ b/library/std/tests/thread.rs @@ -6,7 +6,7 @@ use std::time::{Duration, Instant}; #[test] #[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads -#[cfg_attr(miri, ignore)] // Miri does not like the thread leak +#[cfg_attr(miri, ignore)] // Test leaks memory; a copy in the Miri test suite covers this fn sleep_very_long() { let finished = Arc::new(Mutex::new(false)); let t_finished = finished.clone(); diff --git a/library/std/tests/thread_local/tests.rs b/library/std/tests/thread_local/tests.rs index c2164a0bc2cff..734437585efcb 100644 --- a/library/std/tests/thread_local/tests.rs +++ b/library/std/tests/thread_local/tests.rs @@ -403,7 +403,7 @@ fn thread_current_in_dtor() { // https://github.com/rust-lang/rust/pull/148799#issuecomment-3731806901 #[cfg(target_os = "windows")] #[test] -#[cfg_attr(miri, ignore)] // Miri does not support fibers +#[cfg_attr(skip_unsupported_miri_tests, ignore)] // Miri does not support fibers fn fiber_does_not_trigger_dtor() { use core::ffi::c_void; use std::ptr; diff --git a/library/std/tests/win_delete_self.rs b/library/std/tests/win_delete_self.rs index ce505de69a22d..1b4e95174664b 100644 --- a/library/std/tests/win_delete_self.rs +++ b/library/std/tests/win_delete_self.rs @@ -2,7 +2,7 @@ /// Attempting to delete a running binary should return an error on Windows. #[test] -#[cfg_attr(miri, ignore)] // `remove_file` does not work in Miri on Windows +#[cfg_attr(skip_unsupported_miri_tests, ignore)] // `remove_file` does not work in Miri on Windows fn win_delete_self() { let path = std::env::current_exe().unwrap(); assert!(std::fs::remove_file(path).is_err()); diff --git a/library/std/tests/windows_unix_socket.rs b/library/std/tests/windows_unix_socket.rs index dd71b1f135dce..865794361eabb 100644 --- a/library/std/tests/windows_unix_socket.rs +++ b/library/std/tests/windows_unix_socket.rs @@ -1,5 +1,5 @@ #![cfg(windows)] -#![cfg(not(miri))] // no Windows socket support in Miri +#![cfg(not(skip_unsupported_miri_tests))] // no Windows socket support in Miri #![feature(windows_unix_domain_sockets)] // Now only test windows_unix_domain_sockets feature // in the future, will test both unix and windows uds diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 886966fdd496e..07412657f8687 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -58,13 +58,13 @@ check-aux: $(Q)$(BOOTSTRAP) test --stage 2 \ build-std \ $(BOOTSTRAP_ARGS) - # Run standard library tests in Miri. + ## Run standard library tests in Miri. $(Q)MIRIFLAGS="-Zmiri-strict-provenance" \ $(BOOTSTRAP) miri --stage 2 \ library/core \ library/alloc \ $(BOOTSTRAP_ARGS) \ - --tests # exclude doc tests + --tests # exclude doc tests, they are run below # Some doctests use file system operations to demonstrate dealing with `Result`, # so we have to run them with isolation disabled. $(Q)MIRIFLAGS="-Zmiri-disable-isolation" \ @@ -73,22 +73,15 @@ check-aux: library/alloc \ $(BOOTSTRAP_ARGS) \ --doc - # In `std` we cannot test everything, so we skip some modules. - $(Q)MIRIFLAGS="-Zmiri-disable-isolation" \ - $(BOOTSTRAP) miri --stage 2 \ - library/std \ - $(BOOTSTRAP_ARGS) \ - -- \ - --skip fs:: --skip net:: --skip process:: --skip sys:: - # Also test some very target-specific modules on other targets - # (making sure to cover an i686 target as well). - $(Q)MIRIFLAGS="-Zmiri-disable-isolation" BOOTSTRAP_SKIP_TARGET_SANITY=1 \ + # In `std` we cannot test everything. Tests should be disabled under `skip_unsupported_miri_tests`. + # We cover all three tier 1 architectures and operating systems. + $(Q)MIRIFLAGS="--cfg skip_unsupported_miri_tests -Zmiri-disable-isolation -Zmiri-no-short-fd-operations" \ + BOOTSTRAP_SKIP_TARGET_SANITY=1 \ $(BOOTSTRAP) miri --stage 2 \ library/std \ - --target aarch64-apple-darwin,i686-pc-windows-msvc \ $(BOOTSTRAP_ARGS) \ - -- \ - time:: sync:: thread:: env:: + --target x86_64-unknown-linux-gnu,aarch64-apple-darwin,i686-pc-windows-msvc \ + --tests # skip all doctests, they are not using skip_unsupported_miri_tests dist: $(Q)$(BOOTSTRAP) dist $(BOOTSTRAP_ARGS) distcheck: diff --git a/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh b/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh index d6fae3ac9d94f..da9797d05495e 100755 --- a/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh +++ b/src/ci/docker/host-x86_64/test-x86_64-gnu-miri/check-miri.sh @@ -46,12 +46,13 @@ case $HOST_TARGET in exit 1 ;; esac + # Also smoke-test `x.py miri`. This doesn't run any actual tests (that would take too long), # but it ensures that the crates build properly when tested with Miri. - #FIXME: Re-enable this for msvc once CI issues are fixed if [ "$HOST_TARGET" != "x86_64-pc-windows-msvc" ]; then python3 "$X_PY" miri --stage 2 library/core -- notest python3 "$X_PY" miri --stage 2 library/alloc -- notest - python3 "$X_PY" miri --stage 2 library/std -- notest + # This runs some tests that don't use a test harness and hence ignore the filter. + MIRIFLAGS="--cfg skip_unsupported_miri_tests" python3 "$X_PY" miri --stage 2 library/std -- notest fi diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index efaf79af02e88..7e5f545bffbfb 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -1214,6 +1214,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // We need to return something non-null here to make `compat_fn!` work. ecx.write_int(1, dest)?; } + "GetModuleHandleW" if ecx.frame_in_std() => { + let [_module_name] = &ecx.check_shim_sig( + shim_sig!(extern "system" fn(*_) -> winapi::HMODULE), + (link_name, abi, args), + )?; + // Returning null works best for `format_error`. + ecx.write_int(0, dest)?; + } "SetConsoleTextAttribute" if ecx.frame_in_std() => { let [_console_output, _attribute] = &ecx.check_shim_sig( shim_sig!(extern "system" fn(winapi::HANDLE, u16) -> winapi::BOOL), diff --git a/src/tools/miri/tests/pass/shims/io.rs b/src/tools/miri/tests/pass/shims/io.rs index a96b98c022746..554ee2dd0cee1 100644 --- a/src/tools/miri/tests/pass/shims/io.rs +++ b/src/tools/miri/tests/pass/shims/io.rs @@ -12,7 +12,8 @@ fn main() { let raw_os_error = if cfg!(unix) { 22 // EINVAL (on most Unixes, anyway) } else if cfg!(windows) { - 87 // ERROR_INVALID_PARAMETER + // FACILITY_NT_BIT hits an extra codepath in std + 87 | 268435456 // ERROR_INVALID_PARAMETER | FACILITY_NT_BIT } else { panic!("unsupported OS") }; From f64ebf2c04743ca6663c404615e49b864f9663a2 Mon Sep 17 00:00:00 2001 From: Dennis Duda Date: Sun, 8 Nov 2026 23:24:06 +0100 Subject: [PATCH 23/38] windows: check for null before wide encoding Only a `\0` byte in an OsStr becomes a WTF16 NUL, so we can check before converting instead of after. For `to_u16s`, this up to halves the amount of memory being scanned, and it can use the optimized memchr [u8] path. For `ensure_no_nuls` the same applies, and this additionally skips a duplicated WTF8->WTF16 conversion: all but one call to it is followed by `encode_wide` anyway. --- library/std/src/sys/pal/windows/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs index a9f3cdbdd9d3e..0f79a4b09000e 100644 --- a/library/std/src/sys/pal/windows/mod.rs +++ b/library/std/src/sys/pal/windows/mod.rs @@ -90,19 +90,19 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option { pub fn to_u16s>(s: S) -> io::Result> { fn inner(s: &OsStr) -> io::Result> { + if s.as_encoded_bytes().contains(&0) { + return Err(io::const_error!( + io::ErrorKind::InvalidInput, + "strings passed to WinAPI cannot contain NULs", + )); + } + // Most paths are ASCII, so reserve capacity for as much as there are bytes // in the OsStr plus one for the null-terminating character. We are not // wasting bytes here as paths created by this function are primarily used // in an ephemeral fashion. let mut maybe_result = Vec::with_capacity(s.len() + 1); maybe_result.extend(s.encode_wide()); - - if unrolled_find_u16s(0, &maybe_result).is_some() { - return Err(io::const_error!( - io::ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs", - )); - } maybe_result.push(0); Ok(maybe_result) } @@ -207,7 +207,7 @@ pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] { } pub fn ensure_no_nuls>(s: T) -> io::Result { - if s.as_ref().encode_wide().any(|b| b == 0) { + if s.as_ref().as_encoded_bytes().contains(&0) { Err(io::const_error!(io::ErrorKind::InvalidInput, "nul byte found in provided data")) } else { Ok(s) From 0aa6251e6553cac8045f7502bcd4cd815887970f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 8 Nov 2026 19:30:10 +0100 Subject: [PATCH 24/38] Unignore passing GCC backend tests --- tests/ui/abi/abi-sysv64-arg-passing.rs | 1 - tests/ui/abi/abi-sysv64-register-usage.rs | 1 - tests/ui/abi/arm-unadjusted-intrinsic.rs | 1 - tests/ui/abi/avr-sram.rs | 1 - tests/ui/abi/compatibility.rs | 1 - .../homogenous-floats-target-feature-mixup.rs | 1 - .../ui/abi/interrupt-returns-never-or-unit.rs | 1 - tests/ui/abi/issue-28676.rs | 1 - tests/ui/abi/large-byval-align.rs | 1 - .../ui/abi/numbers-arithmetic/float-struct.rs | 1 - tests/ui/abi/pass-indirectly-attr.rs | 1 - tests/ui/abi/pass-indirectly-attr.stderr | 6 +- tests/ui/abi/s390x-softfloat-gate.rs | 1 - tests/ui/abi/segfault-no-out-of-stack.rs | 1 - .../shadow-call-stack-without-fixed-x18.rs | 1 - tests/ui/abi/stack-probes.rs | 1 - tests/ui/abi/stack-protector.rs | 1 - tests/ui/abi/struct-enums/struct-return.rs | 1 - tests/ui/abi/swift-abi-non-apple.rs | 1 - tests/ui/abi/swift-abi-non-apple.stderr | 14 +-- tests/ui/abi/variadic-ffi.rs | 1 - tests/ui/abi/x86stdcall.rs | 1 - .../no_std-alloc-error-handler-custom.rs | 1 - .../no_std-alloc-error-handler-default.rs | 1 - .../array-slice-vec/box-of-array-of-drop-1.rs | 1 - .../array-slice-vec/box-of-array-of-drop-2.rs | 1 - tests/ui/array-slice-vec/nested-vec-3.rs | 1 - tests/ui/array-slice-vec/slice-panic-1.rs | 1 - tests/ui/array-slice-vec/slice-panic-2.rs | 1 - tests/ui/asm/aarch64/aarch64-sve.rs | 1 - tests/ui/asm/aarch64/ttbr0_el2.rs | 1 - tests/ui/asm/aarch64v8r.rs | 1 - tests/ui/asm/arm-low-dreg.rs | 1 - tests/ui/asm/cortex-r82.rs | 1 - tests/ui/asm/global-target-feature.rs | 1 - tests/ui/asm/issue-92378.rs | 1 - tests/ui/asm/naked-functions/shim.rs | 1 - tests/ui/asm/thumbv6m-clobber-abi-r14.rs | 1 - tests/ui/asm/x86_64/issue-96797.rs | 1 - ...ont-project-to-specializable-projection.rs | 1 - ...project-to-specializable-projection.stderr | 8 +- tests/ui/attributes/main-removed-2/main.rs | 1 - tests/ui/backtrace/dylib-dep.rs | 1 - .../backtrace/synchronized-panic-handler.rs | 1 - .../synchronized-panic-handler.run.stderr | 4 +- tests/ui/c-variadic/copy.rs | 1 - tests/ui/c-variadic/inherent-method.rs | 1 - tests/ui/c-variadic/naked-invalid.rs | 1 - tests/ui/c-variadic/naked-invalid.stderr | 6 +- tests/ui/c-variadic/roundtrip.rs | 1 - tests/ui/c-variadic/trait-method.rs | 1 - tests/ui/c-variadic/valid.rs | 1 - .../assume-incomplete.rs | 1 - tests/ui/cfg/cfg-panic-abort.rs | 1 - tests/ui/cfg/cfg_target_object_format.rs | 1 - tests/ui/check-cfg/values-target-json.rs | 1 - .../callback-as-argument.rs | 1 - .../cmse-nonsecure-call/via-registers.rs | 1 - .../cmse-nonsecure-entry/via-registers.rs | 1 - .../custom-target-invalid-llvm-target.rs | 1 - tests/ui/codegen/mismatched-data-layouts.rs | 1 - tests/ui/codegen/passes-default-pipeline.rs | 1 - tests/ui/codegen/target-cpus.rs | 1 - .../function-return/requires-x86-or-x86_64.rs | 1 - .../requires-x86-or-x86_64.rs | 1 - .../invalid/reg-struct-return/requires-x86.rs | 1 - .../invalid/regparm/regparm-valid-values.rs | 1 - .../invalid/regparm/requires-x86.rs | 1 - .../print-request-help-stable-unstable.rs | 1 - ...t-destruct-stable-toolchain.nightly.stderr | 2 +- .../consts/const-destruct-stable-toolchain.rs | 1 - ...st-destruct-stable-toolchain.stable.stderr | 2 +- tests/ui/consts/const-eval/c-variadic.rs | 1 - tests/ui/consts/const-eval/parse_ints.rs | 2 - tests/ui/consts/const-eval/parse_ints.stderr | 4 +- tests/ui/consts/const_cmp_type_id.rs | 1 - tests/ui/consts/const_cmp_type_id.stderr | 2 +- tests/ui/consts/issue-73976-monomorphic.rs | 1 - tests/ui/consts/issue-94675.rs | 2 - tests/ui/consts/issue-94675.stderr | 2 +- tests/ui/consts/issue-miri-1910.rs | 1 - tests/ui/consts/issue-miri-1910.stderr | 2 +- tests/ui/consts/missing_span_in_backtrace.rs | 1 - .../consts/missing_span_in_backtrace.stderr | 14 +-- tests/ui/consts/try-operator.rs | 1 - tests/ui/coroutine/gen_block_panic.rs | 1 - tests/ui/coroutine/gen_block_panic.stderr | 2 +- tests/ui/coroutine/panic-drops-resume.rs | 1 - tests/ui/coroutine/panic-drops.rs | 1 - tests/ui/coroutine/panic-safe.rs | 1 - tests/ui/coroutine/resume-after-return.rs | 1 - tests/ui/coroutine/unwind-abort-mix.rs | 1 - .../ui/crate-loading/missing-target-error.rs | 1 - .../missing-target-no-std-error.rs | 1 - .../mut-ref-write-visible-after-unwind.rs | 1 - .../windows_gnu_split_debuginfo_off.rs | 1 - .../windows_gnu_split_debuginfo_packed.rs | 1 - .../windows_gnu_split_debuginfo_unpacked.rs | 1 - tests/ui/delegation/fn-header-variadic.rs | 1 - tests/ui/delegation/fn-header-variadic.stderr | 4 +- tests/ui/delegation/fn-header.rs | 1 - tests/ui/drop/drop-once-on-panic.rs | 1 - tests/ui/drop/drop-trait-enum.rs | 1 - tests/ui/drop/dynamic-drop-async.rs | 1 - tests/ui/drop/dynamic-drop.rs | 1 - tests/ui/drop/enum-destructor-on-unwind.rs | 1 - tests/ui/drop/move-closure-drop-on-unwind.rs | 1 - tests/ui/drop/panic-during-drop-14875.rs | 1 - tests/ui/drop/panic-during-slice-init.rs | 1 - tests/ui/drop/terminate-in-initializer.rs | 1 - .../explicit-tail-calls/become-cast-return.rs | 1 - .../callee_is_track_caller.rs | 1 - .../callee_is_track_caller.stderr | 2 +- .../callee_is_track_caller_polymorphic.rs | 1 - .../callee_is_track_caller_polymorphic.stderr | 2 +- .../default-trait-method.rs | 1 - tests/ui/explicit-tail-calls/drop-order.rs | 1 - tests/ui/explicit-tail-calls/indexer.rs | 1 - tests/ui/explicit-tail-calls/recursion-etc.rs | 1 - tests/ui/explicit-tail-calls/support/basic.rs | 1 - tests/ui/extern/extern-types-field-offset.rs | 1 - ...at-args-capture-from-pm-first-arg-macro.rs | 1 - ...rgs-capture-from-pm-first-arg-macro.stderr | 2 +- .../location-proc-macro-observer.rs | 1 - .../issue-77523-def-site-async-await.rs | 1 - .../precise-capturing/external-macro.rs | 1 - tests/ui/instrument-xray/platform-support.rs | 1 - .../intrinsics/panic-uninitialized-zeroed.rs | 1 - .../iter-filter-count-debug-check.rs | 1 - tests/ui/iterators/iter-sum-overflow-debug.rs | 1 - .../iter-sum-overflow-overflow-checks.rs | 1 - .../ui/linking/no-gc-encapsulation-symbols.rs | 1 - ...nused-qualification-in-derive-expansion.rs | 1 - tests/ui/macros/same-sequence-span.rs | 1 - tests/ui/macros/same-sequence-span.stderr | 8 +- tests/ui/mir/mir_drop_order.rs | 1 - tests/ui/mir/mir_let_chains_drop_order.rs | 1 - .../mir_match_guard_let_chains_drop_order.rs | 1 - .../ui/numbers-arithmetic/int-abs-overflow.rs | 1 - tests/ui/numbers-arithmetic/issue-8460.rs | 1 - .../catch-unwind-during-unwind-68696.rs | 1 - .../abort-link-to-unwinding-crates.rs | 1 - tests/ui/panic-runtime/abort.rs | 1 - tests/ui/panic-runtime/link-to-abort.rs | 1 - tests/ui/panics/alloc_error_hook-unwind.rs | 1 - tests/ui/panics/lsda-multiple-action.rs | 1 - ...panic-abort-backtrace-without-debuginfo.rs | 1 - .../panics/panic-handler-chain-update-hook.rs | 1 - tests/ui/panics/panic-handler-chain.rs | 1 - tests/ui/panics/panic-handler-flail-wildly.rs | 1 - tests/ui/panics/panic-handler-set-twice.rs | 1 - tests/ui/panics/panic-in-dtor-drops-fields.rs | 1 - tests/ui/panics/panic-recover-propagate.rs | 1 - .../panics/rvalue-cleanup-during-box-panic.rs | 1 - .../panics/unwind-force-no-unwind-tables.rs | 1 - ...971-outer-attr-following-inner-attr-ice.rs | 1 - ...outer-attr-following-inner-attr-ice.stderr | 2 +- .../unicode-control-codepoints-macros.rs | 1 - .../unicode-control-codepoints-macros.stderr | 10 +- .../parser/tuple-index-suffix-proc-macro.rs | 1 - .../tuple-index-suffix-proc-macro.stderr | 8 +- tests/ui/parser/unclosed-delimiter-in-dep.rs | 2 - ...nable_pointer_authentication_validation.rs | 1 - .../invalid_target_pointer_authentication.rs | 1 - ...on_not_supported_pointer_authentication.rs | 1 - tests/ui/proc-macro/add-impl.rs | 1 - .../ambiguous-builtin-attrs-test.rs | 1 - .../ambiguous-builtin-attrs-test.stderr | 2 +- .../ui/proc-macro/ambiguous-builtin-attrs.rs | 1 - .../proc-macro/ambiguous-builtin-attrs.stderr | 30 ++--- tests/ui/proc-macro/append-impl.rs | 1 - tests/ui/proc-macro/attr-args.rs | 1 - tests/ui/proc-macro/attr-invalid-exprs.rs | 1 - tests/ui/proc-macro/attr-invalid-exprs.stderr | 6 +- tests/ui/proc-macro/attr-on-trait.rs | 1 - tests/ui/proc-macro/bang-macro.rs | 1 - tests/ui/proc-macro/call-site.rs | 1 - tests/ui/proc-macro/count_compound_ops.rs | 1 - tests/ui/proc-macro/derive-bad.rs | 1 - tests/ui/proc-macro/derive-bad.stderr | 6 +- ...derive-helper-shadowing.edition2015.stderr | 14 +-- ...derive-helper-shadowing.edition2018.stderr | 18 +-- .../ui/proc-macro/derive-helper-shadowing.rs | 1 - tests/ui/proc-macro/derive-same-struct.rs | 1 - tests/ui/proc-macro/edition-imports-2018.rs | 1 - tests/ui/proc-macro/env.rs | 1 - tests/ui/proc-macro/expand-to-unstable.rs | 1 - tests/ui/proc-macro/expand-to-unstable.stderr | 2 +- tests/ui/proc-macro/expand-with-a-macro.rs | 1 - .../ui/proc-macro/gen-macro-rules-hygiene.rs | 1 - .../proc-macro/gen-macro-rules-hygiene.stderr | 10 +- tests/ui/proc-macro/gen-macro-rules.rs | 1 - tests/ui/proc-macro/generate-mod.rs | 1 - tests/ui/proc-macro/generate-mod.stderr | 28 ++--- tests/ui/proc-macro/hygiene_example.rs | 1 - tests/ui/proc-macro/is-available.rs | 1 - .../issue-104884-trait-impl-sugg-err.rs | 1 - .../issue-104884-trait-impl-sugg-err.stderr | 18 +-- tests/ui/proc-macro/issue-107113-wrap.rs | 1 - tests/ui/proc-macro/issue-107113-wrap.stderr | 2 +- tests/ui/proc-macro/issue-118809.rs | 1 - tests/ui/proc-macro/issue-118809.stderr | 4 +- tests/ui/proc-macro/issue-38586.rs | 1 - tests/ui/proc-macro/issue-38586.stderr | 2 +- .../issue-59191-replace-root-with-fn.rs | 1 - tests/ui/proc-macro/issue-79148.rs | 1 - tests/ui/proc-macro/issue-79148.stderr | 4 +- tests/ui/proc-macro/issue-83510.rs | 1 - tests/ui/proc-macro/issue-83510.stderr | 8 +- tests/ui/proc-macro/issue-91800.rs | 1 - tests/ui/proc-macro/issue-91800.stderr | 14 +-- tests/ui/proc-macro/lifetimes-rpass.rs | 1 - tests/ui/proc-macro/lints_in_proc_macros.rs | 1 - .../ui/proc-macro/lints_in_proc_macros.stderr | 2 +- tests/ui/proc-macro/load-two.rs | 1 - .../proc-macro/macro-crate-multi-decorator.rs | 1 - .../proc-macro/macro_rules_edition_from_pm.rs | 1 - tests/ui/proc-macro/match-expander.rs | 1 - tests/ui/proc-macro/match-expander.stderr | 2 +- tests/ui/proc-macro/mixed-site-span.rs | 1 - tests/ui/proc-macro/mixed-site-span.stderr | 108 +++++++++--------- tests/ui/proc-macro/modify-ast.rs | 1 - tests/ui/proc-macro/nonfatal-parsing.rs | 1 - tests/ui/proc-macro/nonfatal-parsing.stderr | 22 ++-- tests/ui/proc-macro/parent-source-spans.rs | 1 - .../ui/proc-macro/parent-source-spans.stderr | 42 +++---- tests/ui/proc-macro/quote/basic.rs | 1 - tests/ui/proc-macro/span-api-tests.rs | 1 - tests/ui/proc-macro/span-from-proc-macro.rs | 1 - .../ui/proc-macro/span-from-proc-macro.stderr | 8 +- tests/ui/proc-macro/test.rs | 1 - tests/ui/proc-macro/weird-hygiene.rs | 1 - tests/ui/proc-macro/weird-hygiene.stderr | 8 +- tests/ui/process/multi-panic.rs | 1 - tests/ui/process/println-with-broken-pipe.rs | 1 - tests/ui/process/process-panic-after-fork.rs | 1 - tests/ui/repr/16-bit-repr-c-enum.rs | 1 - tests/ui/resolve/prelude-order.rs | 1 - tests/ui/resolve/prelude-order.stderr | 10 +- .../dont-suggest-unstable-type.nightly.stderr | 2 +- .../suggestions/dont-suggest-unstable-type.rs | 1 - .../dont-suggest-unstable-type.stable.stderr | 2 +- .../std-panic-locations.default.stderr | 2 +- .../std-panic-locations.mir-opt.stderr | 2 +- .../std-panic-locations.rs | 1 - .../edition-spans.rs | 1 - .../runtime/on-broken-pipe/child-processes.rs | 1 - tests/ui/runtime/out-of-stack.rs | 1 - tests/ui/runtime/rt-explody-panic-payloads.rs | 1 - .../suggestions-not-always-applicable.fixed | 1 - .../suggestions-not-always-applicable.rs | 1 - .../rust-2021/reserved-prefixes-via-macro.rs | 1 - .../reserved-guarded-strings-via-macro.rs | 1 - .../unsafe-attributes-from-pm-in-2024.rs | 1 - .../unsafe-attributes-from-pm-in-2024.stderr | 8 +- .../unsafe-attributes-from-pm.rs | 1 - .../ui/scalable-vectors/project-into-field.rs | 1 - tests/ui/sepcomp/sepcomp-unwind.rs | 1 - .../simd/intrinsic/generic-arithmetic-pass.rs | 1 - tests/ui/simd/intrinsic/generic-as.rs | 1 - tests/ui/simd/issue-17170.rs | 1 - tests/ui/simd/masked-load-store.rs | 1 - tests/ui/simd/target-feature-mixup.rs | 1 - .../warn-stack-protector-unsupported.rs | 1 - tests/ui/structs/unit-like-struct-drop-run.rs | 1 - tests/ui/suggestions/issue-61963.rs | 1 - tests/ui/suggestions/issue-61963.stderr | 6 +- tests/ui/suggestions/suggest-ref-macro.rs | 1 - tests/ui/suggestions/suggest-ref-macro.stderr | 12 +- tests/ui/target-cpu/explicit-target-cpu.rs | 1 - tests/ui/target-cpu/unsupported-target-cpu.rs | 1 - ...incompatible-target-feature-flag-enable.rs | 1 - ...-irrelevant-target-feature-flag-disable.rs | 1 - .../abi-relevant-target-modifier.rs | 1 - .../abi-required-target-feature-attribute.rs | 1 - ...bi-required-target-feature-flag-disable.rs | 1 - ...ed-target-feature-missing-in-target-cpu.rs | 1 - tests/ui/target-feature/feature-hierarchy.rs | 1 - .../forbidden-target-feature-cfg.rs | 1 - .../forbidden-target-feature-flag-disable.rs | 1 - .../forbidden-target-feature-flag.rs | 1 - .../packedstack-combinations.rs | 1 - tests/ui/target-feature/tied-features-cli.rs | 1 - .../tied-features-no-implication-1.rs | 1 - .../unstable-target-feature-on-nightly.rs | 2 - tests/ui/target-feature/x86-soft-float-cfg.rs | 1 - tests/ui/target_modifiers/auxiliary/pauth.rs | 1 - .../auxiliary/sanitizer_default_explicit.rs | 1 - .../auxiliary/sanitizer_default_implicit.rs | 1 - .../auxiliary/sanitizer_non_default.rs | 1 - .../auxiliary/target_cpu_default_explicit.rs | 1 - .../auxiliary/target_cpu_default_implicit.rs | 1 - .../auxiliary/target_cpu_non_default.rs | 1 - tests/ui/target_modifiers/defaults_check.rs | 1 - .../target_modifiers/incompatible_fixedx18.rs | 1 - .../ui/target_modifiers/incompatible_pauth.rs | 1 - .../target_modifiers/incompatible_regparm.rs | 1 - tests/ui/target_modifiers/no_value_bool.rs | 1 - .../ui/target_modifiers/sanitizer_default.rs | 1 - .../ui/target_modifiers/target_cpu_default.rs | 1 - tests/ui/target_modifiers/two_flags.rs | 1 - .../test-attrs/test-panic-while-printing.rs | 1 - tests/ui/threads-sendsync/task-stderr.rs | 1 - tests/ui/threads-sendsync/unwind-resource.rs | 1 - ...issing-unstable-trait-bound.nightly.stderr | 2 +- .../missing-unstable-trait-bound.rs | 1 - ...missing-unstable-trait-bound.stable.stderr | 2 +- tests/ui/traits/clone-unwind-rc-cleanup.rs | 1 - .../const-drop-fail.new_precise.stderr | 12 +- .../const-drop-fail.new_stock.stderr | 12 +- .../const-drop-fail.old_precise.stderr | 12 +- .../const-drop-fail.old_stock.stderr | 12 +- .../ui/traits/const-traits/const-drop-fail.rs | 1 - ...supertrait-unstable.nightly-enabled.stderr | 18 +-- .../const-supertrait-unstable.nightly.stderr | 22 ++-- .../const-traits/const-supertrait-unstable.rs | 1 - ...-supertrait-unstable.stable-enabled.stderr | 30 ++--- .../const-supertrait-unstable.stable.stderr | 32 +++--- ...alid-sugg-for-derive-macro-issue-136343.rs | 1 - ...-sugg-for-derive-macro-issue-136343.stderr | 2 +- .../uninhabited-transparent-return-abi.rs | 1 - .../unsafe-binders-debuginfo.rs | 1 - 322 files changed, 333 insertions(+), 596 deletions(-) diff --git a/tests/ui/abi/abi-sysv64-arg-passing.rs b/tests/ui/abi/abi-sysv64-arg-passing.rs index e21ca94aa6e8f..602f3e467f528 100644 --- a/tests/ui/abi/abi-sysv64-arg-passing.rs +++ b/tests/ui/abi/abi-sysv64-arg-passing.rs @@ -28,7 +28,6 @@ //@ ignore-arm //@ ignore-aarch64 //@ ignore-windows -//@ ignore-backends: gcc // Windows is ignored because bootstrap doesn't yet know to compile rust_test_helpers with // the sysv64 ABI on Windows. diff --git a/tests/ui/abi/abi-sysv64-register-usage.rs b/tests/ui/abi/abi-sysv64-register-usage.rs index 576af8e696438..12c597b43c1f5 100644 --- a/tests/ui/abi/abi-sysv64-register-usage.rs +++ b/tests/ui/abi/abi-sysv64-register-usage.rs @@ -6,7 +6,6 @@ //@ ignore-arm //@ ignore-aarch64 //@ needs-asm-support -//@ ignore-backends: gcc #[cfg(target_arch = "x86_64")] pub extern "sysv64" fn all_the_registers( diff --git a/tests/ui/abi/arm-unadjusted-intrinsic.rs b/tests/ui/abi/arm-unadjusted-intrinsic.rs index 6068ef539133a..11577211fe2c3 100644 --- a/tests/ui/abi/arm-unadjusted-intrinsic.rs +++ b/tests/ui/abi/arm-unadjusted-intrinsic.rs @@ -6,7 +6,6 @@ //@ revisions: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![feature(no_core, lang_items, link_llvm_intrinsics, arm_target_feature)] #![no_std] #![no_core] diff --git a/tests/ui/abi/avr-sram.rs b/tests/ui/abi/avr-sram.rs index 7b8ec5ee8fa0c..a7cdf6ec2c7d0 100644 --- a/tests/ui/abi/avr-sram.rs +++ b/tests/ui/abi/avr-sram.rs @@ -18,7 +18,6 @@ //@[default_cpu] compile-flags: --target avr-none //@[default_cpu] needs-llvm-components: avr // -//@ ignore-backends: gcc // //[no_sram,disable_sram]~? WARN target feature `sram` must be enabled //[disable_sram]~? WARN target feature `sram` cannot be disabled with `-Ctarget-feature` diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 666910789dfb7..1116cb1a7e0fb 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -85,7 +85,6 @@ //@ revisions: nvptx64 //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx64] needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core, rustc_attrs, lang_items)] #![feature(unsized_fn_params, transparent_unions)] #![no_core] diff --git a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs index 21c6c276bb1c7..9fb2edb7bd5f9 100644 --- a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs +++ b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-subprocess -//@ ignore-backends: gcc //@ ignore-i586 (no SSE2) #![allow(overflowing_literals)] diff --git a/tests/ui/abi/interrupt-returns-never-or-unit.rs b/tests/ui/abi/interrupt-returns-never-or-unit.rs index 75786730a2ca4..52f2594e80179 100644 --- a/tests/ui/abi/interrupt-returns-never-or-unit.rs +++ b/tests/ui/abi/interrupt-returns-never-or-unit.rs @@ -21,7 +21,6 @@ This test uses `cfg` because it is not testing whether these ABIs work on the pl //@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib -//@ ignore-backends: gcc #![no_core] #![feature( no_core, diff --git a/tests/ui/abi/issue-28676.rs b/tests/ui/abi/issue-28676.rs index 616ed6bde24b1..6fc26ac307c0d 100644 --- a/tests/ui/abi/issue-28676.rs +++ b/tests/ui/abi/issue-28676.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![allow(dead_code)] diff --git a/tests/ui/abi/large-byval-align.rs b/tests/ui/abi/large-byval-align.rs index 7e640fb42a3cb..7b6538c818b41 100644 --- a/tests/ui/abi/large-byval-align.rs +++ b/tests/ui/abi/large-byval-align.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Copt-level=0 //@ only-x86_64 //@ build-pass -//@ ignore-backends: gcc #[repr(C, align(536870912))] pub struct A(i64); diff --git a/tests/ui/abi/numbers-arithmetic/float-struct.rs b/tests/ui/abi/numbers-arithmetic/float-struct.rs index dc4c536a14e2d..a958dc272722f 100644 --- a/tests/ui/abi/numbers-arithmetic/float-struct.rs +++ b/tests/ui/abi/numbers-arithmetic/float-struct.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc use std::fmt::Debug; use std::hint::black_box; diff --git a/tests/ui/abi/pass-indirectly-attr.rs b/tests/ui/abi/pass-indirectly-attr.rs index bb90b8354ea91..72a5678b91753 100644 --- a/tests/ui/abi/pass-indirectly-attr.rs +++ b/tests/ui/abi/pass-indirectly-attr.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ check-fail //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" -//@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type = "lib"] diff --git a/tests/ui/abi/pass-indirectly-attr.stderr b/tests/ui/abi/pass-indirectly-attr.stderr index f2ba517a43a6e..600e38004908d 100644 --- a/tests/ui/abi/pass-indirectly-attr.stderr +++ b/tests/ui/abi/pass-indirectly-attr.stderr @@ -1,5 +1,5 @@ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/pass-indirectly-attr.rs:35:1 + --> $DIR/pass-indirectly-attr.rs:34:1 | LL | #[rustc_pass_indirectly_in_non_rustic_abis] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ error: fn_abi_of(extern_c) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/pass-indirectly-attr.rs:20:1 + --> $DIR/pass-indirectly-attr.rs:19:1 | LL | pub extern "C" fn extern_c(_: Type) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,7 +171,7 @@ error: fn_abi_of(extern_rust) = FnAbi { conv: Rust, can_unwind: false, } - --> $DIR/pass-indirectly-attr.rs:27:1 + --> $DIR/pass-indirectly-attr.rs:26:1 | LL | pub extern "Rust" fn extern_rust(_: Type) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/s390x-softfloat-gate.rs b/tests/ui/abi/s390x-softfloat-gate.rs index 496929eb09551..f8e05ebef2ed4 100644 --- a/tests/ui/abi/s390x-softfloat-gate.rs +++ b/tests/ui/abi/s390x-softfloat-gate.rs @@ -11,7 +11,6 @@ //@ [disable-softfloat] compile-flags: --target=s390x-unknown-linux-gnu //@ [disable-softfloat] compile-flags: -C target-feature=+soft-float //@ [disable-softfloat] needs-llvm-components: systemz -//@ ignore-backends: gcc //[disable-softfloat]~? WARN target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly //[disable-softfloat]~? WARN target feature `soft-float` cannot be enabled with `-Ctarget-feature` diff --git a/tests/ui/abi/segfault-no-out-of-stack.rs b/tests/ui/abi/segfault-no-out-of-stack.rs index b122079d36f76..5e8b4e0dbf2a6 100644 --- a/tests/ui/abi/segfault-no-out-of-stack.rs +++ b/tests/ui/abi/segfault-no-out-of-stack.rs @@ -2,7 +2,6 @@ //@ needs-subprocess //@ compile-flags: -Zub-checks=no -Zmir-enable-passes=-CheckNull //@ ignore-fuchsia must translate zircon signal to SIGSEGV/SIGBUS, FIXME (#58590) -//@ ignore-backends: gcc #![feature(rustc_private)] diff --git a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs index 824327ad06d36..b3bd0666ab21f 100644 --- a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs +++ b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs @@ -1,7 +1,6 @@ //@ compile-flags: --target aarch64-unknown-none -Zsanitizer=shadow-call-stack //@ dont-check-compiler-stderr //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![allow(internal_features)] #![crate_type = "rlib"] diff --git a/tests/ui/abi/stack-probes.rs b/tests/ui/abi/stack-probes.rs index be36eeefc31ea..c6a72fde0123c 100644 --- a/tests/ui/abi/stack-probes.rs +++ b/tests/ui/abi/stack-probes.rs @@ -11,7 +11,6 @@ //@ ignore-tvos Stack probes are enabled, but the SIGSEGV handler isn't //@ ignore-watchos Stack probes are enabled, but the SIGSEGV handler isn't //@ ignore-visionos Stack probes are enabled, but the SIGSEGV handler isn't -//@ ignore-backends: gcc use std::env; use std::mem::MaybeUninit; diff --git a/tests/ui/abi/stack-protector.rs b/tests/ui/abi/stack-protector.rs index 560b29576f3ab..ee12b541a3d53 100644 --- a/tests/ui/abi/stack-protector.rs +++ b/tests/ui/abi/stack-protector.rs @@ -4,7 +4,6 @@ //@ [ssp] compile-flags: -Z stack-protector=all -Z allow-partial-mitigations=stack-protector //@ compile-flags: -C opt-level=2 //@ compile-flags: -g -//@ ignore-backends: gcc #![allow(function_casts_as_integer)] diff --git a/tests/ui/abi/struct-enums/struct-return.rs b/tests/ui/abi/struct-enums/struct-return.rs index 5fe80d5f670b2..b8492de4974fa 100644 --- a/tests/ui/abi/struct-enums/struct-return.rs +++ b/tests/ui/abi/struct-enums/struct-return.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![allow(dead_code)] diff --git a/tests/ui/abi/swift-abi-non-apple.rs b/tests/ui/abi/swift-abi-non-apple.rs index a374f38c9c8eb..3ef85cf2003ba 100644 --- a/tests/ui/abi/swift-abi-non-apple.rs +++ b/tests/ui/abi/swift-abi-non-apple.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib -//@ ignore-backends: gcc #![no_core] #![feature(no_core, lang_items, abi_swift)] diff --git a/tests/ui/abi/swift-abi-non-apple.stderr b/tests/ui/abi/swift-abi-non-apple.stderr index 7dae75c96d46a..af0f5dd4ebaeb 100644 --- a/tests/ui/abi/swift-abi-non-apple.stderr +++ b/tests/ui/abi/swift-abi-non-apple.stderr @@ -1,41 +1,41 @@ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:14:8 + --> $DIR/swift-abi-non-apple.rs:13:8 | LL | extern "Swift" fn f() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:17:12 + --> $DIR/swift-abi-non-apple.rs:16:12 | LL | extern "Swift" fn m(); | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:19:12 + --> $DIR/swift-abi-non-apple.rs:18:12 | LL | extern "Swift" fn dm() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:24:12 + --> $DIR/swift-abi-non-apple.rs:23:12 | LL | extern "Swift" fn m() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:28:12 + --> $DIR/swift-abi-non-apple.rs:27:12 | LL | extern "Swift" fn im() {} | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:31:18 + --> $DIR/swift-abi-non-apple.rs:30:18 | LL | type TA = extern "Swift" fn(); | ^^^^^^^ error[E0570]: "Swift" is not a supported ABI for the current target - --> $DIR/swift-abi-non-apple.rs:33:8 + --> $DIR/swift-abi-non-apple.rs:32:8 | LL | extern "Swift" {} | ^^^^^^^ diff --git a/tests/ui/abi/variadic-ffi.rs b/tests/ui/abi/variadic-ffi.rs index 0f6183d6e2d40..293dc74fabec7 100644 --- a/tests/ui/abi/variadic-ffi.rs +++ b/tests/ui/abi/variadic-ffi.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc use std::ffi::VaList; diff --git a/tests/ui/abi/x86stdcall.rs b/tests/ui/abi/x86stdcall.rs index 77866c30f0e49..c1bd35b80d266 100644 --- a/tests/ui/abi/x86stdcall.rs +++ b/tests/ui/abi/x86stdcall.rs @@ -1,6 +1,5 @@ //@ run-pass //@ only-windows -//@ ignore-backends: gcc // GetLastError doesn't seem to work with stack switching #[cfg(windows)] diff --git a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs index 7b7ca2f6cc6bd..1b0f0608fc61b 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs @@ -2,7 +2,6 @@ //@ ignore-android no libc //@ ignore-emscripten no libc //@ ignore-sgx no libc -//@ ignore-backends: gcc //@ only-linux //@ compile-flags:-C panic=abort //@ aux-build:helper.rs diff --git a/tests/ui/allocator/no_std-alloc-error-handler-default.rs b/tests/ui/allocator/no_std-alloc-error-handler-default.rs index 5a6c0b33d5108..51ecf1a6731ac 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-default.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-default.rs @@ -2,7 +2,6 @@ //@ ignore-android no libc //@ ignore-emscripten no libc //@ ignore-sgx no libc -//@ ignore-backends: gcc //@ only-linux //@ compile-flags:-C panic=abort //@ aux-build:helper.rs diff --git a/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs b/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs index 5f4e381c983a2..c7c05946c4ca9 100644 --- a/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs +++ b/tests/ui/array-slice-vec/box-of-array-of-drop-1.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs b/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs index ea37d3e721264..98175a26ec0d1 100644 --- a/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs +++ b/tests/ui/array-slice-vec/box-of-array-of-drop-2.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/nested-vec-3.rs b/tests/ui/array-slice-vec/nested-vec-3.rs index e3c04ed6f6bf0..51975743742cf 100644 --- a/tests/ui/array-slice-vec/nested-vec-3.rs +++ b/tests/ui/array-slice-vec/nested-vec-3.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![allow(overflowing_literals)] diff --git a/tests/ui/array-slice-vec/slice-panic-1.rs b/tests/ui/array-slice-vec/slice-panic-1.rs index 60680c367a671..9c66cd285aeb4 100644 --- a/tests/ui/array-slice-vec/slice-panic-1.rs +++ b/tests/ui/array-slice-vec/slice-panic-1.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Test that if a slicing expr[..] fails, the correct cleanups happen. diff --git a/tests/ui/array-slice-vec/slice-panic-2.rs b/tests/ui/array-slice-vec/slice-panic-2.rs index e5ba045248da2..b2b841642ae4b 100644 --- a/tests/ui/array-slice-vec/slice-panic-2.rs +++ b/tests/ui/array-slice-vec/slice-panic-2.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Test that if a slicing expr[..] fails, the correct cleanups happen. diff --git a/tests/ui/asm/aarch64/aarch64-sve.rs b/tests/ui/asm/aarch64/aarch64-sve.rs index daa4ab98dee75..ac19b7bc98131 100644 --- a/tests/ui/asm/aarch64/aarch64-sve.rs +++ b/tests/ui/asm/aarch64/aarch64-sve.rs @@ -2,7 +2,6 @@ //@ add-minicore //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![crate_type = "rlib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/aarch64/ttbr0_el2.rs b/tests/ui/asm/aarch64/ttbr0_el2.rs index 4032c70ed03c0..5e1e12de6f9c3 100644 --- a/tests/ui/asm/aarch64/ttbr0_el2.rs +++ b/tests/ui/asm/aarch64/ttbr0_el2.rs @@ -3,7 +3,6 @@ //@ build-pass //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/aarch64v8r.rs b/tests/ui/asm/aarch64v8r.rs index abc254ad5f8ee..4136c3e99763e 100644 --- a/tests/ui/asm/aarch64v8r.rs +++ b/tests/ui/asm/aarch64v8r.rs @@ -11,7 +11,6 @@ //@ [r82] compile-flags: --target aarch64v8r-unknown-none -C target-cpu=cortex-r82 //@ [r82] needs-llvm-components: aarch64 //@ build-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/arm-low-dreg.rs b/tests/ui/asm/arm-low-dreg.rs index 6c1491ff06641..26f594f8362af 100644 --- a/tests/ui/asm/arm-low-dreg.rs +++ b/tests/ui/asm/arm-low-dreg.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target=armv7-unknown-linux-gnueabihf //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/asm/cortex-r82.rs b/tests/ui/asm/cortex-r82.rs index 74313e5cb48c1..c7a13ad7dccbd 100644 --- a/tests/ui/asm/cortex-r82.rs +++ b/tests/ui/asm/cortex-r82.rs @@ -4,7 +4,6 @@ //@ compile-flags: --target aarch64v8r-unknown-none -C target-cpu=cortex-r82 //@ needs-llvm-components: aarch64 //@ build-pass -//@ ignore-backends: gcc #![deny(dead_code)] #![feature(no_core)] diff --git a/tests/ui/asm/global-target-feature.rs b/tests/ui/asm/global-target-feature.rs index d84b4d51e6582..c3e4a171a663d 100644 --- a/tests/ui/asm/global-target-feature.rs +++ b/tests/ui/asm/global-target-feature.rs @@ -1,7 +1,6 @@ //@ build-pass //@ add-minicore //@ min-llvm-version: 23 -//@ ignore-backends: gcc // //@ revisions: riscv opt-0-bitcode-no opt-0 opt-s-bitcode-no // diff --git a/tests/ui/asm/issue-92378.rs b/tests/ui/asm/issue-92378.rs index 89ef2247d84b3..7a41ed5993aea 100644 --- a/tests/ui/asm/issue-92378.rs +++ b/tests/ui/asm/issue-92378.rs @@ -2,7 +2,6 @@ //@ compile-flags: --target armv5te-unknown-linux-gnueabi //@ needs-llvm-components: arm //@ build-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/naked-functions/shim.rs b/tests/ui/asm/naked-functions/shim.rs index 8d5b87f0bedde..218f9a670fe90 100644 --- a/tests/ui/asm/naked-functions/shim.rs +++ b/tests/ui/asm/naked-functions/shim.rs @@ -8,7 +8,6 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/ui/asm/thumbv6m-clobber-abi-r14.rs b/tests/ui/asm/thumbv6m-clobber-abi-r14.rs index 342e65b52d9d8..bf4f724f28751 100644 --- a/tests/ui/asm/thumbv6m-clobber-abi-r14.rs +++ b/tests/ui/asm/thumbv6m-clobber-abi-r14.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv6m-none-eabi //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs index 9978a4856a81f..5d3bbbb74bf56 100644 --- a/tests/ui/asm/x86_64/issue-96797.rs +++ b/tests/ui/asm/x86_64/issue-96797.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target x86_64-unknown-linux-gnu -O //@ needs-llvm-components: x86 -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core)] #![no_core] diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs index d6180bb2f45d8..4bafb39f60096 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ edition: 2021 //@ known-bug: #108309 diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index 4feaee82fef79..fb80fe2b5a0d8 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -1,12 +1,12 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:14:35 + --> $DIR/dont-project-to-specializable-projection.rs:13:35 | LL | impl MyTrait for MyStruct { LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^ expected associated type, found future | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:10:27 + --> $DIR/dont-project-to-specializable-projection.rs:9:27 | LL | trait MyTrait { LL | async fn foo(_: T) -> &'static str; @@ -15,7 +15,7 @@ LL | async fn foo(_: T) -> &'static str; found signature `fn(_) -> impl Future` error: async associated function in trait cannot be specialized - --> $DIR/dont-project-to-specializable-projection.rs:14:5 + --> $DIR/dont-project-to-specializable-projection.rs:13:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | default async fn foo(_: T) -> &'static str { = note: specialization behaves in inconsistent and surprising ways with async functions in traits, and for now is disallowed error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future>` in the current scope - --> $DIR/dont-project-to-specializable-projection.rs:49:28 + --> $DIR/dont-project-to-specializable-projection.rs:48:28 | LL | match fut.as_mut().poll(ctx) { | ^^^^ method not found in `Pin<&mut impl Future>` diff --git a/tests/ui/attributes/main-removed-2/main.rs b/tests/ui/attributes/main-removed-2/main.rs index 21a05dc4b40be..53696d68ced07 100644 --- a/tests/ui/attributes/main-removed-2/main.rs +++ b/tests/ui/attributes/main-removed-2/main.rs @@ -2,7 +2,6 @@ //@ proc-macro: tokyo.rs //@ compile-flags:--extern tokyo //@ edition:2021 -//@ ignore-backends: gcc use tokyo::main; diff --git a/tests/ui/backtrace/dylib-dep.rs b/tests/ui/backtrace/dylib-dep.rs index a51ce3d8d04cc..e01a6ade1d368 100644 --- a/tests/ui/backtrace/dylib-dep.rs +++ b/tests/ui/backtrace/dylib-dep.rs @@ -13,7 +13,6 @@ //@ ignore-watchos needs the `.dSYM` files to be moved to the device //@ ignore-visionos needs the `.dSYM` files to be moved to the device //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -g -Copt-level=0 -Cstrip=none -Cforce-frame-pointers=yes //@ ignore-wasm Requires custom symbolization code //@ aux-crate: dylib_dep_helper=dylib-dep-helper.rs diff --git a/tests/ui/backtrace/synchronized-panic-handler.rs b/tests/ui/backtrace/synchronized-panic-handler.rs index ef7cc1faec8de..29431ae3c458a 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.rs +++ b/tests/ui/backtrace/synchronized-panic-handler.rs @@ -4,7 +4,6 @@ //@ exec-env:RUST_BACKTRACE=0 //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; const PANIC_MESSAGE: &str = "oops oh no woe is me"; diff --git a/tests/ui/backtrace/synchronized-panic-handler.run.stderr b/tests/ui/backtrace/synchronized-panic-handler.run.stderr index 5296a0d39ff30..c604d49c193c5 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.run.stderr +++ b/tests/ui/backtrace/synchronized-panic-handler.run.stderr @@ -1,7 +1,7 @@ -thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5: +thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:12:5: +thread '' ($TID) panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me diff --git a/tests/ui/c-variadic/copy.rs b/tests/ui/c-variadic/copy.rs index 7befce36902c7..9f9c56f65da70 100644 --- a/tests/ui/c-variadic/copy.rs +++ b/tests/ui/c-variadic/copy.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // Test the behavior of `VaList::clone`. In C a `va_list` is duplicated using `va_copy`, but the // rust api just uses `Clone`. This should create a completely independent cursor into the diff --git a/tests/ui/c-variadic/inherent-method.rs b/tests/ui/c-variadic/inherent-method.rs index 5f5cdc76d4a2e..156187fd67335 100644 --- a/tests/ui/c-variadic/inherent-method.rs +++ b/tests/ui/c-variadic/inherent-method.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #[repr(transparent)] struct S(i32); diff --git a/tests/ui/c-variadic/naked-invalid.rs b/tests/ui/c-variadic/naked-invalid.rs index 0cd37c94b6764..8d0b5607b5840 100644 --- a/tests/ui/c-variadic/naked-invalid.rs +++ b/tests/ui/c-variadic/naked-invalid.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ compile-flags: --target x86_64-unknown-linux-gnu //@ needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core, lang_items, rustc_attrs)] #![feature(abi_x86_interrupt, naked_functions_rustic_abi)] diff --git a/tests/ui/c-variadic/naked-invalid.stderr b/tests/ui/c-variadic/naked-invalid.stderr index 0842be296fe33..8d81bd0e10a11 100644 --- a/tests/ui/c-variadic/naked-invalid.stderr +++ b/tests/ui/c-variadic/naked-invalid.stderr @@ -1,5 +1,5 @@ error: `...` is not supported for `extern "Rust"` naked functions - --> $DIR/naked-invalid.rs:26:41 + --> $DIR/naked-invalid.rs:25:41 | LL | unsafe extern "Rust" fn c_variadic_rust(_: ...) { | ------------- ^^^^^^ @@ -9,7 +9,7 @@ LL | unsafe extern "Rust" fn c_variadic_rust(_: ...) { = help: C-variadic function must have a compatible calling convention error: `...` is not supported for `extern "x86-interrupt"` naked functions - --> $DIR/naked-invalid.rs:32:59 + --> $DIR/naked-invalid.rs:31:59 | LL | unsafe extern "x86-interrupt" fn c_variadic_x86_interrupt(_: ...) { | ---------------------- ^^^^^^ @@ -19,7 +19,7 @@ LL | unsafe extern "x86-interrupt" fn c_variadic_x86_interrupt(_: ...) { = help: C-variadic function must have a compatible calling convention error[E0703]: invalid ABI: found `nonsense` - --> $DIR/naked-invalid.rs:38:15 + --> $DIR/naked-invalid.rs:37:15 | LL | unsafe extern "nonsense" fn c_variadic_x86_nonsense(_: ...) { | ^^^^^^^^^^ invalid ABI diff --git a/tests/ui/c-variadic/roundtrip.rs b/tests/ui/c-variadic/roundtrip.rs index 992daa139a1fd..ba1f7f3bea8aa 100644 --- a/tests/ui/c-variadic/roundtrip.rs +++ b/tests/ui/c-variadic/roundtrip.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![feature( const_c_variadic, c_variadic_va_arg_safe, diff --git a/tests/ui/c-variadic/trait-method.rs b/tests/ui/c-variadic/trait-method.rs index 9a3ba87614214..557fbfe1a059c 100644 --- a/tests/ui/c-variadic/trait-method.rs +++ b/tests/ui/c-variadic/trait-method.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #[repr(transparent)] struct Struct(i32); diff --git a/tests/ui/c-variadic/valid.rs b/tests/ui/c-variadic/valid.rs index 9d937e611afe8..fba85cca8dc48 100644 --- a/tests/ui/c-variadic/valid.rs +++ b/tests/ui/c-variadic/valid.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // In rust (and C23 and above) `...` can be the only argument. unsafe extern "C" fn only_dot_dot_dot(mut ap: ...) -> i32 { diff --git a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs index 2ca004d9a906d..cafb7389e29fa 100644 --- a/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs +++ b/tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs @@ -2,7 +2,6 @@ //@ proc-macro: ver-cfg-rel.rs //@ revisions: assume no_assume //@ [assume]compile-flags: -Z assume-incomplete-release -//@ ignore-backends: gcc #![feature(cfg_version)] diff --git a/tests/ui/cfg/cfg-panic-abort.rs b/tests/ui/cfg/cfg-panic-abort.rs index af4e119ef9fe3..b3255476c64c2 100644 --- a/tests/ui/cfg/cfg-panic-abort.rs +++ b/tests/ui/cfg/cfg-panic-abort.rs @@ -1,7 +1,6 @@ //@ build-pass //@ compile-flags: -C panic=abort //@ no-prefer-dynamic -//@ ignore-backends: gcc //@ reference: cfg.panic.def //@ reference: cfg.panic.values diff --git a/tests/ui/cfg/cfg_target_object_format.rs b/tests/ui/cfg/cfg_target_object_format.rs index cea2027b35c0b..dcb54d177cb48 100644 --- a/tests/ui/cfg/cfg_target_object_format.rs +++ b/tests/ui/cfg/cfg_target_object_format.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ check-pass -//@ ignore-backends: gcc // //@ revisions: linux_gnu linux_musl linux_ohos linux_powerpc //@[linux_gnu] compile-flags: --target aarch64-unknown-linux-gnu diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs index 21b6af9b55605..4e2cef3bc16e4 100644 --- a/tests/ui/check-cfg/values-target-json.rs +++ b/tests/ui/check-cfg/values-target-json.rs @@ -6,7 +6,6 @@ //@ needs-llvm-components: x86 //@ compile-flags: --crate-type=lib --check-cfg=cfg() //@ compile-flags: -Zunstable-options --target={{src-base}}/check-cfg/my-awesome-platform.json -//@ ignore-backends: gcc #![feature(lang_items, no_core, auto_traits, rustc_attrs)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs index 0546b26820bca..de5823cccdf85 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(abi_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items, intrinsics)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs index 5528865fc840e..db9a51969a9f3 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(abi_cmse_nonsecure_call, no_core, lang_items, intrinsics)] #![no_core] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs index 756cc6816acd8..3f979b5acba2b 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs @@ -2,7 +2,6 @@ //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] #![crate_type = "lib"] diff --git a/tests/ui/codegen/custom-target-invalid-llvm-target.rs b/tests/ui/codegen/custom-target-invalid-llvm-target.rs index d90b56c5d13c0..8b9af65cf3550 100644 --- a/tests/ui/codegen/custom-target-invalid-llvm-target.rs +++ b/tests/ui/codegen/custom-target-invalid-llvm-target.rs @@ -3,7 +3,6 @@ // ignore-tidy-target-specific-tests //@ check-fail //@ compile-flags: --target={{src-base}}/codegen/custom-target-invalid-llvm-target.json -Z unstable-options -//@ ignore-backends: gcc fn main() {} diff --git a/tests/ui/codegen/mismatched-data-layouts.rs b/tests/ui/codegen/mismatched-data-layouts.rs index bf866c3b1c9d0..ea1457148a52c 100644 --- a/tests/ui/codegen/mismatched-data-layouts.rs +++ b/tests/ui/codegen/mismatched-data-layouts.rs @@ -6,7 +6,6 @@ //@ normalize-stderr: "`, `[A-Za-z0-9-:]*`" -> "`, `normalized data layout`" //@ normalize-stderr: "layout, `[A-Za-z0-9-:]*`" -> "layout, `normalized data layout`" //@ normalize-stderr: "`mismatched-data-layout-\d+`" -> "`mismatched-data-layout-`" -//@ ignore-backends: gcc #![feature(lang_items, no_core, auto_traits)] #![no_core] diff --git a/tests/ui/codegen/passes-default-pipeline.rs b/tests/ui/codegen/passes-default-pipeline.rs index dd90b55e2da9f..9c4b19fec3c81 100644 --- a/tests/ui/codegen/passes-default-pipeline.rs +++ b/tests/ui/codegen/passes-default-pipeline.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: -O -Cpasses=default fn main() { diff --git a/tests/ui/codegen/target-cpus.rs b/tests/ui/codegen/target-cpus.rs index 77a3f18dfa0fd..2d46e00f8034e 100644 --- a/tests/ui/codegen/target-cpus.rs +++ b/tests/ui/codegen/target-cpus.rs @@ -1,4 +1,3 @@ //@ needs-llvm-components: webassembly //@ compile-flags: --print=target-cpus --target=wasm32-unknown-unknown //@ check-pass -//@ ignore-backends: gcc diff --git a/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs b/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs index e46530a12c382..c7973c686da00 100644 --- a/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs +++ b/tests/ui/compile-flags/invalid/function-return/requires-x86-or-x86_64.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs index f0409a6f07796..bc81c993d26ef 100644 --- a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs +++ b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs index 321cf56cd2a0f..436442ee72993 100644 --- a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs index 6999eaac962aa..a66dfe8597718 100644 --- a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs +++ b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs @@ -17,7 +17,6 @@ //@[regparm4] check-fail //@[regparm4] compile-flags: -Zregparm=4 -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs index 983e412376dc0..32c4b5af35772 100644 --- a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs @@ -13,7 +13,6 @@ //@[aarch64] check-fail //@[aarch64] needs-llvm-components: aarch64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/compile-flags/print-request-help-stable-unstable.rs b/tests/ui/compile-flags/print-request-help-stable-unstable.rs index f75996f28e6bd..a1bde032784dd 100644 --- a/tests/ui/compile-flags/print-request-help-stable-unstable.rs +++ b/tests/ui/compile-flags/print-request-help-stable-unstable.rs @@ -2,7 +2,6 @@ //! //! Issue: -//@ ignore-backends: gcc //@ compile-flags: --print xxx // //@ revisions: stable nightly diff --git a/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr b/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr index 2d05a300165aa..d23fe15c126ab 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr +++ b/tests/ui/consts/const-destruct-stable-toolchain.nightly.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/const-destruct-stable-toolchain.rs:12:24 + --> $DIR/const-destruct-stable-toolchain.rs:11:24 | LL | const fn const_drop(_: T) {} | ^ - value is dropped here diff --git a/tests/ui/consts/const-destruct-stable-toolchain.rs b/tests/ui/consts/const-destruct-stable-toolchain.rs index ad16a74508e4c..d14ab320516fd 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.rs +++ b/tests/ui/consts/const-destruct-stable-toolchain.rs @@ -3,7 +3,6 @@ // requires an unstable feature. // //@ needs-target-std -//@ ignore-backends: gcc // //@ revisions: stable nightly // diff --git a/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr b/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr index 4755afcd3f1e3..e56e66bade980 100644 --- a/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr +++ b/tests/ui/consts/const-destruct-stable-toolchain.stable.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/const-destruct-stable-toolchain.rs:12:24 + --> $DIR/const-destruct-stable-toolchain.rs:11:24 | LL | const fn const_drop(_: T) {} | ^ - value is dropped here diff --git a/tests/ui/consts/const-eval/c-variadic.rs b/tests/ui/consts/const-eval/c-variadic.rs index 6dba6e1af5997..57c49ef283f3e 100644 --- a/tests/ui/consts/const-eval/c-variadic.rs +++ b/tests/ui/consts/const-eval/c-variadic.rs @@ -1,6 +1,5 @@ //@ edition: 2021 //@ run-pass -//@ ignore-backends: gcc #![feature(const_c_variadic)] #![feature(const_destruct)] diff --git a/tests/ui/consts/const-eval/parse_ints.rs b/tests/ui/consts/const-eval/parse_ints.rs index 6a7e157ea5039..409fae9e51d92 100644 --- a/tests/ui/consts/const-eval/parse_ints.rs +++ b/tests/ui/consts/const-eval/parse_ints.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - const _OK: () = match i32::from_str_radix("-1234", 10) { Ok(x) => assert!(x == -1234), Err(_) => panic!(), diff --git a/tests/ui/consts/const-eval/parse_ints.stderr b/tests/ui/consts/const-eval/parse_ints.stderr index b8027fd951d5a..ef2214ce19d8c 100644 --- a/tests/ui/consts/const-eval/parse_ints.stderr +++ b/tests/ui/consts/const-eval/parse_ints.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation panicked: from_ascii_bytes_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:7:24 + --> $DIR/parse_ints.rs:5:24 | LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_LOW` failed inside this call @@ -17,7 +17,7 @@ note: inside `core::num::::from_ascii_bytes_radix_impl` = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation panicked: from_ascii_bytes_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:8:25 + --> $DIR/parse_ints.rs:6:25 | LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_HIGH` failed inside this call diff --git a/tests/ui/consts/const_cmp_type_id.rs b/tests/ui/consts/const_cmp_type_id.rs index dc0701d3b1d6a..da0ba3ffebac8 100644 --- a/tests/ui/consts/const_cmp_type_id.rs +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ compile-flags: -Znext-solver #![feature(const_trait_impl, const_cmp)] diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr index b991b6af08cc1..dd2d1e86cced2 100644 --- a/tests/ui/consts/const_cmp_type_id.stderr +++ b/tests/ui/consts/const_cmp_type_id.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `TypeId: const PartialOrd` is not satisfied - --> $DIR/const_cmp_type_id.rs:11:18 + --> $DIR/const_cmp_type_id.rs:10:18 | LL | let _a = TypeId::of::() < TypeId::of::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/issue-73976-monomorphic.rs b/tests/ui/consts/issue-73976-monomorphic.rs index 6459150a66045..2867b836f4826 100644 --- a/tests/ui/consts/issue-73976-monomorphic.rs +++ b/tests/ui/consts/issue-73976-monomorphic.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-pass // // This test is complement to the test in issue-73976-polymorphic.rs. diff --git a/tests/ui/consts/issue-94675.rs b/tests/ui/consts/issue-94675.rs index 73ab2c7655800..c13fe26ae05a0 100644 --- a/tests/ui/consts/issue-94675.rs +++ b/tests/ui/consts/issue-94675.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - #![feature(const_trait_impl)] struct Foo<'a> { diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr index 3e89e37814fad..9a12c0ef6a75b 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -1,5 +1,5 @@ error: `IndexMut` is not yet stable as a const trait - --> $DIR/issue-94675.rs:11:17 + --> $DIR/issue-94675.rs:9:17 | LL | self.bar[0] = baz.len(); | ^^^ diff --git a/tests/ui/consts/issue-miri-1910.rs b/tests/ui/consts/issue-miri-1910.rs index 97cc92417bf46..dfc7bb737cd9e 100644 --- a/tests/ui/consts/issue-miri-1910.rs +++ b/tests/ui/consts/issue-miri-1910.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ normalize-stderr: "alloc[0-9]+\+0x[a-z0-9]+" -> "ALLOC" const C: () = unsafe { diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index af4e3f3fc5352..a5b518e94213f 100644 --- a/tests/ui/consts/issue-miri-1910.stderr +++ b/tests/ui/consts/issue-miri-1910.stderr @@ -1,5 +1,5 @@ error[E0080]: unable to turn pointer into integer - --> $DIR/issue-miri-1910.rs:7:5 + --> $DIR/issue-miri-1910.rs:6:5 | LL | const C: () = unsafe { ... diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index b679493eb08eb..94de3390a0267 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,5 +1,4 @@ //! Check what happens when the error occurs inside a std function that we can't print the span of. -//@ ignore-backends: gcc //@ compile-flags: -Z ui-testing=no --diagnostic-width=80 use std::{ diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 7af55684861bc..411dbe5403eb0 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,13 +1,13 @@ error[E0080]: memory access failed: attempting to access 1 byte, but got ALLOC$ID+0x4 which is at or beyond the end of the allocation of size 4 bytes - --> $DIR/missing_span_in_backtrace.rs:16:9 + --> $DIR/missing_span_in_backtrace.rs:15:9 | -10 | const X: () = { + 9 | const X: () = { ... -16 | / ptr::swap_nonoverlapping( -17 | | &mut x1 as *mut _ as *mut MaybeUninit, -18 | | &mut x2 as *mut _ as *mut MaybeUninit, -19 | | 10, -20 | | ); +15 | / ptr::swap_nonoverlapping( +16 | | &mut x1 as *mut _ as *mut MaybeUninit, +17 | | &mut x2 as *mut _ as *mut MaybeUninit, +18 | | 10, +19 | | ); | |_________^ evaluation of `X` failed inside this call | note: inside `swap_nonoverlapping::compiletime::>` diff --git a/tests/ui/consts/try-operator.rs b/tests/ui/consts/try-operator.rs index 54a6ed26241c6..8beff899bb5af 100644 --- a/tests/ui/consts/try-operator.rs +++ b/tests/ui/consts/try-operator.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ run-pass #![feature(const_trait_impl)] diff --git a/tests/ui/coroutine/gen_block_panic.rs b/tests/ui/coroutine/gen_block_panic.rs index 5417ed583e8ca..b6362d5046a3b 100644 --- a/tests/ui/coroutine/gen_block_panic.rs +++ b/tests/ui/coroutine/gen_block_panic.rs @@ -1,7 +1,6 @@ //@ edition: 2024 //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(gen_blocks)] fn main() { diff --git a/tests/ui/coroutine/gen_block_panic.stderr b/tests/ui/coroutine/gen_block_panic.stderr index d0a146e7baf9a..a43c9e03691a5 100644 --- a/tests/ui/coroutine/gen_block_panic.stderr +++ b/tests/ui/coroutine/gen_block_panic.stderr @@ -1,5 +1,5 @@ warning: unreachable statement - --> $DIR/gen_block_panic.rs:11:9 + --> $DIR/gen_block_panic.rs:10:9 | LL | panic!("foo"); | ------------- any code following this expression is unreachable diff --git a/tests/ui/coroutine/panic-drops-resume.rs b/tests/ui/coroutine/panic-drops-resume.rs index ee58dab3e3703..b23666b7885fb 100644 --- a/tests/ui/coroutine/panic-drops-resume.rs +++ b/tests/ui/coroutine/panic-drops-resume.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/panic-drops.rs b/tests/ui/coroutine/panic-drops.rs index c8ac401372f78..8c2cf560f2acc 100644 --- a/tests/ui/coroutine/panic-drops.rs +++ b/tests/ui/coroutine/panic-drops.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/panic-safe.rs b/tests/ui/coroutine/panic-safe.rs index cee2afacb6145..d25eaa418fe14 100644 --- a/tests/ui/coroutine/panic-safe.rs +++ b/tests/ui/coroutine/panic-safe.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/resume-after-return.rs b/tests/ui/coroutine/resume-after-return.rs index f566bd37d3d10..7028e1e81e55c 100644 --- a/tests/ui/coroutine/resume-after-return.rs +++ b/tests/ui/coroutine/resume-after-return.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ run-pass //@ needs-unwind diff --git a/tests/ui/coroutine/unwind-abort-mix.rs b/tests/ui/coroutine/unwind-abort-mix.rs index 175c2928a8010..517c6613e3d8b 100644 --- a/tests/ui/coroutine/unwind-abort-mix.rs +++ b/tests/ui/coroutine/unwind-abort-mix.rs @@ -6,7 +6,6 @@ //@ aux-build:unwind-aux.rs //@ compile-flags: -Cpanic=abort //@ needs-unwind -//@ ignore-backends: gcc extern crate unwind_aux; pub fn main() { diff --git a/tests/ui/crate-loading/missing-target-error.rs b/tests/ui/crate-loading/missing-target-error.rs index 3a75d568d2c8e..aece47ec3f9d4 100644 --- a/tests/ui/crate-loading/missing-target-error.rs +++ b/tests/ui/crate-loading/missing-target-error.rs @@ -8,6 +8,5 @@ //@ compile-flags: --target=thumbv6m-none-eabi //@ ignore-arm //@ needs-llvm-components: arm -//@ ignore-backends: gcc fn main() { } diff --git a/tests/ui/crate-loading/missing-target-no-std-error.rs b/tests/ui/crate-loading/missing-target-no-std-error.rs index c285740c62bec..6c337aa02b3bd 100644 --- a/tests/ui/crate-loading/missing-target-no-std-error.rs +++ b/tests/ui/crate-loading/missing-target-no-std-error.rs @@ -5,7 +5,6 @@ //@ compile-flags: --target thumbv7em-none-eabihf //@ needs-llvm-components: arm -//@ ignore-backends: gcc #![deny(unsafe_code)] #![deny(warnings)] #![no_std] diff --git a/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs index 2e3073286f0f6..9db910d0d242e 100644 --- a/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs +++ b/tests/ui/cross-crate/mut-ref-write-visible-after-unwind.rs @@ -4,7 +4,6 @@ //@ aux-build:mut-ref-write-visible-after-unwind.rs //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc extern crate mut_ref_write_visible_after_unwind as lib; diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs index e0d0f9cff324d..3a8d9c998cf74 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_off.rs @@ -22,7 +22,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs index e6f830ea73eb4..75b8141cc385f 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_packed.rs @@ -21,7 +21,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs b/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs index e8edbc669b5cc..3f4da555aadf1 100644 --- a/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs +++ b/tests/ui/debuginfo/windows_gnu_split_debuginfo_unpacked.rs @@ -21,7 +21,6 @@ //@[x86_64_uwp_g] compile-flags: --target x86_64-uwp-windows-gnu //@[x86_64_uwp_g] needs-llvm-components: x86 -//@ ignore-backends: gcc #![feature(no_core)] diff --git a/tests/ui/delegation/fn-header-variadic.rs b/tests/ui/delegation/fn-header-variadic.rs index 051be3a51502d..132c0a22402c6 100644 --- a/tests/ui/delegation/fn-header-variadic.rs +++ b/tests/ui/delegation/fn-header-variadic.rs @@ -1,5 +1,4 @@ //@ aux-crate:fn_header_aux=fn-header-aux.rs -//@ ignore-backends: gcc #![feature(fn_delegation)] diff --git a/tests/ui/delegation/fn-header-variadic.stderr b/tests/ui/delegation/fn-header-variadic.stderr index a0b5a6313d080..e10ad339d8c2a 100644 --- a/tests/ui/delegation/fn-header-variadic.stderr +++ b/tests/ui/delegation/fn-header-variadic.stderr @@ -1,5 +1,5 @@ error: delegation to C-variadic functions is not allowed - --> $DIR/fn-header-variadic.rs:10:17 + --> $DIR/fn-header-variadic.rs:9:17 | LL | pub unsafe extern "C" fn variadic_fn(n: usize, mut args: ...) {} | ------------------------------------------------------------- callee defined here @@ -8,7 +8,7 @@ LL | reuse to_reuse::variadic_fn; | ^^^^^^^^^^^ error: delegation to C-variadic functions is not allowed - --> $DIR/fn-header-variadic.rs:12:22 + --> $DIR/fn-header-variadic.rs:11:22 | LL | reuse fn_header_aux::variadic_fn_extern; | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs index a036dec4872a9..0b5154b29b9ca 100644 --- a/tests/ui/delegation/fn-header.rs +++ b/tests/ui/delegation/fn-header.rs @@ -4,7 +4,6 @@ //@ check-pass //@ edition:2018 //@ aux-crate:fn_header_aux=fn-header-aux.rs -//@ ignore-backends: gcc #![feature(fn_delegation)] #![deny(unused_unsafe)] diff --git a/tests/ui/drop/drop-once-on-panic.rs b/tests/ui/drop/drop-once-on-panic.rs index baba7abae91b0..4245f1649903b 100644 --- a/tests/ui/drop/drop-once-on-panic.rs +++ b/tests/ui/drop/drop-once-on-panic.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/drop/drop-trait-enum.rs b/tests/ui/drop/drop-trait-enum.rs index efb6b2a912ab1..5a88d959ec6fa 100644 --- a/tests/ui/drop/drop-trait-enum.rs +++ b/tests/ui/drop/drop-trait-enum.rs @@ -4,7 +4,6 @@ #![allow(unused_variables)] //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/tests/ui/drop/dynamic-drop-async.rs b/tests/ui/drop/dynamic-drop-async.rs index 64de6995c7a82..e7a32d3c24e92 100644 --- a/tests/ui/drop/dynamic-drop-async.rs +++ b/tests/ui/drop/dynamic-drop-async.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-unwind //@ edition:2018 -//@ ignore-backends: gcc #![allow(unused)] diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs index 408604fe3e6a2..70e0e523f1c62 100644 --- a/tests/ui/drop/dynamic-drop.rs +++ b/tests/ui/drop/dynamic-drop.rs @@ -1,7 +1,6 @@ //@ edition:2015..2021 //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] diff --git a/tests/ui/drop/enum-destructor-on-unwind.rs b/tests/ui/drop/enum-destructor-on-unwind.rs index 9d2655564ca8c..498de521bd761 100644 --- a/tests/ui/drop/enum-destructor-on-unwind.rs +++ b/tests/ui/drop/enum-destructor-on-unwind.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{Ordering, AtomicUsize}; use std::thread; diff --git a/tests/ui/drop/move-closure-drop-on-unwind.rs b/tests/ui/drop/move-closure-drop-on-unwind.rs index ad110c1de01c8..28932aa36cc1d 100644 --- a/tests/ui/drop/move-closure-drop-on-unwind.rs +++ b/tests/ui/drop/move-closure-drop-on-unwind.rs @@ -4,7 +4,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::panic; diff --git a/tests/ui/drop/panic-during-drop-14875.rs b/tests/ui/drop/panic-during-drop-14875.rs index 5a6f8f427758d..0c33f74ed61f7 100644 --- a/tests/ui/drop/panic-during-drop-14875.rs +++ b/tests/ui/drop/panic-during-drop-14875.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc // Check that values are not leaked when a dtor panics (#14875) diff --git a/tests/ui/drop/panic-during-slice-init.rs b/tests/ui/drop/panic-during-slice-init.rs index ddf1e01dd8e7a..3e8e12536991c 100644 --- a/tests/ui/drop/panic-during-slice-init.rs +++ b/tests/ui/drop/panic-during-slice-init.rs @@ -6,7 +6,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc struct Foo; diff --git a/tests/ui/drop/terminate-in-initializer.rs b/tests/ui/drop/terminate-in-initializer.rs index 5dd8fe43c71e3..24ec39fe09638 100644 --- a/tests/ui/drop/terminate-in-initializer.rs +++ b/tests/ui/drop/terminate-in-initializer.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Issue #787 // Don't try to clean up uninitialized locals diff --git a/tests/ui/explicit-tail-calls/become-cast-return.rs b/tests/ui/explicit-tail-calls/become-cast-return.rs index d4cdcbf3a0112..2927185bbbc13 100644 --- a/tests/ui/explicit-tail-calls/become-cast-return.rs +++ b/tests/ui/explicit-tail-calls/become-cast-return.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ ignore-wasm 'tail-call' feature not enabled in target wasm32-wasip1 //@ ignore-cross-compile #![expect(incomplete_features)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller.rs b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs index b5e1b97e9da8d..f357ee3524a15 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller.rs +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs @@ -1,6 +1,5 @@ //@ run-pass //@ no-pass-override (checks for a warning produced by codegen) -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr b/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr index 020a0542a57fd..e1a251d156f76 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller.stderr @@ -1,5 +1,5 @@ warning: tail calling a function marked with `#[track_caller]` has no special effect - --> $DIR/callee_is_track_caller.rs:8:12 + --> $DIR/callee_is_track_caller.rs:7:12 | LL | become b(x); | ^^^^ diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs index 7623dd558251b..4214c26defb0a 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.rs @@ -1,6 +1,5 @@ //@ run-pass //@ no-pass-override (checks for a warning produced by codegen) -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr index 7b4c144acffa5..5a1c40509ad3a 100644 --- a/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller_polymorphic.stderr @@ -1,5 +1,5 @@ warning: tail calling a function marked with `#[track_caller]` has no special effect - --> $DIR/callee_is_track_caller_polymorphic.rs:8:12 + --> $DIR/callee_is_track_caller_polymorphic.rs:7:12 | LL | become T::f(); | ^^^^^^ diff --git a/tests/ui/explicit-tail-calls/default-trait-method.rs b/tests/ui/explicit-tail-calls/default-trait-method.rs index fbf2e80ced45e..144909fc1d1b6 100644 --- a/tests/ui/explicit-tail-calls/default-trait-method.rs +++ b/tests/ui/explicit-tail-calls/default-trait-method.rs @@ -3,7 +3,6 @@ // in a path determining whether the method in question is marked as `#[track_caller]`. // //@ run-pass -//@ ignore-backends: gcc #![feature(explicit_tail_calls)] #![expect(incomplete_features)] diff --git a/tests/ui/explicit-tail-calls/drop-order.rs b/tests/ui/explicit-tail-calls/drop-order.rs index ff6e2f09f57ce..58e1afbdf0c51 100644 --- a/tests/ui/explicit-tail-calls/drop-order.rs +++ b/tests/ui/explicit-tail-calls/drop-order.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] use std::cell::RefCell; diff --git a/tests/ui/explicit-tail-calls/indexer.rs b/tests/ui/explicit-tail-calls/indexer.rs index c26d9774ce780..5644506b2f584 100644 --- a/tests/ui/explicit-tail-calls/indexer.rs +++ b/tests/ui/explicit-tail-calls/indexer.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc // Indexing taken from // https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination // no other test has utilized the "function table" diff --git a/tests/ui/explicit-tail-calls/recursion-etc.rs b/tests/ui/explicit-tail-calls/recursion-etc.rs index c22401d23799d..8c89ceb7869aa 100644 --- a/tests/ui/explicit-tail-calls/recursion-etc.rs +++ b/tests/ui/explicit-tail-calls/recursion-etc.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![expect(incomplete_features)] #![feature(explicit_tail_calls)] diff --git a/tests/ui/explicit-tail-calls/support/basic.rs b/tests/ui/explicit-tail-calls/support/basic.rs index eb3041f106171..c2f327154066e 100644 --- a/tests/ui/explicit-tail-calls/support/basic.rs +++ b/tests/ui/explicit-tail-calls/support/basic.rs @@ -1,5 +1,4 @@ //@ build-pass -//@ ignore-backends: gcc //@ add-minicore // //@ revisions: i686 diff --git a/tests/ui/extern/extern-types-field-offset.rs b/tests/ui/extern/extern-types-field-offset.rs index 9fe1cdf3bc47a..a9562ac9fb015 100644 --- a/tests/ui/extern/extern-types-field-offset.rs +++ b/tests/ui/extern/extern-types-field-offset.rs @@ -3,7 +3,6 @@ //@ exec-env:RUST_BACKTRACE=0 //@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL" //@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" -//@ ignore-backends: gcc #![feature(extern_types)] extern "C" { diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs index 794b51c7a8a25..26d483e43ae50 100644 --- a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.rs @@ -1,5 +1,4 @@ //@ proc-macro: format-string-proc-macro.rs -//@ ignore-backends: gcc extern crate format_string_proc_macro; diff --git a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr index c341c6ee4c513..e7ed2a76e6af1 100644 --- a/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr +++ b/tests/ui/fmt/format-args-capture-from-pm-first-arg-macro.stderr @@ -1,5 +1,5 @@ error: there is no argument named `x` - --> $DIR/format-args-capture-from-pm-first-arg-macro.rs:7:5 + --> $DIR/format-args-capture-from-pm-first-arg-macro.rs:6:5 | LL | format_string_proc_macro::bad_format_args_captures!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/frontmatter/location-proc-macro-observer.rs b/tests/ui/frontmatter/location-proc-macro-observer.rs index 5237a0e982a6f..6c4c8c572897e 100644 --- a/tests/ui/frontmatter/location-proc-macro-observer.rs +++ b/tests/ui/frontmatter/location-proc-macro-observer.rs @@ -1,7 +1,6 @@ //@ check-pass //@ proc-macro: makro.rs //@ edition: 2021 -//@ ignore-backends: gcc // Check that a proc-macro doesn't try to parse frontmatter and instead treats // it as a regular Rust token sequence. See `auxiliary/makro.rs` for details. diff --git a/tests/ui/hygiene/issue-77523-def-site-async-await.rs b/tests/ui/hygiene/issue-77523-def-site-async-await.rs index 0a279682b71bb..ad6bd5e0b78bc 100644 --- a/tests/ui/hygiene/issue-77523-def-site-async-await.rs +++ b/tests/ui/hygiene/issue-77523-def-site-async-await.rs @@ -1,6 +1,5 @@ //@ build-pass //@ aux-build:def-site-async-await.rs -//@ ignore-backends: gcc // Regression test for issue #77523 // Tests that we don't ICE when an unusual combination diff --git a/tests/ui/impl-trait/precise-capturing/external-macro.rs b/tests/ui/impl-trait/precise-capturing/external-macro.rs index 1342ecd58dcf2..9d4d8a1bb119a 100644 --- a/tests/ui/impl-trait/precise-capturing/external-macro.rs +++ b/tests/ui/impl-trait/precise-capturing/external-macro.rs @@ -6,7 +6,6 @@ //@ aux-crate: no_use_macro=no-use-macro.rs //@ edition: 2024 //@ check-pass -//@ ignore-backends: gcc no_use_pm::pm_rpit!{} diff --git a/tests/ui/instrument-xray/platform-support.rs b/tests/ui/instrument-xray/platform-support.rs index 68b0e4f5c9821..238018b348dee 100644 --- a/tests/ui/instrument-xray/platform-support.rs +++ b/tests/ui/instrument-xray/platform-support.rs @@ -19,7 +19,6 @@ //@[aarch64-darwin] needs-llvm-components: aarch64 //@[aarch64-darwin] compile-flags: -Z instrument-xray --target=aarch64-apple-darwin //@[aarch64-darwin] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs index e2f251f77e4a9..110c039bee837 100644 --- a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs +++ b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs @@ -4,7 +4,6 @@ //@ revisions: default strict //@ [strict]compile-flags: -Zstrict-init-checks //@ needs-subprocess -//@ ignore-backends: gcc //@ edition:2024 #![allow(deprecated, invalid_value, unreachable_code)] diff --git a/tests/ui/iterators/iter-filter-count-debug-check.rs b/tests/ui/iterators/iter-filter-count-debug-check.rs index 6e3a3f73920e4..121e97a393fff 100644 --- a/tests/ui/iterators/iter-filter-count-debug-check.rs +++ b/tests/ui/iterators/iter-filter-count-debug-check.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C overflow-checks use std::panic; diff --git a/tests/ui/iterators/iter-sum-overflow-debug.rs b/tests/ui/iterators/iter-sum-overflow-debug.rs index 974282b03792b..32efc925a454e 100644 --- a/tests/ui/iterators/iter-sum-overflow-debug.rs +++ b/tests/ui/iterators/iter-sum-overflow-debug.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C debug_assertions=yes use std::panic; diff --git a/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs b/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs index aba6f9a188f3a..8fffd19e2beae 100644 --- a/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs +++ b/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -C overflow-checks use std::panic; diff --git a/tests/ui/linking/no-gc-encapsulation-symbols.rs b/tests/ui/linking/no-gc-encapsulation-symbols.rs index c60f35b55eb2f..36d69969199ce 100644 --- a/tests/ui/linking/no-gc-encapsulation-symbols.rs +++ b/tests/ui/linking/no-gc-encapsulation-symbols.rs @@ -5,7 +5,6 @@ // //@ build-pass //@ only-x86_64-unknown-linux-gnu -//@ ignore-backends: gcc unsafe extern "Rust" { // The __start_ section name is magical for the linker, diff --git a/tests/ui/lint/unused-qualification-in-derive-expansion.rs b/tests/ui/lint/unused-qualification-in-derive-expansion.rs index bf095c6449d8f..b2067e22c4443 100644 --- a/tests/ui/lint/unused-qualification-in-derive-expansion.rs +++ b/tests/ui/lint/unused-qualification-in-derive-expansion.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: add-impl.rs -//@ ignore-backends: gcc #![forbid(unused_qualifications)] diff --git a/tests/ui/macros/same-sequence-span.rs b/tests/ui/macros/same-sequence-span.rs index 9fae847a4e2fa..dfaf669a769a6 100644 --- a/tests/ui/macros/same-sequence-span.rs +++ b/tests/ui/macros/same-sequence-span.rs @@ -1,5 +1,4 @@ //@ proc-macro: proc_macro_sequence.rs -//@ ignore-backends: gcc // Regression test for issue #62831: Check that multiple sequences with the same span in the // left-hand side of a macro definition behave as if they had unique spans, and in particular that diff --git a/tests/ui/macros/same-sequence-span.stderr b/tests/ui/macros/same-sequence-span.stderr index d6652453e9a9e..c4289f07feb36 100644 --- a/tests/ui/macros/same-sequence-span.stderr +++ b/tests/ui/macros/same-sequence-span.stderr @@ -1,5 +1,5 @@ error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:15:18 + --> $DIR/same-sequence-span.rs:14:18 | LL | (1 $x:expr $($y:tt,)* | ^^^^^ not allowed after `expr` fragments @@ -7,7 +7,7 @@ LL | (1 $x:expr $($y:tt,)* = note: allowed there are: `=>`, `,` or `;` error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:16:18 + --> $DIR/same-sequence-span.rs:15:18 | LL | $(= $z:tt)* | ^ not allowed after `expr` fragments @@ -15,7 +15,7 @@ LL | $(= $z:tt)* = note: allowed there are: `=>`, `,` or `;` error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:20:1 + --> $DIR/same-sequence-span.rs:19:1 | LL | proc_macro_sequence::make_foo!(); | -------------------------------- in this macro invocation @@ -24,7 +24,7 @@ LL | proc_macro_sequence::make_foo!(); = note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info) error: `$x:expr` may be followed by `=`, which is not allowed for `expr` fragments - --> $DIR/same-sequence-span.rs:20:1 + --> $DIR/same-sequence-span.rs:19:1 | LL | proc_macro_sequence::make_foo!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed after `expr` fragments diff --git a/tests/ui/mir/mir_drop_order.rs b/tests/ui/mir/mir_drop_order.rs index a7a1a26a956bf..21d1054c4222d 100644 --- a/tests/ui/mir/mir_drop_order.rs +++ b/tests/ui/mir/mir_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::cell::RefCell; use std::panic; diff --git a/tests/ui/mir/mir_let_chains_drop_order.rs b/tests/ui/mir/mir_let_chains_drop_order.rs index 1579e298ee79a..8a54f21b57fa5 100644 --- a/tests/ui/mir/mir_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_let_chains_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ edition: 2024 // See `mir_drop_order.rs` for more information diff --git a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs index d2007dd2a2070..9c1eaf0fac635 100644 --- a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ revisions: edition2021 edition2024 //@ [edition2021] edition: 2021 //@ [edition2024] edition: 2024 diff --git a/tests/ui/numbers-arithmetic/int-abs-overflow.rs b/tests/ui/numbers-arithmetic/int-abs-overflow.rs index fd4a5a6052b83..6397f62d06551 100644 --- a/tests/ui/numbers-arithmetic/int-abs-overflow.rs +++ b/tests/ui/numbers-arithmetic/int-abs-overflow.rs @@ -2,7 +2,6 @@ //@ compile-flags: -C overflow-checks=on //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/numbers-arithmetic/issue-8460.rs b/tests/ui/numbers-arithmetic/issue-8460.rs index 52df432669f12..87867fdc93e41 100644 --- a/tests/ui/numbers-arithmetic/issue-8460.rs +++ b/tests/ui/numbers-arithmetic/issue-8460.rs @@ -2,7 +2,6 @@ #![allow(unused_must_use)] //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc #![feature(rustc_attrs)] use std::thread; diff --git a/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs b/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs index b4645a39691c2..aa3f9fc3bcea6 100644 --- a/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs +++ b/tests/ui/panic-handler/catch-unwind-during-unwind-68696.rs @@ -5,7 +5,6 @@ // entering the catch_unwind. // //@ run-pass -//@ ignore-backends: gcc use std::panic::catch_unwind; diff --git a/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs b/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs index bef2d8bcff050..0566d2319df1a 100644 --- a/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs @@ -3,7 +3,6 @@ //@ aux-build:exit-success-if-unwind.rs //@ no-prefer-dynamic //@ needs-subprocess -//@ ignore-backends: gcc extern crate exit_success_if_unwind; diff --git a/tests/ui/panic-runtime/abort.rs b/tests/ui/panic-runtime/abort.rs index 2a52228801f8e..8cdfd018a9282 100644 --- a/tests/ui/panic-runtime/abort.rs +++ b/tests/ui/panic-runtime/abort.rs @@ -2,7 +2,6 @@ //@ compile-flags:-C panic=abort //@ no-prefer-dynamic //@ needs-subprocess -//@ ignore-backends: gcc use std::env; use std::process::Command; diff --git a/tests/ui/panic-runtime/link-to-abort.rs b/tests/ui/panic-runtime/link-to-abort.rs index 98718ab8342b8..a4013f2a6cf70 100644 --- a/tests/ui/panic-runtime/link-to-abort.rs +++ b/tests/ui/panic-runtime/link-to-abort.rs @@ -2,7 +2,6 @@ //@ compile-flags:-C panic=abort //@ no-prefer-dynamic -//@ ignore-backends: gcc #![feature(panic_abort)] diff --git a/tests/ui/panics/alloc_error_hook-unwind.rs b/tests/ui/panics/alloc_error_hook-unwind.rs index 8a107bc390d4a..ee8a13f78332c 100644 --- a/tests/ui/panics/alloc_error_hook-unwind.rs +++ b/tests/ui/panics/alloc_error_hook-unwind.rs @@ -3,7 +3,6 @@ //@ run-pass //@ needs-unwind //@ only-linux -//@ ignore-backends: gcc #![feature(alloc_error_hook)] diff --git a/tests/ui/panics/lsda-multiple-action.rs b/tests/ui/panics/lsda-multiple-action.rs index 236e8b90ca5b1..82d425bb1306b 100644 --- a/tests/ui/panics/lsda-multiple-action.rs +++ b/tests/ui/panics/lsda-multiple-action.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ compile-flags: -Copt-level=3 struct Guard; diff --git a/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs b/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs index 00c90b30af968..a29afd68523be 100644 --- a/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs +++ b/tests/ui/panics/panic-abort-backtrace-without-debuginfo.rs @@ -16,7 +16,6 @@ //@ ignore-apple //@ ignore-arm-unknown-linux-gnueabihf FIXME(#146996) Try removing this once #146996 has been fixed. //@ ignore-msvc Backtraces on Windows requires debuginfo which we can't use here -//@ ignore-backends: gcc static FN_1: &str = "this_function_must_be_in_the_backtrace"; fn this_function_must_be_in_the_backtrace() { diff --git a/tests/ui/panics/panic-handler-chain-update-hook.rs b/tests/ui/panics/panic-handler-chain-update-hook.rs index b75c21c8b3b2d..cb62e8d8a85fd 100644 --- a/tests/ui/panics/panic-handler-chain-update-hook.rs +++ b/tests/ui/panics/panic-handler-chain-update-hook.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc #![feature(panic_update_hook)] diff --git a/tests/ui/panics/panic-handler-chain.rs b/tests/ui/panics/panic-handler-chain.rs index 49b76834ffe9e..4ff9f3a5a63a2 100644 --- a/tests/ui/panics/panic-handler-chain.rs +++ b/tests/ui/panics/panic-handler-chain.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/panic-handler-flail-wildly.rs b/tests/ui/panics/panic-handler-flail-wildly.rs index b44a388caad32..d7ed84a9caf7d 100644 --- a/tests/ui/panics/panic-handler-flail-wildly.rs +++ b/tests/ui/panics/panic-handler-flail-wildly.rs @@ -4,7 +4,6 @@ #![allow(unused_must_use)] //@ needs-threads -//@ ignore-backends: gcc use std::panic; use std::thread; diff --git a/tests/ui/panics/panic-handler-set-twice.rs b/tests/ui/panics/panic-handler-set-twice.rs index aa40187f08ca2..6d95ec2402973 100644 --- a/tests/ui/panics/panic-handler-set-twice.rs +++ b/tests/ui/panics/panic-handler-set-twice.rs @@ -3,7 +3,6 @@ #![allow(unused_variables)] //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/panic-in-dtor-drops-fields.rs b/tests/ui/panics/panic-in-dtor-drops-fields.rs index db07923433752..38eb6d0acfb81 100644 --- a/tests/ui/panics/panic-in-dtor-drops-fields.rs +++ b/tests/ui/panics/panic-in-dtor-drops-fields.rs @@ -4,7 +4,6 @@ #![allow(non_upper_case_globals)] //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/panics/panic-recover-propagate.rs b/tests/ui/panics/panic-recover-propagate.rs index 36ca279bdbd25..ef6ae4fd7887d 100644 --- a/tests/ui/panics/panic-recover-propagate.rs +++ b/tests/ui/panics/panic-recover-propagate.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/tests/ui/panics/rvalue-cleanup-during-box-panic.rs b/tests/ui/panics/rvalue-cleanup-during-box-panic.rs index 03571f111aac0..84c5d85d7e096 100644 --- a/tests/ui/panics/rvalue-cleanup-during-box-panic.rs +++ b/tests/ui/panics/rvalue-cleanup-during-box-panic.rs @@ -21,7 +21,6 @@ // scenario worth testing. //@ needs-threads -//@ ignore-backends: gcc use std::thread; diff --git a/tests/ui/panics/unwind-force-no-unwind-tables.rs b/tests/ui/panics/unwind-force-no-unwind-tables.rs index 715f288fff10e..2226e4dd03ebc 100644 --- a/tests/ui/panics/unwind-force-no-unwind-tables.rs +++ b/tests/ui/panics/unwind-force-no-unwind-tables.rs @@ -6,7 +6,6 @@ //@ needs-unwind //@ ignore-windows target requires uwtable //@ compile-flags: -C panic=unwind -C force-unwind-tables=n -//@ ignore-backends: gcc use std::panic::{self, AssertUnwindSafe}; diff --git a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs index c82efe79e4d0f..461890e63e37b 100644 --- a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs +++ b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-89971-outer-attr-following-inner-attr-ice.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_89971_outer_attr_following_inner_attr_ice; diff --git a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr index 392e7d0321f03..51df17c7cc670 100644 --- a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr +++ b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted in this context - --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:12:1 + --> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1 | LL | #![deny(missing_docs)] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/parser/macro/unicode-control-codepoints-macros.rs b/tests/ui/parser/macro/unicode-control-codepoints-macros.rs index 701e7dfa30a39..775c50779760a 100644 --- a/tests/ui/parser/macro/unicode-control-codepoints-macros.rs +++ b/tests/ui/parser/macro/unicode-control-codepoints-macros.rs @@ -1,7 +1,6 @@ // Regression test for #140281 //@ edition: 2021 //@ proc-macro: unicode-control.rs -//@ ignore-backends: gcc extern crate unicode_control; use unicode_control::*; diff --git a/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr b/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr index b1d9c9d018744..2f40e327a4052 100644 --- a/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr +++ b/tests/ui/parser/macro/unicode-control-codepoints-macros.stderr @@ -1,5 +1,5 @@ error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:21:9 + --> $DIR/unicode-control-codepoints-macros.rs:20:9 | LL | /// �test� RTL in doc in vec | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints @@ -10,7 +10,7 @@ LL | /// �test� RTL in doc in vec = note: `#[deny(text_direction_codepoint_in_literal)]` on by default error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:26:9 + --> $DIR/unicode-control-codepoints-macros.rs:25:9 | LL | / /** LL | | * �test� RTL in doc in macro @@ -22,7 +22,7 @@ LL | | */ = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:33:9 + --> $DIR/unicode-control-codepoints-macros.rs:32:9 | LL | / /** LL | | * �test� RTL in doc in macro @@ -34,7 +34,7 @@ LL | | */ = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:41:9 + --> $DIR/unicode-control-codepoints-macros.rs:40:9 | LL | /// �test� RTL in doc in proc macro | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints @@ -44,7 +44,7 @@ LL | /// �test� RTL in doc in proc macro = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' error: unicode codepoint changing visible direction of text present in doc comment - --> $DIR/unicode-control-codepoints-macros.rs:46:9 + --> $DIR/unicode-control-codepoints-macros.rs:45:9 | LL | /// �test� RTL in doc in proc macro | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints diff --git a/tests/ui/parser/tuple-index-suffix-proc-macro.rs b/tests/ui/parser/tuple-index-suffix-proc-macro.rs index 2463897381ec2..557c67738d30f 100644 --- a/tests/ui/parser/tuple-index-suffix-proc-macro.rs +++ b/tests/ui/parser/tuple-index-suffix-proc-macro.rs @@ -3,7 +3,6 @@ //! Like `tuple-index-suffix.rs`, but exercises the proc-macro interaction. //@ proc-macro: tuple-index-suffix-proc-macro-aux.rs -//@ ignore-backends: gcc extern crate tuple_index_suffix_proc_macro_aux; use tuple_index_suffix_proc_macro_aux as aux; diff --git a/tests/ui/parser/tuple-index-suffix-proc-macro.stderr b/tests/ui/parser/tuple-index-suffix-proc-macro.stderr index a242af5a789f7..47d179d355513 100644 --- a/tests/ui/parser/tuple-index-suffix-proc-macro.stderr +++ b/tests/ui/parser/tuple-index-suffix-proc-macro.stderr @@ -1,23 +1,23 @@ error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:18:28 + --> $DIR/tuple-index-suffix-proc-macro.rs:17:28 | LL | aux::bad_tup_indexing!(0usize); | ^^^^^^ invalid suffix `usize` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:20:47 + --> $DIR/tuple-index-suffix-proc-macro.rs:19:47 | LL | aux::bad_tup_struct_indexing!(tup_struct, 0isize); | ^^^^^^ invalid suffix `isize` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:25:28 + --> $DIR/tuple-index-suffix-proc-macro.rs:24:28 | LL | aux::bad_tup_indexing!(0u8); | ^^^ invalid suffix `u8` error: suffixes on a tuple index are invalid - --> $DIR/tuple-index-suffix-proc-macro.rs:27:47 + --> $DIR/tuple-index-suffix-proc-macro.rs:26:47 | LL | aux::bad_tup_struct_indexing!(tup_struct, 0u64); | ^^^^ invalid suffix `u64` diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs index 4f0423a704f2e..40f517f317ef7 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.rs +++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs @@ -1,5 +1,3 @@ -//@ ignore-backends: gcc - mod unclosed_delim_mod; fn main() { diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs index d7306508f39d4..51f59ccab12c0 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ revisions: empty unprefixed all_unknown all_known mixed //@[empty] needs-llvm-components: aarch64 diff --git a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs index 2d8b3b7a1915d..da482bcf97610 100644 --- a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-pass //@ needs-llvm-components: aarch64 diff --git a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs index 6838e749fd333..03f811d0c4881 100644 --- a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ check-fail //@ needs-llvm-components: aarch64 diff --git a/tests/ui/proc-macro/add-impl.rs b/tests/ui/proc-macro/add-impl.rs index 645e9321bba04..2299f05c2e7fa 100644 --- a/tests/ui/proc-macro/add-impl.rs +++ b/tests/ui/proc-macro/add-impl.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: add-impl.rs -//@ ignore-backends: gcc #[macro_use] extern crate add_impl; diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs index e580e0784b34e..8ee2223822a3c 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.rs @@ -1,6 +1,5 @@ //@ proc-macro: builtin-attrs.rs //@ compile-flags:--test -//@ ignore-backends: gcc #![feature(decl_macro, test)] diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr index e5de873cf31f8..346cebf639d17 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs-test.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `NonExistent` in this scope - --> $DIR/ambiguous-builtin-attrs-test.rs:20:5 + --> $DIR/ambiguous-builtin-attrs-test.rs:19:5 | LL | NonExistent; | ^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs.rs b/tests/ui/proc-macro/ambiguous-builtin-attrs.rs index 922a2e4c1f463..9fd7bf26adc3b 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs.rs +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs.rs @@ -1,6 +1,5 @@ //@ edition:2018 //@ proc-macro: builtin-attrs.rs -//@ ignore-backends: gcc #![feature(decl_macro)] //~ ERROR `feature` is ambiguous extern crate builtin_attrs; diff --git a/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr b/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr index 611721f9c6edb..04a76c41b8bf4 100644 --- a/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr +++ b/tests/ui/proc-macro/ambiguous-builtin-attrs.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `NonExistent` in this scope - --> $DIR/ambiguous-builtin-attrs.rs:35:5 + --> $DIR/ambiguous-builtin-attrs.rs:34:5 | LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:10:3 + --> $DIR/ambiguous-builtin-attrs.rs:9:3 | LL | #[repr(C)] | ^^^^ ambiguous name @@ -13,14 +13,14 @@ LL | #[repr(C)] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:12:18 + --> $DIR/ambiguous-builtin-attrs.rs:11:18 | LL | #[cfg_attr(true, repr(C))] | ^^^^ ambiguous name @@ -28,14 +28,14 @@ LL | #[cfg_attr(true, repr(C))] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:21:34 + --> $DIR/ambiguous-builtin-attrs.rs:20:34 | LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^ ambiguous name @@ -43,14 +43,14 @@ LL | fn non_macro_expanded_location<#[repr(C)] T>() { = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:25:11 + --> $DIR/ambiguous-builtin-attrs.rs:24:11 | LL | #[repr(C)] | ^^^^ ambiguous name @@ -58,14 +58,14 @@ LL | #[repr(C)] = note: ambiguous because of a name conflict with a builtin attribute = note: `repr` could refer to a built-in attribute note: `repr` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `allow` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:39:3 + --> $DIR/ambiguous-builtin-attrs.rs:38:3 | LL | #[allow(unused)] | ^^^^^ ambiguous name @@ -73,14 +73,14 @@ LL | #[allow(unused)] = note: ambiguous because of a name conflict with a builtin attribute = note: `allow` could refer to a built-in attribute note: `allow` could also refer to the built-in attribute imported here - --> $DIR/ambiguous-builtin-attrs.rs:38:5 + --> $DIR/ambiguous-builtin-attrs.rs:37:5 | LL | use deny as allow; | ^^^^^^^^^^^^^ = help: use `crate::allow` to refer to this built-in attribute unambiguously error[E0659]: `feature` is ambiguous - --> $DIR/ambiguous-builtin-attrs.rs:4:4 + --> $DIR/ambiguous-builtin-attrs.rs:3:4 | LL | #![feature(decl_macro)] | ^^^^^^^ ambiguous name @@ -88,14 +88,14 @@ LL | #![feature(decl_macro)] = note: ambiguous because of a name conflict with a builtin attribute = note: `feature` could refer to a built-in attribute note: `feature` could also refer to the attribute macro imported here - --> $DIR/ambiguous-builtin-attrs.rs:7:5 + --> $DIR/ambiguous-builtin-attrs.rs:6:5 | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ = help: use `crate::feature` to refer to this attribute macro unambiguously error: the `repr(C)` attribute cannot be used on match arms - --> $DIR/ambiguous-builtin-attrs.rs:25:11 + --> $DIR/ambiguous-builtin-attrs.rs:24:11 | LL | #[repr(C)] | ^^^^^^^ @@ -105,7 +105,7 @@ LL | _ => {} = help: the `repr(C)` attribute can only be applied to data types error: the `repr(C)` attribute cannot be used on type parameters - --> $DIR/ambiguous-builtin-attrs.rs:21:34 + --> $DIR/ambiguous-builtin-attrs.rs:20:34 | LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^^^^ diff --git a/tests/ui/proc-macro/append-impl.rs b/tests/ui/proc-macro/append-impl.rs index 48d21968de0ce..c0f208460b297 100644 --- a/tests/ui/proc-macro/append-impl.rs +++ b/tests/ui/proc-macro/append-impl.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: append-impl.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/attr-args.rs b/tests/ui/proc-macro/attr-args.rs index 4109b450a8ab3..1d3e0f725d250 100644 --- a/tests/ui/proc-macro/attr-args.rs +++ b/tests/ui/proc-macro/attr-args.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: attr-args.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/attr-invalid-exprs.rs b/tests/ui/proc-macro/attr-invalid-exprs.rs index bdfc0587b3b02..f476858a32ba1 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.rs +++ b/tests/ui/proc-macro/attr-invalid-exprs.rs @@ -1,7 +1,6 @@ //! Attributes producing expressions in invalid locations //@ proc-macro: attr-stmt-expr.rs -//@ ignore-backends: gcc #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] diff --git a/tests/ui/proc-macro/attr-invalid-exprs.stderr b/tests/ui/proc-macro/attr-invalid-exprs.stderr index 43241e1e6fd5c..0d500c871453f 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.stderr +++ b/tests/ui/proc-macro/attr-invalid-exprs.stderr @@ -1,11 +1,11 @@ error: expected expression, found end of macro arguments - --> $DIR/attr-invalid-exprs.rs:13:13 + --> $DIR/attr-invalid-exprs.rs:12:13 | LL | let _ = #[no_output] "Hello, world!"; | ^^^^^^^^^^^^ error: macro expansion ignores `,` and any tokens following - --> $DIR/attr-invalid-exprs.rs:16:13 + --> $DIR/attr-invalid-exprs.rs:15:13 | LL | let _ = #[duplicate] "Hello, world!"; | ^^^^^^^^^^^^ caused by the macro expansion here @@ -17,7 +17,7 @@ LL | let _ = #[duplicate]; "Hello, world!"; | + error: macro expansion ignores `,` and any tokens following - --> $DIR/attr-invalid-exprs.rs:25:9 + --> $DIR/attr-invalid-exprs.rs:24:9 | LL | #[duplicate] | ^^^^^^^^^^^^ caused by the macro expansion here diff --git a/tests/ui/proc-macro/attr-on-trait.rs b/tests/ui/proc-macro/attr-on-trait.rs index 345653864f841..e95760a837c05 100644 --- a/tests/ui/proc-macro/attr-on-trait.rs +++ b/tests/ui/proc-macro/attr-on-trait.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: attr-on-trait.rs -//@ ignore-backends: gcc extern crate attr_on_trait; diff --git a/tests/ui/proc-macro/bang-macro.rs b/tests/ui/proc-macro/bang-macro.rs index 75f40de242ec9..2287e34c5dda9 100644 --- a/tests/ui/proc-macro/bang-macro.rs +++ b/tests/ui/proc-macro/bang-macro.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: bang-macro.rs -//@ ignore-backends: gcc extern crate bang_macro; use bang_macro::rewrite; diff --git a/tests/ui/proc-macro/call-site.rs b/tests/ui/proc-macro/call-site.rs index 5de4061b2a948..9c285e1ed117a 100644 --- a/tests/ui/proc-macro/call-site.rs +++ b/tests/ui/proc-macro/call-site.rs @@ -1,6 +1,5 @@ //@ check-pass //@ proc-macro: call-site.rs -//@ ignore-backends: gcc extern crate call_site; diff --git a/tests/ui/proc-macro/count_compound_ops.rs b/tests/ui/proc-macro/count_compound_ops.rs index fe90e7bfbe49a..20b0b87817e2f 100644 --- a/tests/ui/proc-macro/count_compound_ops.rs +++ b/tests/ui/proc-macro/count_compound_ops.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: count_compound_ops.rs -//@ ignore-backends: gcc extern crate count_compound_ops; use count_compound_ops::count_compound_ops; diff --git a/tests/ui/proc-macro/derive-bad.rs b/tests/ui/proc-macro/derive-bad.rs index 9b9a2bc33c946..9b237c731dbe4 100644 --- a/tests/ui/proc-macro/derive-bad.rs +++ b/tests/ui/proc-macro/derive-bad.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-bad.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_bad; diff --git a/tests/ui/proc-macro/derive-bad.stderr b/tests/ui/proc-macro/derive-bad.stderr index 8a252e826efff..43e97f40ba884 100644 --- a/tests/ui/proc-macro/derive-bad.stderr +++ b/tests/ui/proc-macro/derive-bad.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `}` - --> $DIR/derive-bad.rs:7:10 + --> $DIR/derive-bad.rs:6:10 | LL | #[derive(A)] | ^ @@ -10,13 +10,13 @@ LL | #[derive(A)] = note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparsable tokens - --> $DIR/derive-bad.rs:7:10 + --> $DIR/derive-bad.rs:6:10 | LL | #[derive(A)] | ^ error[E0428]: the name `A` is defined multiple times - --> $DIR/derive-bad.rs:10:1 + --> $DIR/derive-bad.rs:9:1 | LL | #[derive(A)] | - previous definition of the type `A` here diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr index 3a018bdcf0ad9..faae9014c38ba 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2015.stderr @@ -1,5 +1,5 @@ error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:41:22 + --> $DIR/derive-helper-shadowing.rs:40:22 | LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL + use empty_helper; | error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:17:11 + --> $DIR/derive-helper-shadowing.rs:16:11 | LL | macro_rules! gen_helper_use { LL | () => { @@ -29,26 +29,26 @@ LL + use empty_helper; | error[E0659]: `empty_helper` is ambiguous - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ ambiguous name | = note: ambiguous because of a name conflict with a derive helper attribute note: `empty_helper` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:25:10 + --> $DIR/derive-helper-shadowing.rs:24:10 | LL | #[derive(Empty)] | ^^^^^ note: `empty_helper` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:13:5 + --> $DIR/derive-helper-shadowing.rs:12:5 | LL | use test_macros::empty_attr as empty_helper; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `crate::empty_helper` to refer to this attribute macro unambiguously error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ @@ -65,7 +65,7 @@ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0659`. Future incompatibility report: Future breakage diagnostic: error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr index a5c6ef25056ce..cb92094dada4c 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.edition2018.stderr @@ -1,17 +1,17 @@ error: cannot use a derive helper attribute through an import - --> $DIR/derive-helper-shadowing.rs:45:15 + --> $DIR/derive-helper-shadowing.rs:44:15 | LL | #[renamed] | ^^^^^^^ | note: the derive helper attribute imported here - --> $DIR/derive-helper-shadowing.rs:44:17 + --> $DIR/derive-helper-shadowing.rs:43:17 | LL | use empty_helper as renamed; | ^^^^^^^^^^^^^^^^^^^^^^^ error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:41:22 + --> $DIR/derive-helper-shadowing.rs:40:22 | LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ @@ -24,7 +24,7 @@ LL + use crate::empty_helper; | error: cannot find attribute `empty_helper` in this scope - --> $DIR/derive-helper-shadowing.rs:17:11 + --> $DIR/derive-helper-shadowing.rs:16:11 | LL | macro_rules! gen_helper_use { LL | () => { @@ -41,26 +41,26 @@ LL + use crate::empty_helper; | error[E0659]: `empty_helper` is ambiguous - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ ambiguous name | = note: ambiguous because of a name conflict with a derive helper attribute note: `empty_helper` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:25:10 + --> $DIR/derive-helper-shadowing.rs:24:10 | LL | #[derive(Empty)] | ^^^^^ note: `empty_helper` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:13:5 + --> $DIR/derive-helper-shadowing.rs:12:5 | LL | use test_macros::empty_attr as empty_helper; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `crate::empty_helper` to refer to this attribute macro unambiguously error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ @@ -77,7 +77,7 @@ error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0659`. Future incompatibility report: Future breakage diagnostic: error: derive helper attribute is used before it is introduced - --> $DIR/derive-helper-shadowing.rs:22:3 + --> $DIR/derive-helper-shadowing.rs:21:3 | LL | #[empty_helper] | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/derive-helper-shadowing.rs b/tests/ui/proc-macro/derive-helper-shadowing.rs index 324d2477869e2..6a6a5760c45a6 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.rs +++ b/tests/ui/proc-macro/derive-helper-shadowing.rs @@ -3,7 +3,6 @@ //@[edition2018] edition:2018 //@ proc-macro: test-macros.rs //@ proc-macro: derive-helper-shadowing.rs -//@ ignore-backends: gcc #[macro_use] extern crate test_macros; diff --git a/tests/ui/proc-macro/derive-same-struct.rs b/tests/ui/proc-macro/derive-same-struct.rs index 04ab08dc76e5b..f7669ba1480b2 100644 --- a/tests/ui/proc-macro/derive-same-struct.rs +++ b/tests/ui/proc-macro/derive-same-struct.rs @@ -3,7 +3,6 @@ #![allow(path_statements)] #![allow(dead_code)] //@ proc-macro: derive-same-struct.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_same_struct; diff --git a/tests/ui/proc-macro/edition-imports-2018.rs b/tests/ui/proc-macro/edition-imports-2018.rs index af9eed74adb9b..a3808d9dce823 100644 --- a/tests/ui/proc-macro/edition-imports-2018.rs +++ b/tests/ui/proc-macro/edition-imports-2018.rs @@ -1,7 +1,6 @@ //@ check-pass //@ edition:2018 //@ proc-macro: edition-imports-2015.rs -//@ ignore-backends: gcc #[macro_use] extern crate edition_imports_2015; diff --git a/tests/ui/proc-macro/env.rs b/tests/ui/proc-macro/env.rs index ef3d8b5a898cb..c6923898d6ab2 100644 --- a/tests/ui/proc-macro/env.rs +++ b/tests/ui/proc-macro/env.rs @@ -1,7 +1,6 @@ //@ proc-macro: env.rs //@ run-pass //@ rustc-env: THE_CONST=1 -//@ ignore-backends: gcc #![crate_name = "foo"] diff --git a/tests/ui/proc-macro/expand-to-unstable.rs b/tests/ui/proc-macro/expand-to-unstable.rs index 37bfeab1fe71e..8968471ebd872 100644 --- a/tests/ui/proc-macro/expand-to-unstable.rs +++ b/tests/ui/proc-macro/expand-to-unstable.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-unstable.rs -//@ ignore-backends: gcc #![allow(warnings)] diff --git a/tests/ui/proc-macro/expand-to-unstable.stderr b/tests/ui/proc-macro/expand-to-unstable.stderr index 255f80501ea73..563c7ae8f9561 100644 --- a/tests/ui/proc-macro/expand-to-unstable.stderr +++ b/tests/ui/proc-macro/expand-to-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library - --> $DIR/expand-to-unstable.rs:9:10 + --> $DIR/expand-to-unstable.rs:8:10 | LL | #[derive(Unstable)] | ^^^^^^^^ diff --git a/tests/ui/proc-macro/expand-with-a-macro.rs b/tests/ui/proc-macro/expand-with-a-macro.rs index aa02cefbec684..e5baf3601db0a 100644 --- a/tests/ui/proc-macro/expand-with-a-macro.rs +++ b/tests/ui/proc-macro/expand-with-a-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ proc-macro: expand-with-a-macro.rs -//@ ignore-backends: gcc #![deny(warnings)] diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.rs b/tests/ui/proc-macro/gen-macro-rules-hygiene.rs index fb7c830c2edf4..3deec94fa3411 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.rs +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.rs @@ -3,7 +3,6 @@ // `$crate` refers to the crate that defines `macro_rules` and not the outer transparent macro. //@ proc-macro: gen-macro-rules-hygiene.rs -//@ ignore-backends: gcc #[macro_use] extern crate gen_macro_rules_hygiene; diff --git a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr index 5238b26a6a74a..c39dc3d8de208 100644 --- a/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr +++ b/tests/ui/proc-macro/gen-macro-rules-hygiene.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'label_use` - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ undeclared label `'label_use` @@ -8,7 +8,7 @@ LL | generated!(); | ------------ in this macro invocation error[E0425]: cannot find value `local_use` in this scope - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ not found in this scope @@ -17,7 +17,7 @@ LL | generated!(); | ------------ in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/gen-macro-rules-hygiene.rs:19:13 + --> $DIR/gen-macro-rules-hygiene.rs:18:13 | LL | let local_use = 1; | ^^^^^^^^^ @@ -28,7 +28,7 @@ LL + local_def; | error[E0425]: cannot find value `local_def` in this scope - --> $DIR/gen-macro-rules-hygiene.rs:22:9 + --> $DIR/gen-macro-rules-hygiene.rs:21:9 | LL | gen_macro_rules!(); ... @@ -36,7 +36,7 @@ LL | local_def; | ^^^^^^^^^ not found in this scope | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/gen-macro-rules-hygiene.rs:13:1 + --> $DIR/gen-macro-rules-hygiene.rs:12:1 | LL | gen_macro_rules!(); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/gen-macro-rules.rs b/tests/ui/proc-macro/gen-macro-rules.rs index 8ee38b2cc2795..121d029e2e346 100644 --- a/tests/ui/proc-macro/gen-macro-rules.rs +++ b/tests/ui/proc-macro/gen-macro-rules.rs @@ -2,7 +2,6 @@ //@ check-pass //@ proc-macro: gen-macro-rules.rs -//@ ignore-backends: gcc extern crate gen_macro_rules as repro; diff --git a/tests/ui/proc-macro/generate-mod.rs b/tests/ui/proc-macro/generate-mod.rs index 23f231047e7fd..2f24b27509ab9 100644 --- a/tests/ui/proc-macro/generate-mod.rs +++ b/tests/ui/proc-macro/generate-mod.rs @@ -2,7 +2,6 @@ // Modules generated by transparent proc macros still acts as barriers for names (issue #50504). //@ proc-macro: generate-mod.rs -//@ ignore-backends: gcc extern crate generate_mod; diff --git a/tests/ui/proc-macro/generate-mod.stderr b/tests/ui/proc-macro/generate-mod.stderr index af90df2c3dc3b..821a91aa19617 100644 --- a/tests/ui/proc-macro/generate-mod.stderr +++ b/tests/ui/proc-macro/generate-mod.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:11:1 + --> $DIR/generate-mod.rs:10:1 | LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -9,7 +9,7 @@ LL | generate_mod::check!(); = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:11:1 + --> $DIR/generate-mod.rs:10:1 | LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -19,7 +19,7 @@ LL | generate_mod::check!(); = note: this error originates in the macro `generate_mod::check` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:14:1 + --> $DIR/generate-mod.rs:13:1 | LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -29,7 +29,7 @@ LL | #[generate_mod::check_attr] = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `OuterAttr` in this scope - --> $DIR/generate-mod.rs:14:1 + --> $DIR/generate-mod.rs:13:1 | LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -39,7 +39,7 @@ LL | #[generate_mod::check_attr] = note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -50,7 +50,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -60,7 +60,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -70,7 +70,7 @@ LL | #[derive(generate_mod::CheckDerive)] = note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -84,7 +84,7 @@ error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0425`. Future incompatibility report: Future breakage diagnostic: error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -96,7 +96,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:18:10 + --> $DIR/generate-mod.rs:17:10 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -108,7 +108,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -120,7 +120,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: error: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:25:14 + --> $DIR/generate-mod.rs:24:14 | LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -132,7 +132,7 @@ LL | #[derive(generate_mod::CheckDerive)] Future breakage diagnostic: warning: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:32:10 + --> $DIR/generate-mod.rs:31:10 | LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -143,7 +143,7 @@ LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed Future breakage diagnostic: warning: cannot find type `OuterDeriveLint` in this scope - --> $DIR/generate-mod.rs:32:10 + --> $DIR/generate-mod.rs:31:10 | LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import diff --git a/tests/ui/proc-macro/hygiene_example.rs b/tests/ui/proc-macro/hygiene_example.rs index f74f22fb3b0e0..84b5e345608aa 100644 --- a/tests/ui/proc-macro/hygiene_example.rs +++ b/tests/ui/proc-macro/hygiene_example.rs @@ -1,6 +1,5 @@ //@ check-pass //@ aux-build:hygiene_example.rs -//@ ignore-backends: gcc extern crate hygiene_example; use hygiene_example::hello; diff --git a/tests/ui/proc-macro/is-available.rs b/tests/ui/proc-macro/is-available.rs index 9e9cf5d11b661..faee560d7a975 100644 --- a/tests/ui/proc-macro/is-available.rs +++ b/tests/ui/proc-macro/is-available.rs @@ -3,7 +3,6 @@ extern crate proc_macro; //@ proc-macro: is-available.rs -//@ ignore-backends: gcc extern crate is_available; fn main() { diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs index 0c66b47b39418..8ff046e9b2d59 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-104884.rs -//@ ignore-backends: gcc use std::collections::BinaryHeap; diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index 0390295a66a42..2f2181be49855 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `PriorityQueue` with `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:8 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -8,7 +8,7 @@ LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^ no implementation for `PriorityQueue == PriorityQueue` | help: the trait `PartialEq` is not implemented for `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:1 | LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,13 +16,13 @@ note: required by a bound in `PartialOrd` --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0277]: the trait bound `PriorityQueue: Eq` is not satisfied - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ unsatisfied trait bound | help: the trait `Eq` is not implemented for `PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:1 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:1 | LL | struct PriorityQueue(BinaryHeap>); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,13 +31,13 @@ note: required by a bound in `Ord` = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `T` with `T` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ no implementation for `T < T` and `T > T` | note: required for `PriorityQueue` to implement `PartialOrd` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:8 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:8 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -48,7 +48,7 @@ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL error[E0277]: can't compare `BinaryHeap>` with `_` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:19:25 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:18:25 | LL | #[derive(PartialOrd, AddImpl)] | ---------- in this derive macro expansion @@ -59,7 +59,7 @@ LL | struct PriorityQueue(BinaryHeap>); = help: the trait `PartialOrd<_>` is not implemented for `BinaryHeap>` error[E0599]: no method named `cmp` found for struct `BinaryHeap>` in the current scope - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ `BinaryHeap>` is not an iterator @@ -67,7 +67,7 @@ LL | #[derive(PartialOrd, AddImpl)] = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `height` on type `&PriorityQueue` - --> $DIR/issue-104884-trait-impl-sugg-err.rs:14:22 + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 | LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^ unknown field diff --git a/tests/ui/proc-macro/issue-107113-wrap.rs b/tests/ui/proc-macro/issue-107113-wrap.rs index a46cf893d90e8..2799e79bb1cb4 100644 --- a/tests/ui/proc-macro/issue-107113-wrap.rs +++ b/tests/ui/proc-macro/issue-107113-wrap.rs @@ -1,6 +1,5 @@ //@ edition:2021 //@ proc-macro: issue-107113.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_107113; diff --git a/tests/ui/proc-macro/issue-107113-wrap.stderr b/tests/ui/proc-macro/issue-107113-wrap.stderr index 9b5b0333256e6..b541051147d53 100644 --- a/tests/ui/proc-macro/issue-107113-wrap.stderr +++ b/tests/ui/proc-macro/issue-107113-wrap.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-107113-wrap.rs:8:1 + --> $DIR/issue-107113-wrap.rs:7:1 | LL | #[issue_107113::main] | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-118809.rs b/tests/ui/proc-macro/issue-118809.rs index 3ceede7e885cf..a6a3956981a78 100644 --- a/tests/ui/proc-macro/issue-118809.rs +++ b/tests/ui/proc-macro/issue-118809.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-118809.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_118809; diff --git a/tests/ui/proc-macro/issue-118809.stderr b/tests/ui/proc-macro/issue-118809.stderr index 98329fea11940..30b09fd4006bf 100644 --- a/tests/ui/proc-macro/issue-118809.stderr +++ b/tests/ui/proc-macro/issue-118809.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-118809.rs:7:10 + --> $DIR/issue-118809.rs:6:10 | LL | #[derive(Deserialize)] | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #[derive(Deserialize)] | arguments to this enum variant are incorrect | help: the type constructed contains `u32` due to the type of the argument passed - --> $DIR/issue-118809.rs:7:10 + --> $DIR/issue-118809.rs:6:10 | LL | #[derive(Deserialize)] | ^^^^^^^^^^^ this argument influences the type of `Some` diff --git a/tests/ui/proc-macro/issue-38586.rs b/tests/ui/proc-macro/issue-38586.rs index c9623fd383b1a..88dbb8037bebd 100644 --- a/tests/ui/proc-macro/issue-38586.rs +++ b/tests/ui/proc-macro/issue-38586.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-38586.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_38586; diff --git a/tests/ui/proc-macro/issue-38586.stderr b/tests/ui/proc-macro/issue-38586.stderr index e49d4c83e2734..0049155645078 100644 --- a/tests/ui/proc-macro/issue-38586.stderr +++ b/tests/ui/proc-macro/issue-38586.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foo` in this scope - --> $DIR/issue-38586.rs:7:10 + --> $DIR/issue-38586.rs:6:10 | LL | #[derive(A)] | ^ not found in this scope diff --git a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs index 988641b2b9c48..df236cce6d2a8 100644 --- a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs +++ b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.rs @@ -4,7 +4,6 @@ //@ edition:2018 //@ proc-macro: issue-59191.rs //@ needs-unwind (affects error output) -//@ ignore-backends: gcc #![feature(custom_inner_attributes)] #![issue_59191::no_main] diff --git a/tests/ui/proc-macro/issue-79148.rs b/tests/ui/proc-macro/issue-79148.rs index 7ce6216c842a6..b2248759b5f8e 100644 --- a/tests/ui/proc-macro/issue-79148.rs +++ b/tests/ui/proc-macro/issue-79148.rs @@ -1,6 +1,5 @@ //@ proc-macro: re-export.rs //@ edition:2018 -//@ ignore-backends: gcc extern crate re_export; diff --git a/tests/ui/proc-macro/issue-79148.stderr b/tests/ui/proc-macro/issue-79148.stderr index 80a5b1a0855f7..8adc4c6e0dbe4 100644 --- a/tests/ui/proc-macro/issue-79148.stderr +++ b/tests/ui/proc-macro/issue-79148.stderr @@ -1,11 +1,11 @@ error[E0364]: `Variant` is only public within the crate, and cannot be re-exported outside - --> $DIR/issue-79148.rs:9:1 + --> $DIR/issue-79148.rs:8:1 | LL | cause_ice!(); | ^^^^^^^^^^^^ | note: consider marking `Variant` as `pub` in the imported module - --> $DIR/issue-79148.rs:9:1 + --> $DIR/issue-79148.rs:8:1 | LL | cause_ice!(); | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-83510.rs b/tests/ui/proc-macro/issue-83510.rs index 7f90906f4138e..595ce4f6c3080 100644 --- a/tests/ui/proc-macro/issue-83510.rs +++ b/tests/ui/proc-macro/issue-83510.rs @@ -1,6 +1,5 @@ //@ edition:2015..2021 //@ proc-macro: issue-83510.rs -//@ ignore-backends: gcc extern crate issue_83510; diff --git a/tests/ui/proc-macro/issue-83510.stderr b/tests/ui/proc-macro/issue-83510.stderr index 755d6e3a03ee5..f03e01f39c427 100644 --- a/tests/ui/proc-macro/issue-83510.stderr +++ b/tests/ui/proc-macro/issue-83510.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `Foo` in this scope - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -7,7 +7,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0404]: expected trait, found struct `Box` - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a trait @@ -15,7 +15,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0405]: cannot find trait `Baz` in this scope - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -23,7 +23,7 @@ LL | issue_83510::dance_like_you_want_to_ice!(); = note: this error originates in the macro `issue_83510::dance_like_you_want_to_ice` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: inherent associated types are unstable - --> $DIR/issue-83510.rs:7:1 + --> $DIR/issue-83510.rs:6:1 | LL | issue_83510::dance_like_you_want_to_ice!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/issue-91800.rs b/tests/ui/proc-macro/issue-91800.rs index 79cbf8632f009..8cecfad32b55b 100644 --- a/tests/ui/proc-macro/issue-91800.rs +++ b/tests/ui/proc-macro/issue-91800.rs @@ -1,5 +1,4 @@ //@ proc-macro: issue-91800-macro.rs -//@ ignore-backends: gcc #[macro_use] extern crate issue_91800_macro; diff --git a/tests/ui/proc-macro/issue-91800.stderr b/tests/ui/proc-macro/issue-91800.stderr index be5a8ece38404..63ebc0a552e33 100644 --- a/tests/ui/proc-macro/issue-91800.stderr +++ b/tests/ui/proc-macro/issue-91800.stderr @@ -1,5 +1,5 @@ error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ @@ -7,13 +7,13 @@ LL | #[derive(MyTrait)] = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) error: proc-macro derive produced unparsable tokens - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ error: - --> $DIR/issue-91800.rs:7:10 + --> $DIR/issue-91800.rs:6:10 | LL | #[derive(MyTrait)] | ^^^^^^^ @@ -21,7 +21,7 @@ LL | #[derive(MyTrait)] = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:11:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:11:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:16:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | fn_macro! {} = note: this error originates in the macro `fn_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:16:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/lifetimes-rpass.rs b/tests/ui/proc-macro/lifetimes-rpass.rs index 9b794e695cd1c..c462b27722f7e 100644 --- a/tests/ui/proc-macro/lifetimes-rpass.rs +++ b/tests/ui/proc-macro/lifetimes-rpass.rs @@ -2,7 +2,6 @@ #![allow(unused_variables)] //@ proc-macro: lifetimes-rpass.rs -//@ ignore-backends: gcc extern crate lifetimes_rpass as lifetimes; use lifetimes::*; diff --git a/tests/ui/proc-macro/lints_in_proc_macros.rs b/tests/ui/proc-macro/lints_in_proc_macros.rs index 2c22c787982eb..6714b8b6e1d5f 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.rs +++ b/tests/ui/proc-macro/lints_in_proc_macros.rs @@ -1,5 +1,4 @@ //@ proc-macro: bang_proc_macro2.rs -//@ ignore-backends: gcc extern crate bang_proc_macro2; diff --git a/tests/ui/proc-macro/lints_in_proc_macros.stderr b/tests/ui/proc-macro/lints_in_proc_macros.stderr index a845a73b45fe3..75e4a82914577 100644 --- a/tests/ui/proc-macro/lints_in_proc_macros.stderr +++ b/tests/ui/proc-macro/lints_in_proc_macros.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foobar2` in this scope - --> $DIR/lints_in_proc_macros.rs:10:5 + --> $DIR/lints_in_proc_macros.rs:9:5 | LL | bang_proc_macro2!(); | ^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/load-two.rs b/tests/ui/proc-macro/load-two.rs index 197e7845db33b..608379949e665 100644 --- a/tests/ui/proc-macro/load-two.rs +++ b/tests/ui/proc-macro/load-two.rs @@ -4,7 +4,6 @@ #![allow(dead_code)] //@ proc-macro: derive-atob.rs //@ proc-macro: derive-ctod.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_atob; diff --git a/tests/ui/proc-macro/macro-crate-multi-decorator.rs b/tests/ui/proc-macro/macro-crate-multi-decorator.rs index 68d4c8369382f..c89fcea2c63ea 100644 --- a/tests/ui/proc-macro/macro-crate-multi-decorator.rs +++ b/tests/ui/proc-macro/macro-crate-multi-decorator.rs @@ -3,7 +3,6 @@ //@ check-pass //@ proc-macro: duplicate.rs -//@ ignore-backends: gcc #[macro_use] extern crate duplicate; diff --git a/tests/ui/proc-macro/macro_rules_edition_from_pm.rs b/tests/ui/proc-macro/macro_rules_edition_from_pm.rs index fc3ae3ef2c814..8fc7d9097493d 100644 --- a/tests/ui/proc-macro/macro_rules_edition_from_pm.rs +++ b/tests/ui/proc-macro/macro_rules_edition_from_pm.rs @@ -7,7 +7,6 @@ //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@ check-pass -//@ ignore-backends: gcc // This checks how the expr fragment specifier works. macro_rules_edition_pm::make_edition_macro!{} diff --git a/tests/ui/proc-macro/match-expander.rs b/tests/ui/proc-macro/match-expander.rs index b7245c7e682c1..23e5746c540f7 100644 --- a/tests/ui/proc-macro/match-expander.rs +++ b/tests/ui/proc-macro/match-expander.rs @@ -1,5 +1,4 @@ //@ proc-macro: match-expander.rs -//@ ignore-backends: gcc // Ensure that we don't point at macro invocation when providing inference contexts. #[macro_use] diff --git a/tests/ui/proc-macro/match-expander.stderr b/tests/ui/proc-macro/match-expander.stderr index d2423336b1d22..b77468ec60a5e 100644 --- a/tests/ui/proc-macro/match-expander.stderr +++ b/tests/ui/proc-macro/match-expander.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/match-expander.rs:9:5 + --> $DIR/match-expander.rs:8:5 | LL | match_expander::matcher!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `S`, found `bool` diff --git a/tests/ui/proc-macro/mixed-site-span.rs b/tests/ui/proc-macro/mixed-site-span.rs index 23f90ce67b6ef..9310fb5aafa87 100644 --- a/tests/ui/proc-macro/mixed-site-span.rs +++ b/tests/ui/proc-macro/mixed-site-span.rs @@ -3,7 +3,6 @@ //@ aux-build: token-site-span.rs //@ proc-macro: mixed-site-span.rs -//@ ignore-backends: gcc extern crate mixed_site_span; extern crate token_site_span; diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 0c1aaaebba581..d47f06ce1e22c 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:49:5 + --> $DIR/mixed-site-span.rs:48:5 | LL | invoke_with_crate!{input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -9,7 +9,7 @@ LL | invoke_with_crate!{input proc_macro_item} = note: this error originates in the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:50:5 + --> $DIR/mixed-site-span.rs:49:5 | LL | invoke_with_ident!{input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -19,7 +19,7 @@ LL | invoke_with_ident!{input proc_macro_item} = note: this error originates in the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:51:5 + --> $DIR/mixed-site-span.rs:50:5 | LL | invoke_with_crate!{call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -29,7 +29,7 @@ LL | invoke_with_crate!{call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:52:5 + --> $DIR/mixed-site-span.rs:51:5 | LL | invoke_with_ident!{call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -39,7 +39,7 @@ LL | invoke_with_ident!{call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:53:5 + --> $DIR/mixed-site-span.rs:52:5 | LL | invoke_with_ident!{hello call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -49,7 +49,7 @@ LL | invoke_with_ident!{hello call proc_macro_item} = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:56:5 + --> $DIR/mixed-site-span.rs:55:5 | LL | invoke_with_ident!{krate input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -64,7 +64,7 @@ LL + invoke_with_ident!{krate input proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:57:5 + --> $DIR/mixed-site-span.rs:56:5 | LL | with_crate!{krate input proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -79,7 +79,7 @@ LL + with_crate!{krate input proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:58:5 + --> $DIR/mixed-site-span.rs:57:5 | LL | with_crate!{krate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -94,7 +94,7 @@ LL + with_crate!{krate call proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:62:28 + --> $DIR/mixed-site-span.rs:61:28 | LL | macro_rules! test {() => { LL | // crate::proc_macro_item @@ -113,7 +113,7 @@ LL + invoke_with_ident!{$crate input proc_macro_rules} | error[E0432]: unresolved import `$crate::proc_macro_item` - --> $DIR/mixed-site-span.rs:63:21 + --> $DIR/mixed-site-span.rs:62:21 | LL | macro_rules! test {() => { ... @@ -132,7 +132,7 @@ LL + with_crate!{$crate input proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:64:9 + --> $DIR/mixed-site-span.rs:63:9 | LL | with_crate!{$crate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -150,7 +150,7 @@ LL + with_crate!{$crate call proc_macro_rules} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:67:9 + --> $DIR/mixed-site-span.rs:66:9 | LL | invoke_with_ident!{$crate call proc_macro_item} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ @@ -163,7 +163,7 @@ LL | test!(); = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:89:5 + --> $DIR/mixed-site-span.rs:88:5 | LL | invoke_with_ident!{krate input TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -178,7 +178,7 @@ LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) | +++++++++++++++++++++++++++++ error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:90:5 + --> $DIR/mixed-site-span.rs:89:5 | LL | with_crate!{krate input TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -193,7 +193,7 @@ LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) | +++++++++++++++++++++++++++++ error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:91:5 + --> $DIR/mixed-site-span.rs:90:5 | LL | with_crate!{krate call TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -208,7 +208,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:94:5 + --> $DIR/mixed-site-span.rs:93:5 | LL | invoke_with_crate!{mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -224,7 +224,7 @@ LL + ($s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:95:5 + --> $DIR/mixed-site-span.rs:94:5 | LL | invoke_with_ident!{mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -240,7 +240,7 @@ LL + ($s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:96:5 + --> $DIR/mixed-site-span.rs:95:5 | LL | invoke_with_ident!{krate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -256,7 +256,7 @@ LL + ($m:ident $s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:97:5 + --> $DIR/mixed-site-span.rs:96:5 | LL | with_crate!{krate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -271,7 +271,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:101:28 + --> $DIR/mixed-site-span.rs:100:28 | LL | macro_rules! test {() => { LL | // crate::TokenItem @@ -290,7 +290,7 @@ LL + invoke_with_ident!{token_site_span::TokenItem as _} | error[E0432]: unresolved import `$crate::TokenItem` - --> $DIR/mixed-site-span.rs:102:21 + --> $DIR/mixed-site-span.rs:101:21 | LL | macro_rules! test {() => { ... @@ -309,7 +309,7 @@ LL + with_crate!{token_site_span::TokenItem as _} | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:103:9 + --> $DIR/mixed-site-span.rs:102:9 | LL | with_crate!{$crate call TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -327,7 +327,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:106:9 + --> $DIR/mixed-site-span.rs:105:9 | LL | invoke_with_ident!{$crate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -346,7 +346,7 @@ LL + ($m:ident $s:ident $i:ident) => { token_site_span::TokenItem as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:107:9 + --> $DIR/mixed-site-span.rs:106:9 | LL | with_crate!{$crate mixed TokenItem} | ^^^^^^^^^^^^^^^^^^^^^^^^^---------^ @@ -364,7 +364,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate::ItemUse` - --> $DIR/mixed-site-span.rs:131:5 + --> $DIR/mixed-site-span.rs:130:5 | LL | invoke_with_crate!{input ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -380,7 +380,7 @@ LL + ($s:ident $i:ident) => { with_crate!{ItemUse as _} }; | error[E0432]: unresolved import `$crate::ItemUse` - --> $DIR/mixed-site-span.rs:132:5 + --> $DIR/mixed-site-span.rs:131:5 | LL | invoke_with_ident!{input ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -396,7 +396,7 @@ LL + ($s:ident $i:ident) => { with_crate!{ItemUse as _} }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:135:5 + --> $DIR/mixed-site-span.rs:134:5 | LL | invoke_with_crate!{mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -412,7 +412,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:136:5 + --> $DIR/mixed-site-span.rs:135:5 | LL | invoke_with_ident!{mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -428,7 +428,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:137:5 + --> $DIR/mixed-site-span.rs:136:5 | LL | invoke_with_ident!{krate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -444,7 +444,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:138:5 + --> $DIR/mixed-site-span.rs:137:5 | LL | with_crate!{krate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -459,7 +459,7 @@ LL + ItemUse as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:140:5 + --> $DIR/mixed-site-span.rs:139:5 | LL | invoke_with_crate!{call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -475,7 +475,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:141:5 + --> $DIR/mixed-site-span.rs:140:5 | LL | invoke_with_ident!{call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -491,7 +491,7 @@ LL + ($s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:142:5 + --> $DIR/mixed-site-span.rs:141:5 | LL | invoke_with_ident!{hello call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -507,7 +507,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:145:9 + --> $DIR/mixed-site-span.rs:144:9 | LL | invoke_with_ident!{$crate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -526,7 +526,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:146:9 + --> $DIR/mixed-site-span.rs:145:9 | LL | with_crate!{$crate mixed ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -544,7 +544,7 @@ LL + ItemUse as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:148:9 + --> $DIR/mixed-site-span.rs:147:9 | LL | invoke_with_ident!{$crate call ItemUse} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ @@ -563,7 +563,7 @@ LL + ($m:ident $s:ident $i:ident) => { ItemUse as _ }; | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:155:1 + --> $DIR/mixed-site-span.rs:154:1 | LL | use_input_crate!{proc_macro_item} | ^^^^^^^^^^^^^^^^^---------------^ @@ -573,7 +573,7 @@ LL | use_input_crate!{proc_macro_item} = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:156:1 + --> $DIR/mixed-site-span.rs:155:1 | LL | use_input_krate!{proc_macro_item} | ^^^^^^^^^^^^^^^^^---------------^ @@ -583,7 +583,7 @@ LL | use_input_krate!{proc_macro_item} = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:159:1 + --> $DIR/mixed-site-span.rs:158:1 | LL | use_call_crate!{proc_macro_item} | ^^^^^^^^^^^^^^^^---------------^ @@ -593,7 +593,7 @@ LL | use_call_crate!{proc_macro_item} = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:160:1 + --> $DIR/mixed-site-span.rs:159:1 | LL | use_call_krate!{proc_macro_item} | ^^^^^^^^^^^^^^^^---------------^ @@ -603,7 +603,7 @@ LL | use_call_krate!{proc_macro_item} = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:165:1 + --> $DIR/mixed-site-span.rs:164:1 | LL | use_mixed_crate!{TokenItem} | ^^^^^^^^^^^^^^^^^---------^ @@ -619,7 +619,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:166:1 + --> $DIR/mixed-site-span.rs:165:1 | LL | use_mixed_krate!{TokenItem} | ^^^^^^^^^^^^^^^^^---------^ @@ -635,7 +635,7 @@ LL + token_site_span::TokenItem as _ | error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:171:1 + --> $DIR/mixed-site-span.rs:170:1 | LL | use_input_crate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -645,7 +645,7 @@ LL | use_input_crate!{ItemUse} = note: this error originates in the macro `use_input_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:172:1 + --> $DIR/mixed-site-span.rs:171:1 | LL | use_input_krate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -655,7 +655,7 @@ LL | use_input_krate!{ItemUse} = note: this error originates in the macro `use_input_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:173:1 + --> $DIR/mixed-site-span.rs:172:1 | LL | use_mixed_crate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -665,7 +665,7 @@ LL | use_mixed_crate!{ItemUse} = note: this error originates in the macro `use_mixed_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:174:1 + --> $DIR/mixed-site-span.rs:173:1 | LL | use_mixed_krate!{ItemUse} | ^^^^^^^^^^^^^^^^^-------^ @@ -675,7 +675,7 @@ LL | use_mixed_krate!{ItemUse} = note: this error originates in the macro `use_mixed_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:175:1 + --> $DIR/mixed-site-span.rs:174:1 | LL | use_call_crate!{ItemUse} | ^^^^^^^^^^^^^^^^-------^ @@ -685,7 +685,7 @@ LL | use_call_crate!{ItemUse} = note: this error originates in the macro `use_call_crate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0432]: unresolved import `$crate` - --> $DIR/mixed-site-span.rs:176:1 + --> $DIR/mixed-site-span.rs:175:1 | LL | use_call_krate!{ItemUse} | ^^^^^^^^^^^^^^^^-------^ @@ -695,7 +695,7 @@ LL | use_call_krate!{ItemUse} = note: this error originates in the macro `use_call_krate` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0426]: use of undeclared label `'label_use` - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ undeclared label `'label_use` @@ -703,7 +703,7 @@ LL | proc_macro_rules!(); = note: this error originates in the macro `proc_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find type `ItemUse` in crate `$crate` - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ not found in `$crate` @@ -715,13 +715,13 @@ LL + use ItemUse; | error[E0425]: cannot find value `local_use` in this scope - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ not found in this scope | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/mixed-site-span.rs:22:13 + --> $DIR/mixed-site-span.rs:21:13 | LL | let local_use = 1; | ^^^^^^^^^ @@ -733,13 +733,13 @@ LL + local_def; | error[E0425]: cannot find value `local_def` in this scope - --> $DIR/mixed-site-span.rs:28:9 + --> $DIR/mixed-site-span.rs:27:9 | LL | local_def; | ^^^^^^^^^ not found in this scope | help: an identifier with the same name is defined here, but is not accessible due to macro hygiene - --> $DIR/mixed-site-span.rs:23:9 + --> $DIR/mixed-site-span.rs:22:9 | LL | proc_macro_rules!(); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/modify-ast.rs b/tests/ui/proc-macro/modify-ast.rs index 75aea597ed576..9e890f3ebaad9 100644 --- a/tests/ui/proc-macro/modify-ast.rs +++ b/tests/ui/proc-macro/modify-ast.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: modify-ast.rs -//@ ignore-backends: gcc extern crate modify_ast; diff --git a/tests/ui/proc-macro/nonfatal-parsing.rs b/tests/ui/proc-macro/nonfatal-parsing.rs index 853cbfd075e7b..207f5316ef4d9 100644 --- a/tests/ui/proc-macro/nonfatal-parsing.rs +++ b/tests/ui/proc-macro/nonfatal-parsing.rs @@ -2,7 +2,6 @@ //@ needs-unwind //@ edition: 2024 //@ dont-require-annotations: ERROR -//@ ignore-backends: gcc // FIXME: should be a run-pass test once invalidly parsed tokens no longer result in diagnostics extern crate proc_macro; diff --git a/tests/ui/proc-macro/nonfatal-parsing.stderr b/tests/ui/proc-macro/nonfatal-parsing.stderr index f015794e2ce67..8b1f63b512578 100644 --- a/tests/ui/proc-macro/nonfatal-parsing.stderr +++ b/tests/ui/proc-macro/nonfatal-parsing.stderr @@ -34,7 +34,7 @@ LL | | error: prefix `r` is unknown - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix @@ -43,7 +43,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: prefix `c` is unknown - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ unknown prefix @@ -52,7 +52,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: unknown start of token: \u{2000} - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | | error: found invalid character; only `#` is allowed in raw string delimitation: \u{0} - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: invalid digit for a base 2 literal - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0768]: no valid digits found for number - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: binary float literal is not supported - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL | nonfatal_parsing::run!(); = note: this error originates in the macro `nonfatal_parsing::run` (in Nightly builds, run with -Z macro-backtrace for more info) error: character constant must be escaped: `'` - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL + nonfatal_parsing::run!(\'; | error: character constant must be escaped: `\n` - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL + nonfatal_parsing::run!(\n; | error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | /*a*/ 0b2 // | ^ error: invalid digit for a base 2 literal - --> $DIR/nonfatal-parsing.rs:15:5 + --> $DIR/nonfatal-parsing.rs:14:5 | LL | nonfatal_parsing::run!(); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/parent-source-spans.rs b/tests/ui/proc-macro/parent-source-spans.rs index f675f6fb6f7da..cc3ac795f7f17 100644 --- a/tests/ui/proc-macro/parent-source-spans.rs +++ b/tests/ui/proc-macro/parent-source-spans.rs @@ -1,5 +1,4 @@ //@ proc-macro: parent-source-spans.rs -//@ ignore-backends: gcc #![feature(decl_macro)] diff --git a/tests/ui/proc-macro/parent-source-spans.stderr b/tests/ui/proc-macro/parent-source-spans.stderr index 5d496ab9136a6..e865eb09ad437 100644 --- a/tests/ui/proc-macro/parent-source-spans.stderr +++ b/tests/ui/proc-macro/parent-source-spans.stderr @@ -1,5 +1,5 @@ error: first final: "hello" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:16:12 | LL | / macro two($a:expr, $b:expr) { LL | | three!($a, $b); @@ -12,7 +12,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: second final: "world" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:16:16 | LL | / macro two($a:expr, $b:expr) { LL | | three!($a, $b); @@ -25,7 +25,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: first parent: "hello" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:10:5 | LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); @@ -35,7 +35,7 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: second parent: "world" - --> $DIR/parent-source-spans.rs:11:5 + --> $DIR/parent-source-spans.rs:10:5 | LL | macro one($a:expr, $b:expr) { LL | two!($a, $b); @@ -45,31 +45,31 @@ LL | one!("hello", "world"); | ---------------------- in this macro invocation error: first grandparent: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: second grandparent: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: first source: "hello" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: second source: "world" - --> $DIR/parent-source-spans.rs:37:5 + --> $DIR/parent-source-spans.rs:36:5 | LL | one!("hello", "world"); | ^^^^^^^^^^^^^^^^^^^^^^ error: first final: "yay" - --> $DIR/parent-source-spans.rs:17:12 + --> $DIR/parent-source-spans.rs:16:12 | LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); @@ -79,7 +79,7 @@ LL | two!("yay", "rust"); | ------------------- in this macro invocation error: second final: "rust" - --> $DIR/parent-source-spans.rs:17:16 + --> $DIR/parent-source-spans.rs:16:16 | LL | macro two($a:expr, $b:expr) { LL | three!($a, $b); @@ -89,55 +89,55 @@ LL | two!("yay", "rust"); | ------------------- in this macro invocation error: first parent: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: second parent: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: first source: "yay" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: second source: "rust" - --> $DIR/parent-source-spans.rs:43:5 + --> $DIR/parent-source-spans.rs:42:5 | LL | two!("yay", "rust"); | ^^^^^^^^^^^^^^^^^^^ error: first final: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:48:12 | LL | three!("hip", "hop"); | ^^^^^ error: second final: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:48:19 | LL | three!("hip", "hop"); | ^^^^^ error: first source: "hip" - --> $DIR/parent-source-spans.rs:49:12 + --> $DIR/parent-source-spans.rs:48:12 | LL | three!("hip", "hop"); | ^^^^^ error: second source: "hop" - --> $DIR/parent-source-spans.rs:49:19 + --> $DIR/parent-source-spans.rs:48:19 | LL | three!("hip", "hop"); | ^^^^^ error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -155,7 +155,7 @@ LL + Ok; | error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope @@ -173,7 +173,7 @@ LL + Ok; | error[E0425]: cannot find value `ok` in this scope - --> $DIR/parent-source-spans.rs:30:5 + --> $DIR/parent-source-spans.rs:29:5 | LL | parent_source_spans!($($tokens)*); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/quote/basic.rs b/tests/ui/proc-macro/quote/basic.rs index 4c6fb2408fb49..0336dbb785623 100644 --- a/tests/ui/proc-macro/quote/basic.rs +++ b/tests/ui/proc-macro/quote/basic.rs @@ -1,6 +1,5 @@ //@ run-pass //@ proc-macro: basic.rs -//@ ignore-backends: gcc extern crate basic; diff --git a/tests/ui/proc-macro/span-api-tests.rs b/tests/ui/proc-macro/span-api-tests.rs index 12832ba116397..792859ed05b16 100644 --- a/tests/ui/proc-macro/span-api-tests.rs +++ b/tests/ui/proc-macro/span-api-tests.rs @@ -2,7 +2,6 @@ //@ proc-macro: span-api-tests.rs //@ aux-build:span-test-macros.rs //@ compile-flags: -Ztranslate-remapped-path-to-local-path=yes -//@ ignore-backends: gcc #[macro_use] extern crate span_test_macros; diff --git a/tests/ui/proc-macro/span-from-proc-macro.rs b/tests/ui/proc-macro/span-from-proc-macro.rs index 24a28d53476c1..4e12a695a5c09 100644 --- a/tests/ui/proc-macro/span-from-proc-macro.rs +++ b/tests/ui/proc-macro/span-from-proc-macro.rs @@ -1,7 +1,6 @@ //@ proc-macro: custom-quote.rs //@ proc-macro: span-from-proc-macro.rs //@ compile-flags: -Z macro-backtrace -//@ ignore-backends: gcc #[macro_use] extern crate span_from_proc_macro; diff --git a/tests/ui/proc-macro/span-from-proc-macro.stderr b/tests/ui/proc-macro/span-from-proc-macro.stderr index 0605c727733b2..0b840a6728061 100644 --- a/tests/ui/proc-macro/span-from-proc-macro.stderr +++ b/tests/ui/proc-macro/span-from-proc-macro.stderr @@ -7,7 +7,7 @@ LL | pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> Tok LL | field: MissingType | ^^^^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:9:1 + ::: $DIR/span-from-proc-macro.rs:8:1 | LL | #[error_from_attribute] | ----------------------- in this attribute macro expansion @@ -21,7 +21,7 @@ LL | pub fn error_from_derive(_input: TokenStream) -> TokenStream { LL | Variant(OtherMissingType) | ^^^^^^^^^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:12:10 + ::: $DIR/span-from-proc-macro.rs:11:10 | LL | #[derive(ErrorFromDerive)] | --------------- in this derive macro expansion @@ -35,7 +35,7 @@ LL | custom_quote::custom_quote! { LL | my_ident | ^^^^^^^^ not found in this scope | - ::: $DIR/span-from-proc-macro.rs:17:5 + ::: $DIR/span-from-proc-macro.rs:16:5 | LL | other_error_from_bang!(); | ------------------------ in this macro invocation @@ -51,7 +51,7 @@ LL | let bang_error: bool = 25; LL | pub fn error_from_bang(_input: TokenStream) -> TokenStream { | ---------------------------------------------------------- in this expansion of `error_from_bang!` | - ::: $DIR/span-from-proc-macro.rs:16:5 + ::: $DIR/span-from-proc-macro.rs:15:5 | LL | error_from_bang!(); | ------------------ in this macro invocation diff --git a/tests/ui/proc-macro/test.rs b/tests/ui/proc-macro/test.rs index d935dbe8ad3fb..e657d564b86fe 100644 --- a/tests/ui/proc-macro/test.rs +++ b/tests/ui/proc-macro/test.rs @@ -3,7 +3,6 @@ //@ edition: 2021 // Because of a (known) proc-macro ABI issue with GCC backend, this test // fails because of it. -//@ ignore-backends: gcc //! This is for everything that *would* be a #[test] inside of libproc_macro, //! except for the fact that proc_macro objects are not capable of existing diff --git a/tests/ui/proc-macro/weird-hygiene.rs b/tests/ui/proc-macro/weird-hygiene.rs index 8d8427d0e417e..de55484109ae3 100644 --- a/tests/ui/proc-macro/weird-hygiene.rs +++ b/tests/ui/proc-macro/weird-hygiene.rs @@ -1,5 +1,4 @@ //@ proc-macro: weird-hygiene.rs -//@ ignore-backends: gcc #![feature(stmt_expr_attributes)] #![feature(proc_macro_hygiene)] diff --git a/tests/ui/proc-macro/weird-hygiene.stderr b/tests/ui/proc-macro/weird-hygiene.stderr index a3c1e7b7671e6..2b2e705d9724d 100644 --- a/tests/ui/proc-macro/weird-hygiene.stderr +++ b/tests/ui/proc-macro/weird-hygiene.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `hidden_ident` in this scope - --> $DIR/weird-hygiene.rs:24:43 + --> $DIR/weird-hygiene.rs:23:43 | LL | Value = (stringify!($tokens + hidden_ident), 1).1 | ^^^^^^^^^^^^ not found in this scope @@ -8,14 +8,14 @@ LL | other!(50); | ---------- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/weird-hygiene.rs:44:9 + --> $DIR/weird-hygiene.rs:43:9 | LL | let hidden_ident = "Hello1"; | ^^^^^^^^^^^^ = note: this error originates in the macro `inner` which comes from the expansion of the macro `other` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0425]: cannot find value `hidden_ident` in this scope - --> $DIR/weird-hygiene.rs:35:13 + --> $DIR/weird-hygiene.rs:34:13 | LL | macro_rules! invoke_it { ... @@ -26,7 +26,7 @@ LL | invoke_it!(25); | -------------- in this macro invocation | help: an identifier with the same name exists, but is not accessible due to macro hygiene - --> $DIR/weird-hygiene.rs:44:9 + --> $DIR/weird-hygiene.rs:43:9 | LL | let hidden_ident = "Hello1"; | ^^^^^^^^^^^^ diff --git a/tests/ui/process/multi-panic.rs b/tests/ui/process/multi-panic.rs index 67bbd16fba75e..1fddffeb770a3 100644 --- a/tests/ui/process/multi-panic.rs +++ b/tests/ui/process/multi-panic.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-subprocess //@ needs-unwind -//@ ignore-backends: gcc fn check_for_no_backtrace(test: std::process::Output) { assert!(!test.status.success()); diff --git a/tests/ui/process/println-with-broken-pipe.rs b/tests/ui/process/println-with-broken-pipe.rs index 51521f1dcf42a..a56cc6aa7039b 100644 --- a/tests/ui/process/println-with-broken-pipe.rs +++ b/tests/ui/process/println-with-broken-pipe.rs @@ -9,7 +9,6 @@ //@ ignore-tvos no 'head' //@ ignore-watchos no 'head' //@ ignore-visionos no 'head' -//@ ignore-backends: gcc //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC" //@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" //@ compile-flags: -Zon-broken-pipe=error diff --git a/tests/ui/process/process-panic-after-fork.rs b/tests/ui/process/process-panic-after-fork.rs index f3b56721419cd..a4c20ea6d7900 100644 --- a/tests/ui/process/process-panic-after-fork.rs +++ b/tests/ui/process/process-panic-after-fork.rs @@ -5,7 +5,6 @@ //@ ignore-fuchsia no fork //@ ignore-tvos fork is prohibited //@ ignore-watchos fork is prohibited -//@ ignore-backends: gcc #![feature(rustc_private)] #![feature(panic_always_abort)] diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index f981ea23ee24e..3c3948de9dcc3 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -6,7 +6,6 @@ //@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib -//@ ignore-backends: gcc #![feature(no_core, intrinsics, staged_api, rustc_attrs)] #![no_core] #![crate_type = "lib"] diff --git a/tests/ui/resolve/prelude-order.rs b/tests/ui/resolve/prelude-order.rs index 9bc3793dbf20c..cb5b82f8285f6 100644 --- a/tests/ui/resolve/prelude-order.rs +++ b/tests/ui/resolve/prelude-order.rs @@ -1,6 +1,5 @@ //@ proc-macro:macro_helpers.rs //@ compile-flags: --crate-type=lib -//@ ignore-backends: gcc /* There are 5 preludes and 3 namespaces. Test the order in which they are resolved. * See https://doc.rust-lang.org/nightly/reference/names/preludes.html. diff --git a/tests/ui/resolve/prelude-order.stderr b/tests/ui/resolve/prelude-order.stderr index c7929bf74d51e..c3d2d7072da37 100644 --- a/tests/ui/resolve/prelude-order.stderr +++ b/tests/ui/resolve/prelude-order.stderr @@ -1,17 +1,17 @@ error[E0433]: cannot find `inner` in `type_ns` - --> $DIR/prelude-order.rs:62:12 + --> $DIR/prelude-order.rs:61:12 | LL | #[type_ns::inner] | ^^^^^ could not find `inner` in `type_ns` error[E0433]: cannot find `inner` in `usize` - --> $DIR/prelude-order.rs:74:10 + --> $DIR/prelude-order.rs:73:10 | LL | #[usize::inner] | ^^^^^ could not find `inner` in `usize` error[E0573]: expected type, found crate `Option` - --> $DIR/prelude-order.rs:80:12 + --> $DIR/prelude-order.rs:79:12 | LL | fn e2() -> Option { None } | ^^^^^^^^^^^ not a type @@ -22,7 +22,7 @@ LL + use std::option::Option; | error[E0308]: mismatched types - --> $DIR/prelude-order.rs:83:1 + --> $DIR/prelude-order.rs:82:1 | LL | #[test] | ^^^^^^^- help: try adding a return type: `-> &'static str` @@ -32,7 +32,7 @@ LL | #[test] = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/prelude-order.rs:87:1 + --> $DIR/prelude-order.rs:86:1 | LL | #[global_allocator] | ^^^^^^^^^^^^^^^^^^^- help: try adding a return type: `-> &'static str` diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr index 580b870d880cd..fea67c46d1dfb 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.nightly.stderr @@ -1,5 +1,5 @@ error[E0433]: cannot find type `Complete` in this scope - --> $DIR/dont-suggest-unstable-type.rs:14:12 + --> $DIR/dont-suggest-unstable-type.rs:13:12 | LL | x.push(Complete::Item { name: "hello" }); | ^^^^^^^^ use of undeclared type `Complete` diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs index c647df2420681..83390f894b87e 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.rs @@ -3,7 +3,6 @@ //! Regression test for . //! //@ needs-target-std -//@ ignore-backends: gcc //@ revisions: stable nightly //@[stable] act-as-stable diff --git a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr index ca3a399d9d765..526bccb2671d2 100644 --- a/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr +++ b/tests/ui/resolve/suggestions/dont-suggest-unstable-type.stable.stderr @@ -1,5 +1,5 @@ error[E0433]: cannot find type `Complete` in this scope - --> $DIR/dont-suggest-unstable-type.rs:14:12 + --> $DIR/dont-suggest-unstable-type.rs:13:12 | LL | x.push(Complete::Item { name: "hello" }); | ^^^^^^^^ use of undeclared type `Complete` diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr index 259a2e2c5e73b..e2616fb502e8d 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default.stderr @@ -1,5 +1,5 @@ warning: value assigned to `small` is never read - --> $DIR/std-panic-locations.rs:47:31 + --> $DIR/std-panic-locations.rs:46:31 | LL | assert_panicked(move || { small[1] += 1; }); | ^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr index 259a2e2c5e73b..e2616fb502e8d 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.mir-opt.stderr @@ -1,5 +1,5 @@ warning: value assigned to `small` is never read - --> $DIR/std-panic-locations.rs:47:31 + --> $DIR/std-panic-locations.rs:46:31 | LL | assert_panicked(move || { small[1] += 1; }); | ^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs index b365e786fd050..62338819625d4 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc //@ revisions: default mir-opt //@[mir-opt] compile-flags: -Zmir-opt-level=4 diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs index 2387dfb2bc575..414d5518e1fb0 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs @@ -7,7 +7,6 @@ //@ check-pass //@ proc-macro: count.rs -//@ ignore-backends: gcc extern crate count; const _: () = { diff --git a/tests/ui/runtime/on-broken-pipe/child-processes.rs b/tests/ui/runtime/on-broken-pipe/child-processes.rs index b7022e1b09d90..05b5a8c29ffe4 100644 --- a/tests/ui/runtime/on-broken-pipe/child-processes.rs +++ b/tests/ui/runtime/on-broken-pipe/child-processes.rs @@ -2,7 +2,6 @@ //@ ignore-cross-compile because aux-bin does not yet support it //@ ignore-remote because aux-bin does not yet support it //@ only-unix because SIGPIPE is a unix thing -//@ ignore-backends: gcc //@ run-pass //@ aux-bin:assert-sigpipe-disposition.rs //@ aux-crate:sigpipe_utils=sigpipe-utils.rs diff --git a/tests/ui/runtime/out-of-stack.rs b/tests/ui/runtime/out-of-stack.rs index 2e140bc9277a2..9038d7d291bea 100644 --- a/tests/ui/runtime/out-of-stack.rs +++ b/tests/ui/runtime/out-of-stack.rs @@ -12,7 +12,6 @@ //@ ignore-tvos stack overflow handlers aren't enabled //@ ignore-watchos stack overflow handlers aren't enabled //@ ignore-visionos stack overflow handlers aren't enabled -//@ ignore-backends: gcc #![feature(rustc_private)] diff --git a/tests/ui/runtime/rt-explody-panic-payloads.rs b/tests/ui/runtime/rt-explody-panic-payloads.rs index 1d5795f8e8652..d564a26ca7374 100644 --- a/tests/ui/runtime/rt-explody-panic-payloads.rs +++ b/tests/ui/runtime/rt-explody-panic-payloads.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-subprocess -//@ ignore-backends: gcc use std::env; use std::process::Command; diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.fixed b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed index 3a42434494d84..e3070ba150b6d 100644 --- a/tests/ui/rust-2018/suggestions-not-always-applicable.fixed +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.fixed @@ -3,7 +3,6 @@ //@ run-rustfix //@ rustfix-only-machine-applicable //@ check-pass -//@ ignore-backends: gcc #![warn(rust_2018_compatibility)] diff --git a/tests/ui/rust-2018/suggestions-not-always-applicable.rs b/tests/ui/rust-2018/suggestions-not-always-applicable.rs index 3a42434494d84..e3070ba150b6d 100644 --- a/tests/ui/rust-2018/suggestions-not-always-applicable.rs +++ b/tests/ui/rust-2018/suggestions-not-always-applicable.rs @@ -3,7 +3,6 @@ //@ run-rustfix //@ rustfix-only-machine-applicable //@ check-pass -//@ ignore-backends: gcc #![warn(rust_2018_compatibility)] diff --git a/tests/ui/rust-2021/reserved-prefixes-via-macro.rs b/tests/ui/rust-2021/reserved-prefixes-via-macro.rs index 456649f23ca67..eec1b859c2033 100644 --- a/tests/ui/rust-2021/reserved-prefixes-via-macro.rs +++ b/tests/ui/rust-2021/reserved-prefixes-via-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ edition:2021 //@ proc-macro: reserved-prefixes-macro-2018.rs -//@ ignore-backends: gcc extern crate reserved_prefixes_macro_2018 as m2018; diff --git a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs index ddb32c2671739..ead2ab40b77ac 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings-via-macro.rs @@ -1,7 +1,6 @@ //@ run-pass //@ edition:2024 //@ proc-macro: reserved-guarded-strings-macro-2021.rs -//@ ignore-backends: gcc extern crate reserved_guarded_strings_macro_2021 as m2021; diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs index dca05cc27f6e1..20f7af8c1196e 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.rs @@ -1,7 +1,6 @@ // Test for unsafe attributes generated by a proc-macro. //@ proc-macro: unsafe-attributes-pm-in-2024.rs -//@ ignore-backends: gcc unsafe_attributes_pm_in_2024::missing_unsafe!(); //~ ERROR unsafe attribute used without unsafe diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr index a65ccd29afe5a..4f1201dae2987 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm-in-2024.stderr @@ -1,5 +1,5 @@ error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:6:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:5:1 | LL | unsafe_attributes_pm_in_2024::missing_unsafe!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -7,7 +7,7 @@ LL | unsafe_attributes_pm_in_2024::missing_unsafe!(); = note: this error originates in the macro `unsafe_attributes_pm_in_2024::missing_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:8:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:7:1 | LL | #[unsafe_attributes_pm_in_2024::attr_missing_unsafe] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -15,7 +15,7 @@ LL | #[unsafe_attributes_pm_in_2024::attr_missing_unsafe] = note: this error originates in the attribute macro `unsafe_attributes_pm_in_2024::attr_missing_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:11:10 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:10:10 | LL | #[derive(unsafe_attributes_pm_in_2024::AttrMissingUnsafe)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute @@ -23,7 +23,7 @@ LL | #[derive(unsafe_attributes_pm_in_2024::AttrMissingUnsafe)] = note: this error originates in the derive macro `unsafe_attributes_pm_in_2024::AttrMissingUnsafe` (in Nightly builds, run with -Z macro-backtrace for more info) error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-from-pm-in-2024.rs:14:1 + --> $DIR/unsafe-attributes-from-pm-in-2024.rs:13:1 | LL | unsafe_attributes_pm_in_2024::macro_rules_missing_unsafe!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ usage of unsafe attribute diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs index 8b7073649b7a2..e2c504e708c55 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-from-pm.rs @@ -6,7 +6,6 @@ //@[edition2021] edition:2021 //@[edition2024] edition:2024 //@ proc-macro: unsafe-attributes-pm.rs -//@ ignore-backends: gcc unsafe_attributes_pm::missing_unsafe!(); diff --git a/tests/ui/scalable-vectors/project-into-field.rs b/tests/ui/scalable-vectors/project-into-field.rs index 4b829de8f2280..9d989190421c4 100644 --- a/tests/ui/scalable-vectors/project-into-field.rs +++ b/tests/ui/scalable-vectors/project-into-field.rs @@ -3,7 +3,6 @@ //@ compile-flags: -Copt-level=0 --target=aarch64-unknown-linux-gnu //@ dont-check-compiler-stderr //@ failure-status: 101 -//@ ignore-backends: gcc //@ needs-llvm-components: aarch64 #![feature(no_core, rustc_attrs)] #![no_std] diff --git a/tests/ui/sepcomp/sepcomp-unwind.rs b/tests/ui/sepcomp/sepcomp-unwind.rs index 0038e887c4ee6..95591676b5eed 100644 --- a/tests/ui/sepcomp/sepcomp-unwind.rs +++ b/tests/ui/sepcomp/sepcomp-unwind.rs @@ -3,7 +3,6 @@ #![allow(dead_code)] //@ compile-flags: -C codegen-units=3 //@ needs-threads -//@ ignore-backends: gcc // Test unwinding through multiple compilation units. diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index 62782db37ed4c..3b96fe3f3ba7f 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const #![allow(non_camel_case_types)] diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index b81402e9dca4d..41366957d1f63 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const #![feature(repr_simd, core_intrinsics, const_trait_impl, const_cmp, const_index)] diff --git a/tests/ui/simd/issue-17170.rs b/tests/ui/simd/issue-17170.rs index 508f480a58db3..6e5b4c413b03b 100644 --- a/tests/ui/simd/issue-17170.rs +++ b/tests/ui/simd/issue-17170.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-backends: gcc #![feature(repr_simd)] diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index 7098a4405c7fb..bae79ad28dbca 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,4 +1,3 @@ -//@ ignore-backends: gcc //@ compile-flags: --cfg minisimd_const //@ run-pass #![feature(repr_simd, core_intrinsics, const_trait_impl, const_cmp, const_index)] diff --git a/tests/ui/simd/target-feature-mixup.rs b/tests/ui/simd/target-feature-mixup.rs index 5f599f38fb92f..bf7c2c5731a36 100644 --- a/tests/ui/simd/target-feature-mixup.rs +++ b/tests/ui/simd/target-feature-mixup.rs @@ -4,7 +4,6 @@ //@ needs-subprocess //@ ignore-fuchsia must translate zircon signal to SIGILL, FIXME (#58590) -//@ ignore-backends: gcc #![feature(repr_simd)] diff --git a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs index 9e0e126dabe66..a635976c8427b 100644 --- a/tests/ui/stack-protector/warn-stack-protector-unsupported.rs +++ b/tests/ui/stack-protector/warn-stack-protector-unsupported.rs @@ -5,7 +5,6 @@ //@ [all] compile-flags: -Z stack-protector=all //@ [strong] compile-flags: -Z stack-protector=strong //@ [basic] compile-flags: -Z stack-protector=basic -//@ ignore-backends: gcc #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/ui/structs/unit-like-struct-drop-run.rs b/tests/ui/structs/unit-like-struct-drop-run.rs index 5e3fc5931bdc5..3d00871837cf8 100644 --- a/tests/ui/structs/unit-like-struct-drop-run.rs +++ b/tests/ui/structs/unit-like-struct-drop-run.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-unwind //@ needs-threads -//@ ignore-backends: gcc // Make sure the destructor is run for unit-like structs. diff --git a/tests/ui/suggestions/issue-61963.rs b/tests/ui/suggestions/issue-61963.rs index bf0680b986038..77e4b21f5dbd5 100644 --- a/tests/ui/suggestions/issue-61963.rs +++ b/tests/ui/suggestions/issue-61963.rs @@ -1,7 +1,6 @@ //@ edition: 2015 //@ proc-macro: issue-61963.rs //@ proc-macro: issue-61963-1.rs -//@ ignore-backends: gcc #![deny(bare_trait_objects)] #[macro_use] diff --git a/tests/ui/suggestions/issue-61963.stderr b/tests/ui/suggestions/issue-61963.stderr index f9146a619ec45..ffdeef12bb7f1 100644 --- a/tests/ui/suggestions/issue-61963.stderr +++ b/tests/ui/suggestions/issue-61963.stderr @@ -1,5 +1,5 @@ error: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-61963.rs:24:14 + --> $DIR/issue-61963.rs:23:14 | LL | bar: Box, | ^^^ @@ -7,7 +7,7 @@ LL | bar: Box, = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see note: the lint level is defined here - --> $DIR/issue-61963.rs:5:9 + --> $DIR/issue-61963.rs:4:9 | LL | #![deny(bare_trait_objects)] | ^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | bar: Box, | +++ error: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-61963.rs:20:1 + --> $DIR/issue-61963.rs:19:1 | LL | pub struct Foo { | ^^^ diff --git a/tests/ui/suggestions/suggest-ref-macro.rs b/tests/ui/suggestions/suggest-ref-macro.rs index 41a2acf90628a..2f31af33782cb 100644 --- a/tests/ui/suggestions/suggest-ref-macro.rs +++ b/tests/ui/suggestions/suggest-ref-macro.rs @@ -1,6 +1,5 @@ // run-check //@ proc-macro: proc-macro-type-error.rs -//@ ignore-backends: gcc extern crate proc_macro_type_error; diff --git a/tests/ui/suggestions/suggest-ref-macro.stderr b/tests/ui/suggestions/suggest-ref-macro.stderr index 9bb26f7f5ab3a..2dc46a0eb98ad 100644 --- a/tests/ui/suggestions/suggest-ref-macro.stderr +++ b/tests/ui/suggestions/suggest-ref-macro.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:9:1 + --> $DIR/suggest-ref-macro.rs:8:1 | LL | #[hello] | ^^^^^^^^ @@ -8,14 +8,14 @@ LL | #[hello] | arguments to this function are incorrect | note: function defined here - --> $DIR/suggest-ref-macro.rs:9:1 + --> $DIR/suggest-ref-macro.rs:8:1 | LL | #[hello] | ^^^^^^^^ = note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:16:11 + --> $DIR/suggest-ref-macro.rs:15:11 | LL | macro_rules! bla { LL | () => { @@ -28,7 +28,7 @@ LL | bla!(); | ------ in this macro invocation | note: function defined here - --> $DIR/suggest-ref-macro.rs:12:4 + --> $DIR/suggest-ref-macro.rs:11:4 | LL | fn x(_: &mut i32) {} | ^ ----------- @@ -38,7 +38,7 @@ LL | x(&mut 123); | ++++ error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:27:10 + --> $DIR/suggest-ref-macro.rs:26:10 | LL | x($v) | - arguments to this function are incorrect @@ -47,7 +47,7 @@ LL | bla!(456); | ^^^ expected `&mut i32`, found integer | note: function defined here - --> $DIR/suggest-ref-macro.rs:12:4 + --> $DIR/suggest-ref-macro.rs:11:4 | LL | fn x(_: &mut i32) {} | ^ ----------- diff --git a/tests/ui/target-cpu/explicit-target-cpu.rs b/tests/ui/target-cpu/explicit-target-cpu.rs index 29f8e9de1f6ea..d39c4f47036f2 100644 --- a/tests/ui/target-cpu/explicit-target-cpu.rs +++ b/tests/ui/target-cpu/explicit-target-cpu.rs @@ -22,7 +22,6 @@ //@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p //@[avr_cpu] build-pass -//@ ignore-backends: gcc #![crate_type = "rlib"] // We don't want to link in any other crate as this would make it necessary to specify diff --git a/tests/ui/target-cpu/unsupported-target-cpu.rs b/tests/ui/target-cpu/unsupported-target-cpu.rs index dafbfbc015ec1..2fccc16d37da5 100644 --- a/tests/ui/target-cpu/unsupported-target-cpu.rs +++ b/tests/ui/target-cpu/unsupported-target-cpu.rs @@ -5,7 +5,6 @@ //@[nvptx-sm60] compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib -Ctarget-cpu=sm_60 //@[nvptx-sm60] needs-llvm-components: nvptx //@[nvptx-sm60] build-fail -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs index c6b5e15599d8e..c6d9ac419abae 100644 --- a/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs +++ b/tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs @@ -9,7 +9,6 @@ // FIXME(#147881): *disable* the feature again for minicore as otherwise that will fail to build. //@[riscv] minicore-compile-flags: -Ctarget-feature=-d //@[riscv] needs-llvm-components: riscv -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core, riscv_target_feature)] diff --git a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs index 38b35c67ba6ff..10c33816b37fa 100644 --- a/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-irrelevant-target-feature-flag-disable.rs @@ -5,7 +5,6 @@ //@ needs-llvm-components: x86 //@ compile-flags: -Ctarget-feature=-x87 //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-relevant-target-modifier.rs b/tests/ui/target-feature/abi-relevant-target-modifier.rs index cb09064903ba2..ba647ffeb3af4 100644 --- a/tests/ui/target-feature/abi-relevant-target-modifier.rs +++ b/tests/ui/target-feature/abi-relevant-target-modifier.rs @@ -5,7 +5,6 @@ //@ needs-llvm-components: arm //@[allowed] compile-flags: -Cunsafe-allow-abi-mismatch=target-feature //@ aux-build: using-atomics-32.rs -//@ ignore-backends: gcc #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/abi-required-target-feature-attribute.rs b/tests/ui/target-feature/abi-required-target-feature-attribute.rs index b2d2c95313d2b..e9a9ad86f90ac 100644 --- a/tests/ui/target-feature/abi-required-target-feature-attribute.rs +++ b/tests/ui/target-feature/abi-required-target-feature-attribute.rs @@ -3,7 +3,6 @@ //@ compile-flags: --target=x86_64-unknown-none --crate-type=lib //@ needs-llvm-components: x86 //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core, x87_target_feature)] #![no_core] diff --git a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs index 489dcb4f16813..b6c0481e41553 100644 --- a/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/abi-required-target-feature-flag-disable.rs @@ -23,7 +23,6 @@ // Remove some LLVM warnings that only show up sometimes. //@ normalize-stderr: "\n[^\n]*(target-abi|lp64f)[^\n]*" -> "" -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs index 1a0b26cadd4e3..8567b5cd8522a 100644 --- a/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs +++ b/tests/ui/target-feature/abi-required-target-feature-missing-in-target-cpu.rs @@ -11,7 +11,6 @@ // check-fail -//@ ignore-backends: gcc //@ add-minicore // Don't inherit the target-cpu above for minicore, to avoid errors when building that. //@ minicore-compile-flags: -Ctarget-cpu=generic diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs index 2629f5b000f80..b9da6072aa518 100644 --- a/tests/ui/target-feature/feature-hierarchy.rs +++ b/tests/ui/target-feature/feature-hierarchy.rs @@ -12,7 +12,6 @@ //@ [hexagon-hvxv66] needs-llvm-components: hexagon //@ build-pass //@ add-minicore -//@ ignore-backends: gcc #![no_core] #![crate_type = "rlib"] #![feature(intrinsics, rustc_attrs, no_core, staged_api)] diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs index db1a7b817bb8a..4bffb0122b00e 100644 --- a/tests/ui/target-feature/forbidden-target-feature-cfg.rs +++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs @@ -2,7 +2,6 @@ //@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib //@ needs-llvm-components: riscv //@ check-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs index e1f576bb6d89e..93130c32b4c13 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs @@ -4,7 +4,6 @@ //@ compile-flags: -Ctarget-feature=-forced-atomics // For now this is just a warning. //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs index ad6d3ee6dfa9d..ea7aed374a893 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs @@ -4,7 +4,6 @@ //@ compile-flags: -Ctarget-feature=+forced-atomics // For now this is just a warning. //@ build-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] diff --git a/tests/ui/target-feature/packedstack-combinations.rs b/tests/ui/target-feature/packedstack-combinations.rs index dc45ac1ff5e83..fab2820169d3f 100644 --- a/tests/ui/target-feature/packedstack-combinations.rs +++ b/tests/ui/target-feature/packedstack-combinations.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ revisions: wrong_arch only_packedstack backchain_attr backchain_cli with_softfloat //@ compile-flags: -Zpacked-stack --crate-type=rlib -//@ ignore-backends: gcc //@ [wrong_arch] compile-flags: --target=x86_64-unknown-linux-gnu //@ [wrong_arch] should-fail diff --git a/tests/ui/target-feature/tied-features-cli.rs b/tests/ui/target-feature/tied-features-cli.rs index ffa38721c7da2..b7815a9c44d53 100644 --- a/tests/ui/target-feature/tied-features-cli.rs +++ b/tests/ui/target-feature/tied-features-cli.rs @@ -11,7 +11,6 @@ //@ [three] compile-flags: -C target-feature=+paca,+pacg,-paca //@ [four] build-pass //@ [four] compile-flags: -C target-feature=-paca,+pacg -C target-feature=+paca -//@ ignore-backends: gcc //@ add-minicore // FIXME(#147881): *disable* the features again for minicore as otherwise that will fail to build. //@ minicore-compile-flags: -C target-feature=-pacg,-paca diff --git a/tests/ui/target-feature/tied-features-no-implication-1.rs b/tests/ui/target-feature/tied-features-no-implication-1.rs index 326da8b8dcf30..3ead2185c27ab 100644 --- a/tests/ui/target-feature/tied-features-no-implication-1.rs +++ b/tests/ui/target-feature/tied-features-no-implication-1.rs @@ -3,7 +3,6 @@ //@ needs-llvm-components: aarch64 //@[paca] compile-flags: -Ctarget-feature=+paca //@[pacg] compile-flags: -Ctarget-feature=+pacg -//@ ignore-backends: gcc //@ add-minicore // FIXME(#147881): *disable* the features again for minicore as otherwise that will fail to build. //@ minicore-compile-flags: -C target-feature=-pacg,-paca diff --git a/tests/ui/target-feature/unstable-target-feature-on-nightly.rs b/tests/ui/target-feature/unstable-target-feature-on-nightly.rs index 76b01ef42d8fa..e9cbb8e115397 100644 --- a/tests/ui/target-feature/unstable-target-feature-on-nightly.rs +++ b/tests/ui/target-feature/unstable-target-feature-on-nightly.rs @@ -1,8 +1,6 @@ //! Ensure that on nightly we don't warn about using unstable target features. //@ only-x86_64 -// FIXME: Once GCC backend is fixed, remove this `ignore-backends`. -//@ ignore-backends: gcc //@ compile-flags: -Ctarget-feature=+x87 --crate-type=rlib //@ check-pass diff --git a/tests/ui/target-feature/x86-soft-float-cfg.rs b/tests/ui/target-feature/x86-soft-float-cfg.rs index 8718338ca105d..01d1cdc9e404d 100644 --- a/tests/ui/target-feature/x86-soft-float-cfg.rs +++ b/tests/ui/target-feature/x86-soft-float-cfg.rs @@ -5,7 +5,6 @@ //@[soft] compile-flags: --target=x86_64-unknown-none --crate-type=lib //@[soft] needs-llvm-components: x86 //@ check-pass -//@ ignore-backends: gcc //@ add-minicore #![feature(no_core)] #![no_core] diff --git a/tests/ui/target_modifiers/auxiliary/pauth.rs b/tests/ui/target_modifiers/auxiliary/pauth.rs index 32bd7651c0b44..9230ab460b09e 100644 --- a/tests/ui/target_modifiers/auxiliary/pauth.rs +++ b/tests/ui/target_modifiers/auxiliary/pauth.rs @@ -1,7 +1,6 @@ //@ compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=+calls,+init-fini //@ needs-llvm-components: aarch64 //@ no-prefer-dynamic -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs index 831c681179b9a..160aaf7490c25 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_default_explicit.rs @@ -3,7 +3,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia -Zsanitizer=shadow-call-stack //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs index 6aac2294283f8..701aa6e835e7e 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_default_implicit.rs @@ -4,7 +4,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs b/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs index c04ab13b310ff..2745f347fa7c5 100644 --- a/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs +++ b/tests/ui/target_modifiers/auxiliary/sanitizer_non_default.rs @@ -4,7 +4,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target riscv64gc-unknown-fuchsia -Zsanitizer=cfi -Clinker-plugin-lto //@ needs-llvm-components: riscv -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs index 3c56f64dfdb3a..81606c66c9955 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_70 //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs index 6b71ca5eb034d..5603c94eaec19 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_default_implicit.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs index a4fa7e2a33af6..25b59059db0af 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs @@ -1,7 +1,6 @@ //@ no-prefer-dynamic //@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_80 //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/defaults_check.rs b/tests/ui/target_modifiers/defaults_check.rs index c86b5a12fc8a7..f7b80807ed050 100644 --- a/tests/ui/target_modifiers/defaults_check.rs +++ b/tests/ui/target_modifiers/defaults_check.rs @@ -11,7 +11,6 @@ //@[error] compile-flags: -Zreg-struct-return=true //@[ok] check-pass //@[ok_explicit] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_fixedx18.rs b/tests/ui/target_modifiers/incompatible_fixedx18.rs index 1cf1d2fc18ff3..d6028bdc0bf27 100644 --- a/tests/ui/target_modifiers/incompatible_fixedx18.rs +++ b/tests/ui/target_modifiers/incompatible_fixedx18.rs @@ -8,7 +8,6 @@ // [error_generated] no extra compile-flags //@[allow_mismatch] check-pass //@[allow_match] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_pauth.rs b/tests/ui/target_modifiers/incompatible_pauth.rs index 302e845e8bd4f..c096f848737bb 100644 --- a/tests/ui/target_modifiers/incompatible_pauth.rs +++ b/tests/ui/target_modifiers/incompatible_pauth.rs @@ -9,7 +9,6 @@ //@ [ok_reverse_order] check-pass //@ [error_generated] compile-flags: -Zpointer-authentication=+calls,-init-fini //@ needs-llvm-components: aarch64 -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs index 07018a6d6e948..6fea34cca7789 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.rs +++ b/tests/ui/target_modifiers/incompatible_regparm.rs @@ -7,7 +7,6 @@ //@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch // [error_generated] no extra compile-flags //@[allow_regparm_mismatch] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/no_value_bool.rs b/tests/ui/target_modifiers/no_value_bool.rs index 054d27b323949..df0d57d556f32 100644 --- a/tests/ui/target_modifiers/no_value_bool.rs +++ b/tests/ui/target_modifiers/no_value_bool.rs @@ -12,7 +12,6 @@ //@[error_explicit] compile-flags: -Zreg-struct-return=false //@[ok] check-pass //@[ok_explicit] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/sanitizer_default.rs b/tests/ui/target_modifiers/sanitizer_default.rs index 5b3b1f4d7b6e5..3e00412a77de6 100644 --- a/tests/ui/target_modifiers/sanitizer_default.rs +++ b/tests/ui/target_modifiers/sanitizer_default.rs @@ -11,7 +11,6 @@ //@ aux-build:sanitizer_non_default.rs //@ compile-flags: --target riscv64gc-unknown-fuchsia //@ needs-llvm-components: riscv -//@ ignore-backends: gcc //@ revisions: implicit_default explicit_default implicit_mismatch explicit_mismatch //@[implicit_default] check-pass diff --git a/tests/ui/target_modifiers/target_cpu_default.rs b/tests/ui/target_modifiers/target_cpu_default.rs index db24989fd130e..6089283bdc8bc 100644 --- a/tests/ui/target_modifiers/target_cpu_default.rs +++ b/tests/ui/target_modifiers/target_cpu_default.rs @@ -14,7 +14,6 @@ //@ aux-build:target_cpu_non_default.rs //@ compile-flags: --target nvptx64-nvidia-cuda //@ needs-llvm-components: nvptx -//@ ignore-backends: gcc //@ revisions: implicit_default explicit_default implicit_mismatch explicit_mismatch //@[implicit_default] check-pass diff --git a/tests/ui/target_modifiers/two_flags.rs b/tests/ui/target_modifiers/two_flags.rs index c9ae341ce8c6c..e86cda43c1dc8 100644 --- a/tests/ui/target_modifiers/two_flags.rs +++ b/tests/ui/target_modifiers/two_flags.rs @@ -6,7 +6,6 @@ //@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return //@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true //@[two_allowed] check-pass -//@ ignore-backends: gcc #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/test-attrs/test-panic-while-printing.rs b/tests/ui/test-attrs/test-panic-while-printing.rs index 49e8d9c7afdf1..a50a15fbe5af5 100644 --- a/tests/ui/test-attrs/test-panic-while-printing.rs +++ b/tests/ui/test-attrs/test-panic-while-printing.rs @@ -1,7 +1,6 @@ //@ compile-flags:--test //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc use std::fmt; use std::fmt::{Display, Formatter}; diff --git a/tests/ui/threads-sendsync/task-stderr.rs b/tests/ui/threads-sendsync/task-stderr.rs index f54b5a5cc5f68..3934084e02a0a 100644 --- a/tests/ui/threads-sendsync/task-stderr.rs +++ b/tests/ui/threads-sendsync/task-stderr.rs @@ -1,7 +1,6 @@ //@ run-pass //@ needs-threads //@ needs-unwind -//@ ignore-backends: gcc #![feature(internal_output_capture)] diff --git a/tests/ui/threads-sendsync/unwind-resource.rs b/tests/ui/threads-sendsync/unwind-resource.rs index c5fbfc5bf5b03..ec27a1846fef2 100644 --- a/tests/ui/threads-sendsync/unwind-resource.rs +++ b/tests/ui/threads-sendsync/unwind-resource.rs @@ -3,7 +3,6 @@ #![allow(non_camel_case_types)] //@ needs-threads -//@ ignore-backends: gcc use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr b/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr index 75381e75bf558..47e9cdebb36d5 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.nightly.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::ops::Range` is not an iterator - --> $DIR/missing-unstable-trait-bound.rs:13:14 + --> $DIR/missing-unstable-trait-bound.rs:12:14 | LL | for _ in t {} | ^ `Range` is not an iterator diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.rs b/tests/ui/trait-bounds/missing-unstable-trait-bound.rs index ab77ffce3d768..1b563bb803a3e 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.rs +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.rs @@ -3,7 +3,6 @@ //@ ignore-wasm32 //@ ignore-wasm64 -//@ ignore-backends: gcc // //@ revisions: stable nightly //@[stable] act-as-stable diff --git a/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr b/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr index f647267ac2e07..e34826eb4984b 100644 --- a/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr +++ b/tests/ui/trait-bounds/missing-unstable-trait-bound.stable.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::ops::Range` is not an iterator - --> $DIR/missing-unstable-trait-bound.rs:13:14 + --> $DIR/missing-unstable-trait-bound.rs:12:14 | LL | for _ in t {} | ^ `Range` is not an iterator diff --git a/tests/ui/traits/clone-unwind-rc-cleanup.rs b/tests/ui/traits/clone-unwind-rc-cleanup.rs index dab48a1b4c6cf..cd02050ea2746 100644 --- a/tests/ui/traits/clone-unwind-rc-cleanup.rs +++ b/tests/ui/traits/clone-unwind-rc-cleanup.rs @@ -2,7 +2,6 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc #![allow(unused_variables)] #![allow(unused_imports)] diff --git a/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.new_precise.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.new_stock.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.old_precise.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr index 9d7d1a154ec78..33289d9ed3386 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.old_stock.stderr @@ -1,17 +1,17 @@ error[E0367]: `NonTrivialDrop` does not implement `[const] Destruct` - --> $DIR/const-drop-fail.rs:20:30 + --> $DIR/const-drop-fail.rs:19:30 | LL | struct ConstImplWithDropGlue(NonTrivialDrop); | ^^^^^^^^^^^^^^ | note: required for this `Drop` impl - --> $DIR/const-drop-fail.rs:23:1 + --> $DIR/const-drop-fail.rs:22:1 | LL | const impl Drop for ConstImplWithDropGlue { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:36:5 + --> $DIR/const-drop-fail.rs:35:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -20,13 +20,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:38:5 + --> $DIR/const-drop-fail.rs:37:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -35,7 +35,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:27:19 + --> $DIR/const-drop-fail.rs:26:19 | LL | const fn check(_: T) {} | ^^^^^^^^^^^^^^^^ required by this bound in `check` diff --git a/tests/ui/traits/const-traits/const-drop-fail.rs b/tests/ui/traits/const-traits/const-drop-fail.rs index 5a3894ed4dfe2..721b1d077f7c9 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.rs +++ b/tests/ui/traits/const-traits/const-drop-fail.rs @@ -2,7 +2,6 @@ //@[new_stock] compile-flags: -Znext-solver //@ revisions: new_stock old_stock new_precise old_precise //@ ignore-compare-mode-next-solver (explicit revisions) -//@ ignore-backends: gcc #![feature(const_trait_impl, const_destruct)] #![cfg_attr(any(new_precise, old_precise), feature(const_precise_live_drops))] diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr index ae38e9799981f..43ac8df50d8f1 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly-enabled.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -22,7 +22,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -34,7 +34,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -46,7 +46,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -57,7 +57,7 @@ LL | const trait Bar: [const] Foo {} | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -69,13 +69,13 @@ LL | const trait Bar: [const] Foo {} | +++++ error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr index ba0c399c0d27b..ed1fa6bf261a9 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.nightly.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ @@ -21,7 +21,7 @@ LL | trait Bar: [const] Foo {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ @@ -31,7 +31,7 @@ LL | const fn foo(x: &T) { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -42,7 +42,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -54,7 +54,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` @@ -66,7 +66,7 @@ LL | const trait Foo { | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -77,7 +77,7 @@ LL | const trait Bar: [const] Foo {} | +++++ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` @@ -89,13 +89,13 @@ LL | const trait Bar: [const] Foo {} | +++++ error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.rs b/tests/ui/traits/const-traits/const-supertrait-unstable.rs index 0d70a4b876d9b..04e49b4109f32 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.rs +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.rs @@ -2,7 +2,6 @@ //! We don't want to provide suggestions on stable that only make sense in nightly. //@ needs-target-std -//@ ignore-backends: gcc //@ normalize-stderr: "dev release channel" -> "nightly release channel" //@ normalize-stderr: "stable release channel" -> "nightly release channel" diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr index 196f3dc2724ba..dbcc8d46d3fc7 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.stable-enabled.stderr @@ -1,92 +1,92 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0554]: `#![feature]` may not be used on the nightly release channel - --> $DIR/const-supertrait-unstable.rs:19:30 + --> $DIR/const-supertrait-unstable.rs:18:30 | LL | #![cfg_attr(feature_enabled, feature(const_trait_impl))] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr b/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr index 50ceda54258c1..ee1c731e604a6 100644 --- a/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr +++ b/tests/ui/traits/const-traits/const-supertrait-unstable.stable.stderr @@ -1,17 +1,17 @@ error: `[const]` is not allowed here - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ | note: this trait is not `const`, so it cannot have `[const]` trait bounds - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ @@ -19,7 +19,7 @@ LL | trait Bar: [const] Foo {} = note: see issue #143874 for more information error[E0658]: const trait impls are experimental - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ @@ -27,76 +27,76 @@ LL | const fn foo(x: &T) { = note: see issue #143874 for more information error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:26:12 + --> $DIR/const-supertrait-unstable.rs:25:12 | LL | trait Bar: [const] Foo {} | ^^^^^^^ can't be applied to `Foo` | note: `Foo` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ error: `[const]` can only be applied to `const` traits - --> $DIR/const-supertrait-unstable.rs:33:17 + --> $DIR/const-supertrait-unstable.rs:32:17 | LL | const fn foo(x: &T) { | ^^^^^^^ can't be applied to `Bar` | note: `Bar` can't be used with `[const]` because it isn't `const` - --> $DIR/const-supertrait-unstable.rs:26:1 + --> $DIR/const-supertrait-unstable.rs:25:1 | LL | trait Bar: [const] Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0015]: cannot call non-const method `::a` in constant functions - --> $DIR/const-supertrait-unstable.rs:37:7 + --> $DIR/const-supertrait-unstable.rs:36:7 | LL | x.a(); | ^^^ | note: method `a` is not const because trait `Foo` is not const - --> $DIR/const-supertrait-unstable.rs:22:1 + --> $DIR/const-supertrait-unstable.rs:21:1 | LL | trait Foo { | ^^^^^^^^^ this trait is not const diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs index 81c2d778b057f..c08030fc5c150 100644 --- a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.rs @@ -1,5 +1,4 @@ //@ proc-macro: derive-demo-issue-136343.rs -//@ ignore-backends: gcc #[macro_use] extern crate derive_demo_issue_136343; diff --git a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr index d69eaae533551..0b9c1d9123aab 100644 --- a/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr +++ b/tests/ui/typeck/invalid-sugg-for-derive-macro-issue-136343.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/invalid-sugg-for-derive-macro-issue-136343.rs:7:10 + --> $DIR/invalid-sugg-for-derive-macro-issue-136343.rs:6:10 | LL | #[derive(Sample)] | ^^^^^^ diff --git a/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs index e439a82be5abb..2c2788a3e5642 100644 --- a/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs +++ b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs @@ -1,6 +1,5 @@ //@ run-pass //@ needs-unwind -//@ ignore-backends: gcc // See https://github.com/rust-lang/rust/issues/135802 enum Void {} diff --git a/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs b/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs index 21f8fe7fdf8fd..f0f1a6f99b9e9 100644 --- a/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs +++ b/tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs @@ -1,7 +1,6 @@ // This is a regression test for . //@ check-pass //@ compile-flags: -Cdebuginfo=2 -//@ ignore-backends: gcc #![feature(unsafe_binders)] use std::unsafe_binder::wrap_binder; From 0e999152f03311db3ca3ada95226f82d2617f0c1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Nov 2026 20:49:53 +0100 Subject: [PATCH 25/38] mpsc_sync::stream_send_recv_stress: wait for all thread to finish --- library/std/tests/sync/mpsc_sync.rs | 58 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/library/std/tests/sync/mpsc_sync.rs b/library/std/tests/sync/mpsc_sync.rs index dfe1f8c6b7b8c..25faeb6323548 100644 --- a/library/std/tests/sync/mpsc_sync.rs +++ b/library/std/tests/sync/mpsc_sync.rs @@ -420,34 +420,48 @@ fn oneshot_multi_thread_send_recv_stress() { #[test] fn stream_send_recv_stress() { - for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::>(0); - - send(tx, 0); - recv(rx, 0); + thread::scope(|s| { + for _ in 0..stress_factor() { + let (tx, rx) = sync_channel::>(0); + + send(tx, 0, s); + recv(rx, 0, s); + + fn send<'scope, 'env>( + tx: SyncSender>, + i: i32, + s: &'scope thread::Scope<'scope, 'env>, + ) where + 'env: 'scope, + { + if i == 10 { + return; + } - fn send(tx: SyncSender>, i: i32) { - if i == 10 { - return; + s.spawn(move || { + tx.send(Box::new(i)).unwrap(); + send(tx, i + 1, s); + }); } - thread::spawn(move || { - tx.send(Box::new(i)).unwrap(); - send(tx, i + 1); - }); - } + fn recv<'scope, 'env>( + rx: Receiver>, + i: i32, + s: &'scope thread::Scope<'scope, 'env>, + ) where + 'env: 'scope, + { + if i == 10 { + return; + } - fn recv(rx: Receiver>, i: i32) { - if i == 10 { - return; + s.spawn(move || { + assert!(*rx.recv().unwrap() == i); + recv(rx, i + 1, s); + }); } - - thread::spawn(move || { - assert!(*rx.recv().unwrap() == i); - recv(rx, i + 1); - }); } - } + }) } #[test] From d11b3f4d61c50f4149ea34a89302cf24a0c52b86 Mon Sep 17 00:00:00 2001 From: Abhinav Srivastav Date: Sun, 8 Nov 2026 16:29:33 +0000 Subject: [PATCH 26/38] fix MSVC calling convention symbol byte counts --- compiler/rustc_codegen_llvm/src/declare.rs | 13 ++++ compiler/rustc_codegen_ssa/src/back/lto.rs | 8 +-- .../src/back/symbol_export.rs | 70 +++++++++++++------ compiler/rustc_codegen_ssa/src/common.rs | 55 ++++++++++++++- .../assembly-llvm/win32-byte-count-suffix.rs | 11 ++- tests/codegen-llvm/abi-x86_64-win-zst.rs | 23 ++++-- .../msvc-x86-callconv-byte-count.rs | 46 ++++++++++++ .../unwind-abis/fastcall-unwind-abi.rs | 4 +- .../unwind-abis/stdcall-unwind-abi.rs | 4 +- .../unwind-abis/system-unwind-abi.rs | 4 +- .../unwind-abis/vectorcall-unwind-abi.rs | 4 +- .../linking/msvc-callconv-export-prefixes.rs | 37 ++++++++++ 12 files changed, 234 insertions(+), 45 deletions(-) create mode 100644 tests/codegen-llvm/msvc-x86-callconv-byte-count.rs create mode 100644 tests/ui/linking/msvc-callconv-export-prefixes.rs diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index 78bc5aba450aa..a5c7796810a63 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -169,6 +169,19 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { instance: Option>, ) -> &'ll Value { debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi); + // Some calling conventions (such as fastcall and vectorcall) decorate + // symbols with the argument byte count. Use rustc's original argument + // layouts and prefix the decorated name with `\x01` so LLVM does not + // decorate it a second time. + let decorated_name = rustc_codegen_ssa::common::windows_calling_convention_name( + &self.tcx.sess.target, + fn_abi.conv, + name, + &fn_abi.args, + ) + .map(|name| format!("\x01{name}")); + + let name = decorated_name.as_deref().unwrap_or(name); // Function addresses in Rust are never significant, allowing functions to // be merged. diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index a1de6b709cd92..c85ebe07b2c6b 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -12,7 +12,7 @@ use rustc_session::config::Lto; use rustc_structures::CrateType; use tracing::info; -use crate::back::symbol_export::{self, allocator_shim_symbols, symbol_name_for_instance_in_crate}; +use crate::back::symbol_export::{self, allocator_shim_symbols}; use crate::back::write::CodegenContext; use crate::base::allocator_kind_for_codegen; use crate::diagnostics::{DynamicLinkingWithLTO, LtoDisallowed, LtoDylib, LtoProcMacro}; @@ -104,11 +104,11 @@ pub(crate) fn exported_symbols_for_lto( tcx.exported_non_generic_symbols(cnum) .iter() .chain(tcx.exported_generic_symbols(cnum)) - .filter_map(|&(s, info): &(ExportedSymbol<'_>, SymbolExportInfo)| { + .flat_map(|&(s, info): &(ExportedSymbol<'_>, SymbolExportInfo)| { if info.level.is_below_threshold(export_threshold) || info.used { - Some(symbol_name_for_instance_in_crate(tcx, s, cnum)) + symbol_export::symbol_names_for_lto(tcx, s, cnum) } else { - None + vec![] } }) .collect::>() diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index e2acf1fdcf69b..6b9214b0b55fb 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -1,7 +1,7 @@ use std::collections::hash_map::Entry::*; use object::pe; -use rustc_abi::{CanonAbi, X86Call}; +use rustc_abi::CanonAbi; use rustc_ast::expand::allocator::{AllocatorKind, NO_ALLOC_SHIM_IS_UNSTABLE, global_fn_name}; use rustc_crate_store::CrateDepKind; use rustc_data_structures::fx::FxHashSet; @@ -758,9 +758,31 @@ fn calling_convention_for_symbol<'tcx>( .unwrap_or((CanonAbi::Rust, &[])) } +/// Names used to preserve an exported symbol during LTO. +/// +/// The restriction pass matches LLVM IR names, which retain the `\x01` +/// marker for explicitly decorated symbols. ThinLTO GUIDs instead use +/// the identifier without that marker, so preserve both spellings. +pub(crate) fn symbol_names_for_lto<'tcx>( + tcx: TyCtxt<'tcx>, + symbol: ExportedSymbol<'tcx>, + instantiating_crate: CrateNum, +) -> Vec { + let name = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); + let (callconv, args) = calling_convention_for_symbol(tcx, symbol); + + if let Some(decorated) = + crate::common::windows_calling_convention_name(&tcx.sess.target, callconv, &name, args) + { + vec![format!("\x01{decorated}"), decorated] + } else { + vec![name] + } +} /// This is the symbol name of the given instance as seen by the linker. /// -/// On 32-bit Windows symbols are decorated according to their calling conventions. +/// On Windows, symbols are decorated according to their calling conventions. +/// Vectorcall symbols are also decorated on non-Windows targets. pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( tcx: TyCtxt<'tcx>, symbol: ExportedSymbol<'tcx>, @@ -777,8 +799,15 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( let target = &tcx.sess.target; if !target.is_like_windows { + let (callconv, args) = calling_convention_for_symbol(tcx, symbol); + if let Some(name) = + crate::common::windows_calling_convention_name(target, callconv, &undecorated, args) + { + return name; + } + // Mach-O has a global "_" suffix and `object` crate will handle it. - // ELF does not have any symbol decorations. + // Other calling conventions do not need decoration here. return undecorated; } @@ -791,27 +820,26 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>( _ => return undecorated, }; + // LLVM treats names beginning with '\x01' as already mangled and strips that prefix. + // Names beginning with '?' are left undecorated by LLVM; the prefix is kept. + if let Some(name) = undecorated.strip_prefix('\x01') { + return name.to_string(); + } + if undecorated.starts_with('?') { + return undecorated; + } let (callconv, args) = calling_convention_for_symbol(tcx, symbol); - // Decorate symbols with prefixes, suffixes and total number of bytes of arguments. - // Reference: https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170 - let (prefix, suffix) = match callconv { - CanonAbi::X86(X86Call::Fastcall) => ("@", "@"), - CanonAbi::X86(X86Call::Stdcall) => ("_", "@"), - CanonAbi::X86(X86Call::Vectorcall) => ("", "@@"), - _ => { - if let Some(prefix) = prefix { - undecorated.insert(0, prefix); - } - return undecorated; - } - }; + if let Some(name) = + crate::common::windows_calling_convention_name(target, callconv, &undecorated, args) + { + return name; + } - let args_in_bytes: u64 = args - .iter() - .map(|abi| abi.layout.size.bytes().next_multiple_of(target.pointer_width as u64 / 8)) - .sum(); - format!("{prefix}{undecorated}{suffix}{args_in_bytes}") + if let Some(prefix) = prefix { + undecorated.insert(0, prefix); + } + undecorated } pub(crate) fn exporting_symbol_name_for_instance_in_crate<'tcx>( diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index b5f1fee9407f4..8b00f8a32182a 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -1,13 +1,15 @@ #![allow(non_camel_case_types)] +use rustc_abi::{CanonAbi, X86Call}; use rustc_attr_ir::PeImportNameType; use rustc_attr_ir::lang_items::LangItem; use rustc_crate_store::{DllCallingConvention, DllImport, DllImportSymbolType}; use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar}; use rustc_middle::ty::layout::TyAndLayout; -use rustc_middle::ty::{self, Instance, ScalarInt, TyCtxt}; +use rustc_middle::ty::{self, Instance, ScalarInt, Ty, TyCtxt}; use rustc_span::{Span, bug, span_bug}; -use rustc_target::spec::{CfgAbi, Env, Os, Target}; +use rustc_target::callconv::ArgAbi; +use rustc_target::spec::{Arch, CfgAbi, Env, Os, Target}; use crate::traits::*; @@ -174,6 +176,55 @@ pub fn is_using_dlltool(target: &Target) -> bool { target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified } +/// Computes the total argument size used for Windows calling-convention +/// symbol decoration. Each argument is rounded up to the pointer width. +fn windows_abi_argument_byte_sum<'tcx>(args: &[ArgAbi<'tcx, Ty<'tcx>>], target: &Target) -> u64 { + let pointer_bytes = target.pointer_width as u64 / 8; + + args.iter().map(|arg| arg.layout.size.bytes().next_multiple_of(pointer_bytes)).sum() +} + +/// Computes the linker-visible decorated symbol name for supported Windows +/// calling conventions using the original `FnAbi` argument layouts. +/// Vectorcall is also decorated on non-Windows targets. +/// +/// The byte count is computed before backend-specific argument lowering, +/// which may replace indirectly passed arguments with pointers. +/// +/// For example, on 32-bit Windows, `extern "fastcall" fn foo(i32, i32)` +/// is decorated as `@foo@8`. On 64-bit targets, +/// `extern "vectorcall" fn foo(i32)` is decorated as `foo@@8`. +/// +/// Returns `None` if no decoration is required or if the name begins with +/// `\x01` or `?`, indicating that it must not be decorated further. +/// +/// This function does not add LLVM's `\x01` escape prefix. Backend-specific +/// handling of that marker is the responsibility of the caller. +pub fn windows_calling_convention_name<'tcx>( + target: &Target, + conv: CanonAbi, + name: &str, + args: &[ArgAbi<'tcx, Ty<'tcx>>], +) -> Option { + if !target.is_like_windows && conv != CanonAbi::X86(X86Call::Vectorcall) { + return None; + } + + if name.starts_with('\x01') || name.starts_with('?') { + return None; + } + + let (prefix, suffix) = match (&target.arch, conv) { + (Arch::X86, CanonAbi::X86(X86Call::Fastcall)) => ("@", "@"), + (Arch::X86, CanonAbi::X86(X86Call::Stdcall)) => ("_", "@"), + (Arch::X86 | Arch::X86_64, CanonAbi::X86(X86Call::Vectorcall)) => ("", "@@"), + _ => return None, + }; + + let args_in_bytes = windows_abi_argument_byte_sum(args, target); + Some(format!("{prefix}{name}{suffix}{args_in_bytes}")) +} + pub fn i686_decorated_name( dll_import: &DllImport, mingw: bool, diff --git a/tests/assembly-llvm/win32-byte-count-suffix.rs b/tests/assembly-llvm/win32-byte-count-suffix.rs index 83b01c62dca85..14d90e2d4eea2 100644 --- a/tests/assembly-llvm/win32-byte-count-suffix.rs +++ b/tests/assembly-llvm/win32-byte-count-suffix.rs @@ -249,9 +249,8 @@ extern "vectorcall" fn eight_vectors_vectorcall( ) { } -/// FIXME: the mangled name for this type is incorrect on msvc, where the argument is passed -/// indirectly and a pointer takes up 4 bytes, but clang counts the size of the type and uses -/// @8 there. With GNU the value is passed directly, so the suffix is correct. +// MSVC passes this argument indirectly, but the decoration uses the +// original 8-byte type size rather than the 4-byte pointer size. #[repr(C, align(8))] struct OverAligned(u32, u32); @@ -260,16 +259,16 @@ struct OverAligned(u32, u32); extern "C" fn overaligned(_: OverAligned) {} // windows-gnu-LABEL: _overaligned_stdcall@8: -// windows-msvc-LABEL: _overaligned_stdcall@4: +// windows-msvc-LABEL: _overaligned_stdcall@8: #[unsafe(no_mangle)] extern "stdcall" fn overaligned_stdcall(_: OverAligned) {} // windows-gnu-LABEL: @overaligned_fastcall@8: -// windows-msvc-LABEL: @overaligned_fastcall@4: +// windows-msvc-LABEL: @overaligned_fastcall@8: #[unsafe(no_mangle)] extern "fastcall" fn overaligned_fastcall(_: OverAligned) {} // windows-gnu-LABEL: overaligned_vectorcall@@8: -// windows-msvc-LABEL: overaligned_vectorcall@@4: +// windows-msvc-LABEL: overaligned_vectorcall@@8: #[unsafe(no_mangle)] extern "vectorcall" fn overaligned_vectorcall(_: OverAligned) {} diff --git a/tests/codegen-llvm/abi-x86_64-win-zst.rs b/tests/codegen-llvm/abi-x86_64-win-zst.rs index bcb275a78bb82..52a81b661b5ec 100644 --- a/tests/codegen-llvm/abi-x86_64-win-zst.rs +++ b/tests/codegen-llvm/abi-x86_64-win-zst.rs @@ -43,15 +43,15 @@ extern "win64" fn pass_c_maybezst_win64(_: CMaybeZst) {} #[no_mangle] extern "win64" fn pass_c_maybezst_2_win64(_: CMaybeZst2) {} -// CHECK: define x86_vectorcallcc void @pass_rust_zst_vectorcall() +// CHECK: define x86_vectorcallcc void @"\01pass_rust_zst_vectorcall@@0"( #[no_mangle] extern "vectorcall" fn pass_rust_zst_vectorcall(_: ()) {} -// CHECK: define x86_vectorcallcc void @pass_c_maybezst_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01pass_c_maybezst_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn pass_c_maybezst_vectorcall(_: CMaybeZst) {} -// CHECK: define x86_vectorcallcc void @pass_c_maybezst_2_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01pass_c_maybezst_2_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn pass_c_maybezst_2_vectorcall(_: CMaybeZst2) {} @@ -73,6 +73,21 @@ extern "fastcall" fn pass_c_maybezst_fastcall(_: CMaybeZst) {} #[cfg(windows)] // "fastcall" is not valid on 64bit Linux extern "fastcall" fn pass_c_maybezst_2_fastcall(_: CMaybeZst2) {} +// Keep the original argument size when a vectorcall argument is passed +// indirectly. This also exercises vectorcall decoration on Linux. +#[repr(C)] +pub struct Big { + pub data: [u64; 4], +} + +// CHECK: define x86_vectorcallcc void @"\01vc_big@@32"( +#[unsafe(export_name = "vc_big")] +pub extern "vectorcall" fn vc_big(_: Big) {} + +// CHECK: define x86_vectorcallcc void @"\01vc_u64@@8"( +#[unsafe(export_name = "vc_u64")] +pub extern "vectorcall" fn vc_u64(_: u64) {} + // The sysv64 ABI ignores ZST. // CHECK: define x86_64_sysvcc void @pass_rust_zst_sysv64() @@ -116,7 +131,7 @@ extern "win64" fn ret_c_maybezst_win64() -> CMaybeZst { CMaybeZst } -// CHECK: define x86_vectorcallcc void @ret_c_maybezst_vectorcall(ptr {{[^,]*}}) +// CHECK: define x86_vectorcallcc void @"\01ret_c_maybezst_vectorcall@@0"(ptr {{[^,]*}}) #[no_mangle] extern "vectorcall" fn ret_c_maybezst_vectorcall() -> CMaybeZst { CMaybeZst diff --git a/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs b/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs new file mode 100644 index 0000000000000..ac867b9fa9a80 --- /dev/null +++ b/tests/codegen-llvm/msvc-x86-callconv-byte-count.rs @@ -0,0 +1,46 @@ +// Regression test for rust-lang/rust#165299. +// Verify decoration using source argument layouts on 32-bit Windows. +// +//@ add-minicore +//@ revisions: msvc gnu +//@[msvc] compile-flags: --target i686-pc-windows-msvc +//@[gnu] compile-flags: --target i686-pc-windows-gnu +//@ needs-llvm-components: x86 + +#![feature(abi_vectorcall, no_core)] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +#[repr(C)] +pub struct Big { + pub data: [u64; 4], +} + +// CHECK-DAG: @"\01@fast_big@32" +#[unsafe(export_name = "fast_big")] +pub extern "fastcall" fn fast_big(_: Big) {} + +// CHECK-DAG: @"\01_std_big@32" +#[unsafe(export_name = "std_big")] +pub extern "stdcall" fn std_big(_: Big) {} + +// CHECK-DAG: @"\01vec_big@@32" +#[unsafe(export_name = "vec_big")] +pub extern "vectorcall" fn vec_big(_: Big) {} + +// CHECK-DAG: @"\01vec_u64@@8" +#[unsafe(export_name = "vec_u64")] +pub extern "vectorcall" fn vec_u64(_: u64) {} + +// Names beginning with '?' are already decorated. +// CHECK-DAG: @"?special" +#[unsafe(export_name = "?special")] +pub extern "stdcall" fn question(_: u32) {} + +// The LLVM escape prefix must not acquire another decoration. +// CHECK-DAG: @"\01special" +#[unsafe(export_name = "\x01special")] +pub extern "stdcall" fn escaped(_: u32) {} diff --git a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs index 51c6fd15b9c5c..b0b5924443a65 100644 --- a/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `fastcall-unwind` extern functions. `fastcall-unwind` functions MUST NOT have this attribute. We // disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01@rust_item_that_cannot_unwind@0"() unnamed_addr #0 #[no_mangle] pub extern "fastcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01@rust_item_that_can_unwind@0"() unnamed_addr #1 #[no_mangle] pub extern "fastcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs index b5fcea52b4d61..7cd06eb4e0fc9 100644 --- a/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // extern functions. `stdcall-unwind` functions MUST NOT have this attribute. We disable // optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01_rust_item_that_cannot_unwind@0"() unnamed_addr #0 #[no_mangle] pub extern "stdcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01_rust_item_that_can_unwind@0"() unnamed_addr #1 #[no_mangle] pub extern "stdcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs index 15fce95fe285b..59b05c04dc766 100644 --- a/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @{{.*}}rust_item_that_cannot_unwind{{.*}}() unnamed_addr #0 #[no_mangle] pub extern "system" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @{{.*}}rust_item_that_can_unwind{{.*}}() unnamed_addr #1 #[no_mangle] pub extern "system-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs index 8cedb55ae1d28..664ad73797437 100644 --- a/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs +++ b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs @@ -16,11 +16,11 @@ pub trait Sized: MetaSized {} // `vectorcall-unwind` extern functions. `vectorcall-unwind` functions MUST NOT have this attribute. // We disable optimizations above to prevent LLVM from inferring the attribute. -// CHECK: @rust_item_that_cannot_unwind() unnamed_addr #0 +// CHECK: @"\01rust_item_that_cannot_unwind@@0"() unnamed_addr #0 #[no_mangle] pub extern "vectorcall" fn rust_item_that_cannot_unwind() {} -// CHECK: @rust_item_that_can_unwind() unnamed_addr #1 +// CHECK: @"\01rust_item_that_can_unwind@@0"() unnamed_addr #1 #[no_mangle] pub extern "vectorcall-unwind" fn rust_item_that_can_unwind() {} diff --git a/tests/ui/linking/msvc-callconv-export-prefixes.rs b/tests/ui/linking/msvc-callconv-export-prefixes.rs new file mode 100644 index 0000000000000..6dc7332fba847 --- /dev/null +++ b/tests/ui/linking/msvc-callconv-export-prefixes.rs @@ -0,0 +1,37 @@ +// Regression test for rust-lang/rust#165299. +// +// Cross-compile a Windows MSVC cdylib and link it to check that the +// linker-visible names agree with the names emitted by LLVM. +// +// `minicore` avoids requiring a Windows target sysroot, while rust-lld +// allows this test to link on non-Windows hosts. `/NOENTRY` avoids needing +// a DLL entry point or Windows startup libraries. +// +// Check normal vectorcall decoration and names explicitly marked as +// already decorated with either `\x01` or `?`. + +//@ build-pass +//@ add-minicore +//@ revisions: i686 x86_64 +//@[i686] compile-flags: --target i686-pc-windows-msvc +//@[x86_64] compile-flags: --target x86_64-pc-windows-msvc +//@ compile-flags: -Clinker=rust-lld -Clink-arg=/NOENTRY -Cpanic=abort +//@ needs-llvm-components: x86 +//@ needs-rust-lld +//@ ignore-backends: gcc + +#![feature(no_core, abi_vectorcall)] +#![no_core] +#![crate_type = "cdylib"] + +extern crate minicore; +use minicore::*; + +#[unsafe(export_name = "\x01ctl_vectorcall")] +pub extern "vectorcall" fn escaped(_: u32, _: u32) {} + +#[unsafe(export_name = "?q_vectorcall")] +pub extern "vectorcall" fn question(_: u32, _: u32) {} + +#[unsafe(export_name = "normal_vectorcall")] +pub extern "vectorcall" fn normal(_: u32, _: u32) {} From 8d316013429d64d908b8a2382ff23cb3676ebd22 Mon Sep 17 00:00:00 2001 From: Francisco Gouveia Date: Tue, 27 Oct 2026 15:51:04 +0000 Subject: [PATCH 27/38] Change the span building of paths from first-to-last to chained --- compiler/rustc_parse/src/parser/path.rs | 47 ++++++++++++++++++-- tests/ui/attributes/show_spans_macros.rs | 1 - tests/ui/attributes/show_spans_macros.stderr | 13 ++++-- tests/ui/proc-macro/mixed-site-span.stderr | 13 +++--- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index d41c9dbb2d4eb..5fe796d08cb1e 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -208,13 +208,15 @@ impl<'a> Parser<'a> { } let lo = self.token.span; + let mut path_span = None; let mut segments = ThinVec::new(); let mod_sep_ctxt = self.token.span.ctxt(); if self.eat_path_sep() { + chain_span(&mut path_span, self.prev_token.span); segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))); } - self.parse_path_segments(&mut segments, style, ty_generics)?; - Ok(Path { segments, span: lo.to(self.prev_token.span) }) + self.parse_path_segments_with_path_span(&mut segments, style, ty_generics, &mut path_span)?; + Ok(Path { segments, span: path_span.unwrap() }) } pub(super) fn parse_path_segments( @@ -222,9 +224,19 @@ impl<'a> Parser<'a> { segments: &mut ThinVec, style: PathStyle, ty_generics: Option<&Generics>, + ) -> PResult<'a, ()> { + self.parse_path_segments_with_path_span(segments, style, ty_generics, &mut None) + } + + fn parse_path_segments_with_path_span( + &mut self, + segments: &mut ThinVec, + style: PathStyle, + ty_generics: Option<&Generics>, + path_span: &mut Option, ) -> PResult<'a, ()> { loop { - let segment = self.parse_path_segment(style, ty_generics)?; + let segment = self.parse_path_segment_with_path_span(style, ty_generics, path_span)?; if style.has_generic_ambiguity() { // In order to check for trailing angle brackets, we must have finished // recursing (`parse_path_segment` can indirectly call this function), @@ -263,6 +275,7 @@ impl<'a> Parser<'a> { && self.look_ahead(1, |token| self.token.span.hi() == token.span.lo()) { self.bump(); // bump past the colon + chain_span(path_span, self.prev_token.span); self.dcx().emit_err(PathSingleColon { span: self.prev_token.span, suggestion: self.prev_token.span.shrink_to_hi(), @@ -273,6 +286,7 @@ impl<'a> Parser<'a> { return Ok(()); } + chain_span(path_span, self.prev_token.span); // `::` } } @@ -292,8 +306,18 @@ impl<'a> Parser<'a> { &mut self, style: PathStyle, ty_generics: Option<&Generics>, + ) -> PResult<'a, PathSegment> { + self.parse_path_segment_with_path_span(style, ty_generics, &mut None) + } + + fn parse_path_segment_with_path_span( + &mut self, + style: PathStyle, + ty_generics: Option<&Generics>, + path_span: &mut Option, ) -> PResult<'a, PathSegment> { let ident = self.parse_path_segment_ident()?; + chain_span(path_span, self.prev_token.span); let is_args_start = |token: &Token| { matches!(token.kind, token::Lt | token::Shl | token::OpenParen | token::LArrow) }; @@ -330,7 +354,9 @@ impl<'a> Parser<'a> { // Generic arguments are found - `<`, `(`, `::<` or `::(`. // First, eat `::` if it exists. - let _ = self.eat_path_sep(); + if self.eat_path_sep() { + chain_span(path_span, self.prev_token.span); + } let lo = self.token.span; let args = if self.eat_lt() { @@ -468,6 +494,14 @@ impl<'a> Parser<'a> { ParenthesizedArgs { span, inputs, inputs_span, output }.into() }; + match &args { + GenericArgs::Parenthesized(data) => { + chain_span(path_span, data.inputs_span); + chain_span(path_span, data.output.span()); + } + _ => chain_span(path_span, args.span()), + } + PathSegment { ident, args: Some(args), id: ast::DUMMY_NODE_ID } } else { // Generic arguments are not found. @@ -1020,3 +1054,8 @@ impl<'a> Parser<'a> { Err(()) } } + +/// Chains `span` into `node_span`. +fn chain_span(node_span: &mut Option, span: Span) { + *node_span = Some(node_span.map_or(span, |s| s.to(span))); +} diff --git a/tests/ui/attributes/show_spans_macros.rs b/tests/ui/attributes/show_spans_macros.rs index a8a435b009e16..b7c3dc1f57bd1 100644 --- a/tests/ui/attributes/show_spans_macros.rs +++ b/tests/ui/attributes/show_spans_macros.rs @@ -15,7 +15,6 @@ mod foo { pub const BAR: u8 = 1; } -// FIXME(#126763): the span should be `$a::$b` in the macro body. macro_rules! path { ($a:tt, $b:tt) => { let _ = $a::$b; diff --git a/tests/ui/attributes/show_spans_macros.stderr b/tests/ui/attributes/show_spans_macros.stderr index 0fa76e9cc9392..68f94199b6321 100644 --- a/tests/ui/attributes/show_spans_macros.stderr +++ b/tests/ui/attributes/show_spans_macros.stderr @@ -1,17 +1,22 @@ note: showing the spans of the path - --> $DIR/show_spans_macros.rs:27:11 + --> $DIR/show_spans_macros.rs:20:17 | +LL | macro_rules! path { +LL | ($a:tt, $b:tt) => { +LL | let _ = $a::$b; + | ^^^^^^ +... LL | path!(foo, BAR); - | ^^^^^^^^ + | --------------- in this macro invocation note: showing the spans of the expr - --> $DIR/show_spans_macros.rs:41:12 + --> $DIR/show_spans_macros.rs:40:12 | LL | field!(T, 0); | ^^^^ note: showing the spans of the expr - --> $DIR/show_spans_macros.rs:41:12 + --> $DIR/show_spans_macros.rs:40:12 | LL | field!(T, 0); | ^ diff --git a/tests/ui/proc-macro/mixed-site-span.stderr b/tests/ui/proc-macro/mixed-site-span.stderr index 0c1aaaebba581..ced32be913ab2 100644 --- a/tests/ui/proc-macro/mixed-site-span.stderr +++ b/tests/ui/proc-macro/mixed-site-span.stderr @@ -172,10 +172,11 @@ LL | invoke_with_ident!{krate input TokenItem} | = note: this error originates in the macro `with_crate` which comes from the expansion of the macro `invoke_with_ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead - --> $DIR/auxiliary/mixed-site-span.rs:60:34 + --> $DIR/auxiliary/token-site-span.rs:20:39 + | +LL - ($m:ident $s:ident $i:ident) => { with_crate!{$m $s $i} }; +LL + ($m:ident $s:ident $i:ident) => { token_site_span::TokenItem as _ }; | -LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) - | +++++++++++++++++++++++++++++ error[E0432]: unresolved import `$crate::TokenItem` --> $DIR/mixed-site-span.rs:90:5 @@ -187,10 +188,10 @@ LL | with_crate!{krate input TokenItem} | = note: this error originates in the macro `with_crate` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing this struct instead - --> $DIR/auxiliary/mixed-site-span.rs:60:34 | -LL | quote!(use $krate::$ident as token_site_span::TokenItem as _;) - | +++++++++++++++++++++++++++++ +LL - with_crate!{krate input TokenItem} +LL + token_site_span::TokenItem as _ + | error[E0432]: unresolved import `$crate` --> $DIR/mixed-site-span.rs:91:5 From b52077cac99d4b0f0ed8f063320fadb9c9e0b87c Mon Sep 17 00:00:00 2001 From: Luca Versari Date: Sat, 7 Nov 2026 10:46:50 +0100 Subject: [PATCH 28/38] Remove `backend_optimization_level`. Turns out that all uses were effectively equivalent to using sess.opts.optimize. --- .../rustc_codegen_cranelift/src/driver/aot.rs | 8 ++---- compiler/rustc_codegen_gcc/src/lib.rs | 6 +--- .../src/back/llvm_backend.rs | 10 ++----- compiler/rustc_codegen_llvm/src/back/write.rs | 2 +- compiler/rustc_codegen_ssa/src/back/write.rs | 13 ++++----- compiler/rustc_codegen_ssa/src/base.rs | 28 +------------------ compiler/rustc_codegen_ssa/src/lib.rs | 1 - .../rustc_codegen_ssa/src/traits/write.rs | 8 ++---- compiler/rustc_middle/src/queries.rs | 6 +--- 9 files changed, 16 insertions(+), 66 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index ce3741b582827..6fde623d46f73 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -22,7 +22,7 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_middle::dep_graph::WorkProduct; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mono::{MonoItem, MonoItemData, Visibility}; -use rustc_session::config::{OptLevel, OutputFilenames, OutputType}; +use rustc_session::config::{OutputFilenames, OutputType}; use rustc_session::{BorrowedIncrCompSession, Session}; use rustc_span::Symbol; @@ -318,11 +318,7 @@ impl WriteBackendMethods for AotDriver { type TargetMachine = (); type ThinData = Infallible; - fn target_machine_factory( - &self, - _sess: &Session, - _opt_level: OptLevel, - ) -> TargetMachineFactoryFn { + fn target_machine_factory(&self, _sess: &Session) -> TargetMachineFactoryFn { Arc::new(|_, _| ()) } diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index 17034d0c195e7..fa15ec2838b24 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -409,11 +409,7 @@ impl WriteBackendMethods for GccCodegenBackend { false } - fn target_machine_factory( - &self, - _sess: &Session, - _opt_level: OptLevel, - ) -> TargetMachineFactoryFn { + fn target_machine_factory(&self, _sess: &Session) -> TargetMachineFactoryFn { // FIXME(antoyo): set opt level. Arc::new(|_, _| ()) } diff --git a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs index 69d63c52e4b88..7864d0cc81491 100644 --- a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs +++ b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs @@ -22,7 +22,7 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle}; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; -use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest}; +use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest}; use rustc_session::{ BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session, }; @@ -89,12 +89,8 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn thread_profiler() -> Box { Box::new(TimeTraceProfiler::new()) } - fn target_machine_factory( - &self, - sess: &Session, - optlvl: OptLevel, - ) -> TargetMachineFactoryFn { - back::write::target_machine_factory(sess, optlvl) + fn target_machine_factory(&self, sess: &Session) -> TargetMachineFactoryFn { + back::write::target_machine_factory(sess, sess.opts.optimize) } fn optimize_and_codegen_fat_lto( sess: &Session, diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index e43b9ba6359ed..4e1a3f998a265 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -116,7 +116,7 @@ pub(crate) fn create_target_machine(tcx: TyCtxt<'_>, mod_name: &str) -> OwnedTar Some(tcx.output_filenames(()).temp_path_for_cgu(OutputType::Object, mod_name)); let config = TargetMachineFactoryConfig { split_dwarf_file, output_obj_file }; - target_machine_factory(tcx.sess, tcx.backend_optimization_level(()))(tcx.dcx(), config) + target_machine_factory(tcx.sess, tcx.sess.opts.optimize)(tcx.dcx(), config) } // `s` and `z` are the same codegen level; what tells LLVM that they are size builds is the diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 406e5a5b04c61..24fcab7218f7e 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -23,8 +23,8 @@ use rustc_metadata::fs::copy_to_stdout; use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::ty::TyCtxt; use rustc_session::config::{ - self, JobsMode, Lto, OptLevel, OptimizationObjective, OutFileName, OutputFilenames, OutputType, - Passes, SwitchWithOptPath, + self, JobsMode, Lto, OptimizationObjective, OutFileName, OutputFilenames, OutputType, Passes, + SwitchWithOptPath, }; use rustc_session::{BorrowedIncrCompSession, IncrCompSession, Session}; use rustc_span::source_map::SourceMap; @@ -328,7 +328,6 @@ pub struct CodegenContext { pub crate_types: Vec, pub output_filenames: Arc, pub module_config: Arc, - pub opt_level: OptLevel, pub msvc_imps_needed: bool, pub is_pe_coff: bool, pub target_can_use_split_dwarf: bool, @@ -1243,8 +1242,7 @@ fn start_executing_work( .expect("failed to spawn helper thread") }); - let opt_level = tcx.backend_optimization_level(()); - let tm_factory = backend.target_machine_factory(tcx.sess, opt_level); + let tm_factory = backend.target_machine_factory(tcx.sess); let remark_dir = if let Some(ref dir) = sess.opts.unstable_opts.remark_dir { let result = fs::create_dir_all(dir).and_then(|_| dir.canonicalize()); @@ -1271,7 +1269,6 @@ fn start_executing_work( remark_dir, output_filenames: Arc::clone(tcx.output_filenames(())), module_config: regular_config, - opt_level, msvc_imps_needed: msvc_imps_needed(tcx), is_pe_coff: tcx.sess.target.is_like_windows, target_can_use_split_dwarf: tcx.sess.target_can_use_split_dwarf(), @@ -2147,7 +2144,7 @@ impl OngoingCodegen { (compiled_modules, work_products) } MaybeLtoModules::FatLto { cgcx, needs_fat_lto } => { - let tm_factory = self.backend.target_machine_factory(sess, cgcx.opt_level); + let tm_factory = self.backend.target_machine_factory(sess); // FIXME cache local pre-LTO bitcode let work_products = WorkProductMap::default(); @@ -2168,7 +2165,7 @@ impl OngoingCodegen { (compiled_modules, work_products) } MaybeLtoModules::ThinLto { cgcx, needs_thin_lto } => { - let tm_factory = self.backend.target_machine_factory(sess, cgcx.opt_level); + let tm_factory = self.backend.target_machine_factory(sess); let compiled_modules = CompiledModules { modules: do_thin_lto::( diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index ae35dcfe42e60..4361e192972f4 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -11,14 +11,13 @@ use rustc_ast::expand::allocator::{ }; use rustc_attr_ir::lang_items::LangItem; use rustc_attr_ir::target::Target; -use rustc_attr_ir::{DebuggerVisualizerType, EiiDecl, EiiImpl, OptimizeAttr, find_attr}; +use rustc_attr_ir::{DebuggerVisualizerType, EiiDecl, EiiImpl, find_attr}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; use rustc_data_structures::unord::UnordMap; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile; use rustc_middle::middle::dependency_format::{Dependencies, Linkage}; use rustc_middle::middle::exported_symbols::{self, SymbolExportKind}; @@ -26,7 +25,6 @@ use rustc_middle::middle::lang_items; use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, ErrorHandled, Scalar}; use rustc_middle::mir::{BinOp, ConstValue}; use rustc_middle::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem, MonoItemPartitions}; -use rustc_middle::query::Providers; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutOf, TyAndLayout}; use rustc_middle::ty::{self, Instance, PatternKind, Ty, TyCtxt, UintTy, Unnormalized}; use rustc_session::config::{self, EntryFnType, JobsMode}; @@ -1217,30 +1215,6 @@ impl CrateInfo { } } -pub(crate) fn provide(providers: &mut Providers) { - providers.backend_optimization_level = |tcx, cratenum| { - let global = tcx.sess.opts.optimize; - - // Nothing to promote outside a size build. At `-Copt-level=0` the upgrade would populate - // the pass manager, and its module-wide passes ignore the `optnone` annotation. - if global.objective() != config::OptimizationObjective::Size { - return global; - } - - // A speed-marked body in a size build needs a speed level, and `-O2` is the lowest one. - let for_speed = config::OptLevel::More; - - let defids = tcx.collect_and_partition_mono_items(cratenum).all_mono_items; - - let any_for_speed = defids.items().any(|id| { - let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id); - matches!(optimize, OptimizeAttr::Speed) - }); - - if any_for_speed { for_speed } else { global } - }; -} - pub fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() || tcx.sess.opts.unstable_opts.disable_incr_comp_backend_caching diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 1ac9564db0149..d19b80897a21d 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -326,7 +326,6 @@ pub enum CodegenError { pub fn provide(providers: &mut Providers) { crate::back::symbol_export::provide(providers); - crate::base::provide(&mut providers.queries); crate::target_features::provide(&mut providers.queries); crate::codegen_attrs::provide(&mut providers.queries); } diff --git a/compiler/rustc_codegen_ssa/src/traits/write.rs b/compiler/rustc_codegen_ssa/src/traits/write.rs index 36bc0a68d882e..1576c438f54ae 100644 --- a/compiler/rustc_codegen_ssa/src/traits/write.rs +++ b/compiler/rustc_codegen_ssa/src/traits/write.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_errors::DiagCtxtHandle; use rustc_middle::dep_graph::WorkProduct; -use rustc_session::{BorrowedIncrCompSession, Session, config}; +use rustc_session::{BorrowedIncrCompSession, Session}; use crate::back::lto::ThinModule; use crate::back::write::{ @@ -28,11 +28,7 @@ pub trait WriteBackendMethods: Clone + 'static { fn thread_profiler() -> Box { Box::new(()) } - fn target_machine_factory( - &self, - sess: &Session, - opt_level: config::OptLevel, - ) -> TargetMachineFactoryFn; + fn target_machine_factory(&self, sess: &Session) -> TargetMachineFactoryFn; /// Performs fat LTO by merging all modules into a single one, running autodiff /// if necessary and running any further optimizations fn optimize_and_codegen_fat_lto( diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 7442daa296f03..9b58174f58ebe 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -74,7 +74,7 @@ use rustc_lint_defs::{LintId, StableLintExpectationId}; use rustc_macros::rustc_queries; use rustc_middle::middle::resolve::TypeRelativeDelegationRes; use rustc_session::Limits; -use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion}; +use rustc_session::config::{EntryFnType, OutputFilenames, SymbolManglingVersion}; use rustc_span::def_id::{LOCAL_CRATE, ModId}; use rustc_span::{DUMMY_SP, LocalExpnId, Span, Spanned, Symbol}; use rustc_target::spec::PanicStrategy; @@ -2488,10 +2488,6 @@ rustc_queries! { desc { "getting codegen unit `{sym}`" } } - query backend_optimization_level(_: ()) -> OptLevel { - desc { "optimization level used by backend" } - } - /// Return the filenames where output artefacts shall be stored. /// /// This query returns an `&Arc` because codegen backends need the value even after the `TyCtxt` From 6e05a38ff3002035167e1ccabd6d3b880d3fda2b Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 1 Mar 2026 15:42:59 +0300 Subject: [PATCH 29/38] Partially stabilize `ptr_alignment_type` as `alignment_type` --- compiler/rustc_data_structures/src/lib.rs | 2 +- compiler/rustc_middle/src/lib.rs | 2 +- library/core/src/alloc/layout.rs | 10 +-- library/core/src/mem/alignment.rs | 74 ++++++++----------- library/core/src/mem/mod.rs | 4 +- library/core/src/num/error.rs | 1 - library/core/src/ptr/mod.rs | 5 -- src/tools/miri/tests/fail/alloc/too_large.rs | 3 +- .../miri/tests/fail/alloc/too_large.stderr | 4 +- .../fail/alloc/unsupported_big_alignment.rs | 1 - .../fail/data_race/dealloc_read_race1.rs | 3 +- .../fail/data_race/dealloc_read_race1.stderr | 2 +- .../fail/data_race/dealloc_read_race2.rs | 3 +- .../fail/data_race/dealloc_read_race2.stderr | 2 +- .../fail/data_race/dealloc_write_race1.rs | 3 +- .../fail/data_race/dealloc_write_race1.stderr | 2 +- .../fail/data_race/dealloc_write_race2.rs | 3 +- .../fail/data_race/dealloc_write_race2.stderr | 2 +- tests/ui/precondition-checks/alignment.rs | 2 - .../traits/const-traits/const-traits-core.rs | 1 - 20 files changed, 52 insertions(+), 77 deletions(-) diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index c20ac042516af..7f82aeb0cbc63 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,6 +10,7 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(ptr_alignment_type))] #![cfg_attr(bootstrap, feature(unwrap_infallible))] #![cfg_attr(test, feature(test))] #![deny(unsafe_op_in_unsafe_fn)] @@ -28,7 +29,6 @@ #![feature(nonzero_internals)] #![feature(pattern_type_macro)] #![feature(pattern_types)] -#![feature(ptr_alignment_type)] #![feature(rustc_attrs)] #![feature(sized_hierarchy)] #![feature(thread_id_value)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 695eca6225858..0b404cf43c80d 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -28,6 +28,7 @@ #![allow(internal_features)] #![allow(rustc::direct_use_of_rustc_type_ir)] #![cfg_attr(bootstrap, feature(debug_closure_helpers))] +#![cfg_attr(bootstrap, feature(ptr_alignment_type))] #![cfg_attr(doc, feature(intra_doc_pointers))] #![feature(allocator_ext)] #![feature(associated_type_defaults)] @@ -45,7 +46,6 @@ #![feature(min_specialization)] #![feature(negative_impls)] #![feature(option_into_flat_iter)] -#![feature(ptr_alignment_type)] #![feature(range_bounds_is_empty)] #![feature(rustc_attrs)] #![feature(sized_hierarchy)] diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 0ae297ad294e4..31b20e5967270 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -104,7 +104,7 @@ impl Layout { /// * `size`, when rounded up to the nearest multiple of `alignment`, /// must not overflow `isize` (i.e., the rounded value must be /// less than or equal to `isize::MAX`). - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[inline] pub const fn from_size_alignment( size: usize, @@ -149,7 +149,7 @@ impl Layout { /// /// This function is unsafe as it does not verify the preconditions from /// [`Layout::from_size_alignment`]. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[must_use] #[inline] #[track_caller] @@ -191,7 +191,7 @@ impl Layout { /// The minimum byte alignment for a memory block of this layout. /// /// The returned alignment is guaranteed to be a power of two. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[must_use = "this returns the minimum alignment, without modifying the layout"] #[inline] pub const fn alignment(&self) -> Alignment { @@ -316,7 +316,7 @@ impl Layout { /// /// Returns an error if the combination of `self.size()` and the given /// `alignment` violates the conditions listed in [`Layout::from_size_alignment`]. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[inline] pub const fn adjust_alignment_to(&self, alignment: Alignment) -> Result { Layout::from_size_alignment(self.size, Alignment::max(self.align, alignment)) @@ -335,7 +335,7 @@ impl Layout { /// to be less than or equal to the alignment of the starting /// address for the whole allocated block of memory. One way to /// satisfy this constraint is to ensure `alignment.as_usize() <= self.align()`. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[must_use = "this returns the padding needed, without modifying the `Layout`"] #[inline] pub const fn padding_needed_for(&self, alignment: Alignment) -> usize { diff --git a/library/core/src/mem/alignment.rs b/library/core/src/mem/alignment.rs index 4b0d7e96a38d1..719f0efdc3afb 100644 --- a/library/core/src/mem/alignment.rs +++ b/library/core/src/mem/alignment.rs @@ -1,6 +1,5 @@ #![allow(clippy::enum_clike_unportable_variant)] -use crate::marker::MetaSized; use crate::num::NonZero; use crate::ub_checks::assert_unsafe_precondition; use crate::{cmp, fmt, hash, mem, num}; @@ -10,7 +9,7 @@ use crate::{cmp, fmt, hash, mem, num}; /// /// Note that particularly large alignments, while representable in this type, /// are likely not to be supported by actual allocators and linkers. -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[derive(Copy)] #[derive_const(Clone, PartialEq, Eq)] #[repr(transparent)] @@ -37,19 +36,19 @@ impl Alignment { /// # Examples /// /// ``` - /// #![feature(ptr_alignment_type)] /// use std::mem::Alignment; /// /// assert_eq!(Alignment::MIN.as_usize(), 1); /// ``` - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] pub const MIN: Self = Self::new(1).unwrap(); /// Returns the alignment for a type. /// /// This provides the same numerical value as [`align_of`], /// but in an `Alignment` instead of a `usize`. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[inline] #[must_use] pub const fn of() -> Self { @@ -71,7 +70,6 @@ impl Alignment { /// # Examples /// /// ``` - /// #![feature(ptr_alignment_type)] /// use std::mem::Alignment; /// /// assert_eq!(Alignment::of_val(&5i32).as_usize(), 4); @@ -84,7 +82,6 @@ impl Alignment { /// `Alignment::of_val()` can be used to learn those alignments: /// /// ``` - /// #![feature(ptr_alignment_type)] /// use std::mem::Alignment; /// /// let a: &dyn ToString = &1234u16; @@ -97,8 +94,9 @@ impl Alignment { /// [type-layout]: ../../reference/type-layout.html#r-layout.primitive #[inline] #[must_use] - #[unstable(feature = "ptr_alignment_type", issue = "102070")] - pub const fn of_val(val: &T) -> Self { + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + pub const fn of_val(val: &T) -> Self { let align = mem::align_of_val(val); // SAFETY: `align_of_val` returns valid alignment unsafe { Alignment::new_unchecked(align) } @@ -141,7 +139,6 @@ impl Alignment { /// # Examples /// /// ``` - /// #![feature(ptr_alignment_type)] /// use std::mem::Alignment; /// /// assert_eq!(unsafe { Alignment::of_val_raw(&5i32) }.as_usize(), 4); @@ -153,8 +150,9 @@ impl Alignment { /// [type-layout]: ../../reference/type-layout.html#r-layout.primitive #[inline] #[must_use] - #[unstable(feature = "ptr_alignment_type", issue = "102070")] - pub const unsafe fn of_val_raw(val: *const T) -> Self { + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + pub const unsafe fn of_val_raw(val: *const T) -> Self { // SAFETY: precondition propagated to the caller let align = unsafe { mem::align_of_val_raw(val) }; // SAFETY: `align_of_val_raw` returns valid alignment @@ -165,7 +163,8 @@ impl Alignment { /// not a power of two. /// /// Note that `0` is not a power of two, nor a valid alignment. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[inline] pub const fn new(align: usize) -> Option { if align.is_power_of_two() { @@ -184,7 +183,8 @@ impl Alignment { /// /// Equivalently, it must be `1 << exp` for some `exp` in `0..usize::BITS`. /// It must *not* be zero. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[inline] #[track_caller] pub const unsafe fn new_unchecked(align: usize) -> Self { @@ -200,7 +200,8 @@ impl Alignment { } /// Returns the alignment as a [`usize`]. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[inline] pub const fn as_usize(self) -> usize { // Going through `as_nonzero_usize` helps this be more clearly the inverse of @@ -210,19 +211,8 @@ impl Alignment { } /// Returns the alignment as a [NonZero]<[usize]>. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] - #[deprecated( - since = "1.96.0", - note = "renamed to `as_nonzero_usize`", - suggestion = "as_nonzero_usize" - )] - #[inline] - pub const fn as_nonzero(self) -> NonZero { - self.as_nonzero_usize() - } - - /// Returns the alignment as a [NonZero]<[usize]>. - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[inline] pub const fn as_nonzero_usize(self) -> NonZero { // This transmutes directly to avoid the UbCheck in `NonZero::new_unchecked` @@ -242,12 +232,12 @@ impl Alignment { /// /// ``` /// #![feature(ptr_alignment_type)] - /// use std::ptr::Alignment; + /// use std::mem::Alignment; /// /// assert_eq!(Alignment::of::().log2(), 0); /// assert_eq!(Alignment::new(1024).unwrap().log2(), 10); /// ``` - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] #[inline] pub const fn log2(self) -> u32 { self.as_nonzero_usize().trailing_zeros() @@ -260,8 +250,7 @@ impl Alignment { /// # Examples /// /// ``` - /// #![feature(ptr_mask)] - /// #![feature(ptr_alignment_type)] + /// #![feature(ptr_alignment_type, ptr_mask)] /// use std::mem::Alignment; /// use std::ptr::NonNull; /// @@ -277,7 +266,8 @@ impl Alignment { /// assert_eq!(four.mask(Alignment::of::().mask()), four); /// assert_ne!(one.mask(Alignment::of::().mask()), one); /// ``` - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "ptr_alignment_type", issue = "165719")] + // Also #[unstable(feature = "ptr_mask", issue = "98290")] #[inline] pub const fn mask(self) -> usize { // SAFETY: The alignment is always nonzero, and therefore decrementing won't overflow. @@ -290,14 +280,14 @@ impl Alignment { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] impl fmt::Debug for Alignment { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?} (1 << {:?})", self.as_nonzero_usize(), self.log2()) } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] const impl TryFrom> for Alignment { type Error = num::TryFromIntError; @@ -308,7 +298,7 @@ const impl TryFrom> for Alignment { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] const impl TryFrom for Alignment { type Error = num::TryFromIntError; @@ -319,7 +309,7 @@ const impl TryFrom for Alignment { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] const impl From for NonZero { #[inline] @@ -328,7 +318,7 @@ const impl From for NonZero { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_convert", issue = "143773")] const impl From for usize { #[inline] @@ -337,7 +327,7 @@ const impl From for usize { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] const impl cmp::Ord for Alignment { #[inline] @@ -346,7 +336,7 @@ const impl cmp::Ord for Alignment { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] const impl cmp::PartialOrd for Alignment { #[inline] @@ -355,7 +345,7 @@ const impl cmp::PartialOrd for Alignment { } } -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] impl hash::Hash for Alignment { #[inline] fn hash(&self, state: &mut H) { @@ -364,7 +354,7 @@ impl hash::Hash for Alignment { } /// Returns [`Alignment::MIN`], which is valid for any type. -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] const impl Default for Alignment { fn default() -> Alignment { diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 561ab4b7b7cd8..86f81deb6ea33 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -39,7 +39,7 @@ use crate::ub_checks::assert_unsafe_precondition; use crate::{clone, cmp, fmt, hash, intrinsics, ptr}; mod alignment; -#[unstable(feature = "ptr_alignment_type", issue = "102070")] +#[stable(feature = "alignment_type", since = "CURRENT_RUSTC_VERSION")] pub use alignment::Alignment; mod manually_drop; @@ -1605,7 +1605,7 @@ pub trait SizedTypeProperties: Sized { const ALIGN: usize = intrinsics::align_of::(); #[doc(hidden)] - #[unstable(feature = "ptr_alignment_type", issue = "102070")] + #[unstable(feature = "sized_type_properties", issue = "none")] const ALIGNMENT: Alignment = { // This can't panic since type alignment is always a power of two. Alignment::new(Self::ALIGN).unwrap() diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs index 5bc987f8069f5..9844f262429dc 100644 --- a/library/core/src/num/error.rs +++ b/library/core/src/num/error.rs @@ -119,7 +119,6 @@ pub enum IntErrorKind { /// /// [`Alignment`]: core::mem::Alignment "mem::Alignment" #[unstable(feature = "try_from_int_error_kind", issue = "153978")] - // Also, #[unstable(feature = "ptr_alignment_type", issue = "102070")] NotAPowerOfTwo, } diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index bb7a52f3c50d8..99aa9cf5ab741 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -434,11 +434,6 @@ use crate::num::NonZero; use crate::ops::FnPtr; use crate::{fmt, hash, intrinsics, ub_checks}; -#[unstable(feature = "ptr_alignment_type", issue = "102070")] -#[deprecated(since = "1.96.0", note = "moved from `ptr` to `mem`")] -/// Deprecated re-export of [mem::Alignment]. -pub type Alignment = mem::Alignment; - mod metadata; #[unstable(feature = "ptr_metadata", issue = "81513")] pub use metadata::{DynMetadata, Pointee, Thin, from_raw_parts, from_raw_parts_mut, metadata}; diff --git a/src/tools/miri/tests/fail/alloc/too_large.rs b/src/tools/miri/tests/fail/alloc/too_large.rs index 899fc30d9a576..b3ab24eb6889c 100644 --- a/src/tools/miri/tests/fail/alloc/too_large.rs +++ b/src/tools/miri/tests/fail/alloc/too_large.rs @@ -1,5 +1,4 @@ #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] extern "Rust" { #[rustc_std_internal_symbol] @@ -9,6 +8,6 @@ extern "Rust" { fn main() { let bytes = isize::MAX as usize + 1; unsafe { - __rust_alloc(bytes, 1usize.try_into().unwrap()); //~ERROR: larger than half the address space + __rust_alloc(bytes, core::mem::Alignment::MIN); //~ERROR: larger than half the address space } } diff --git a/src/tools/miri/tests/fail/alloc/too_large.stderr b/src/tools/miri/tests/fail/alloc/too_large.stderr index 86c8aac242ac6..2af43f2a06883 100644 --- a/src/tools/miri/tests/fail/alloc/too_large.stderr +++ b/src/tools/miri/tests/fail/alloc/too_large.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: creating an allocation larger than half the address space --> tests/fail/alloc/too_large.rs:LL:CC | -LL | __rust_alloc(bytes, 1usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | __rust_alloc(bytes, core::mem::Alignment::MIN); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/fail/alloc/unsupported_big_alignment.rs b/src/tools/miri/tests/fail/alloc/unsupported_big_alignment.rs index a60156982caa4..dd2941bde4b3e 100644 --- a/src/tools/miri/tests/fail/alloc/unsupported_big_alignment.rs +++ b/src/tools/miri/tests/fail/alloc/unsupported_big_alignment.rs @@ -3,7 +3,6 @@ // https://github.com/rust-lang/miri/issues/3687 #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] extern "Rust" { #[rustc_std_internal_symbol] diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs index 0b16d0616ba95..d924348e15905 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-deterministic-concurrency -Zmiri-disable-stacked-borrows #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] use std::thread::spawn; @@ -34,7 +33,7 @@ fn main() { //~^ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::(), - std::mem::align_of::().try_into().unwrap(), + std::mem::Alignment::of::(), ); }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr index a9353baa1beaa..41cba16a486e2 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr @@ -5,7 +5,7 @@ LL | / ... __rust_dealloc( LL | | ... LL | | ... ptr.0 as *mut _, LL | | ... std::mem::size_of::(), -LL | | ... std::mem::align_of::().try_into().unwrap(), +LL | | ... std::mem::Alignment::of::(), LL | | ... ); | |_______^ (2) just happened here | diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs index 566c729c912bc..c6a5522284efc 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-deterministic-concurrency -Zmiri-disable-stacked-borrows #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] use std::thread::spawn; @@ -28,7 +27,7 @@ fn main() { __rust_dealloc( ptr.0 as *mut _, std::mem::size_of::(), - std::mem::align_of::().try_into().unwrap(), + std::mem::Alignment::of::(), ) }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr index 2452a5587da6a..6525d7ee104ad 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr @@ -17,7 +17,7 @@ help: ALLOC was deallocated here: LL | / __rust_dealloc( LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), -LL | | std::mem::align_of::().try_into().unwrap(), +LL | | std::mem::Alignment::of::(), LL | | ) | |_____________^ = note: this is on thread `unnamed-ID` diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs index 7fa769e88583f..44b557fee3f58 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-deterministic-concurrency -Zmiri-disable-stacked-borrows #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] use std::thread::spawn; @@ -33,7 +32,7 @@ fn main() { //~^ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::(), - std::mem::align_of::().try_into().unwrap(), + std::mem::Alignment::of::(), ); }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr index 3dbc3f3851391..ff10c48cd8c77 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr @@ -5,7 +5,7 @@ LL | / ... __rust_dealloc( LL | | ... LL | | ... ptr.0 as *mut _, LL | | ... std::mem::size_of::(), -LL | | ... std::mem::align_of::().try_into().unwrap(), +LL | | ... std::mem::Alignment::of::(), LL | | ... ); | |_______^ (2) just happened here | diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs index da452b00244bf..e23d15a794d54 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs @@ -2,7 +2,6 @@ //@compile-flags: -Zmiri-deterministic-concurrency -Zmiri-disable-stacked-borrows #![feature(rustc_attrs)] -#![feature(ptr_alignment_type)] use std::thread::spawn; @@ -27,7 +26,7 @@ fn main() { __rust_dealloc( ptr.0 as *mut _, std::mem::size_of::(), - std::mem::align_of::().try_into().unwrap(), + std::mem::Alignment::of::(), ); }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr index dc0f8a30a0f6b..800dd3ffa7e2f 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr @@ -17,7 +17,7 @@ help: ALLOC was deallocated here: LL | / __rust_dealloc( LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), -LL | | std::mem::align_of::().try_into().unwrap(), +LL | | std::mem::Alignment::of::(), LL | | ); | |_____________^ = note: this is on thread `unnamed-ID` diff --git a/tests/ui/precondition-checks/alignment.rs b/tests/ui/precondition-checks/alignment.rs index 3f0eae47a157a..3903b7b7b040b 100644 --- a/tests/ui/precondition-checks/alignment.rs +++ b/tests/ui/precondition-checks/alignment.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes //@ error-pattern: unsafe precondition(s) violated: Alignment::new_unchecked requires -#![feature(ptr_alignment_type)] - fn main() { unsafe { std::mem::Alignment::new_unchecked(0); diff --git a/tests/ui/traits/const-traits/const-traits-core.rs b/tests/ui/traits/const-traits/const-traits-core.rs index ed244c230006a..d4fcc1c10a792 100644 --- a/tests/ui/traits/const-traits/const-traits-core.rs +++ b/tests/ui/traits/const-traits/const-traits-core.rs @@ -3,7 +3,6 @@ const_clone, const_default, const_trait_impl, - ptr_alignment_type, ascii_char, f16, f128, From 117c51759e5761e750a3780f79cec572eda312ea Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Tue, 10 Nov 2026 11:35:44 +0900 Subject: [PATCH 30/38] docs(num): remove needless whitespaces --- library/core/src/num/int_macros.rs | 2 +- library/core/src/num/uint_macros.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index fb86481c42443..80bc32b2f6858 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -507,7 +507,7 @@ macro_rules! int_impl { } /// Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, - /// second least-significant bit becomes second most-significant bit, etc. + /// second least-significant bit becomes second most-significant bit, etc. /// /// # Examples /// diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index e202621673604..3ee925bd2e905 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -881,7 +881,7 @@ macro_rules! uint_impl { } /// Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, - /// second least-significant bit becomes second most-significant bit, etc. + /// second least-significant bit becomes second most-significant bit, etc. /// /// # Examples /// From 2fa016a961681fa7d59e15f516b371fdb211b401 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:24:38 +0100 Subject: [PATCH 31/38] Remove parsed arm of `check_attr` --- .../rustc_attr_parsing/src/validate_attr.rs | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/validate_attr.rs b/compiler/rustc_attr_parsing/src/validate_attr.rs index 74cc6690d54cf..1b0cb8657015f 100644 --- a/compiler/rustc_attr_parsing/src/validate_attr.rs +++ b/compiler/rustc_attr_parsing/src/validate_attr.rs @@ -30,41 +30,20 @@ pub fn check_attr(psess: &ParseSess, attr: &Attribute) { | AttrKind::Generated(..) => return, } - let builtin_attr_info = attr.name().and_then(|name| BUILTIN_ATTRIBUTE_SET.get(&name)); + // Parsed attributes are validated during attribute parsing + if AttributeParser::is_parsed_attribute(&attr.path()) { + return; + } - // Check input tokens for built-in and key-value attributes. - if let Some(name) = builtin_attr_info { - if AttributeParser::is_parsed_attribute(slice::from_ref(name)) { - return; - } + let attr_item = attr.get_normal_item(); + if let AttrArgs::Eq { .. } = attr_item.args { + // All key-value attributes are restricted to meta-item syntax. match parse_meta(psess, attr) { - // Don't check safety again, we just did that - Ok(meta) => { - // FIXME The only unparsed builtin attributes that are left are the lint attributes, so we can hardcode the template here - let lint_attrs = [sym::forbid, sym::allow, sym::warn, sym::deny, sym::expect]; - assert!(lint_attrs.contains(name)); - - let template = template!( - List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#], - "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes" - ); - check_builtin_meta_item(psess, &meta, attr.style, *name, template, false) - } + Ok(_) => {} Err(err) => { err.emit(); } } - } else { - let attr_item = attr.get_normal_item(); - if let AttrArgs::Eq { .. } = attr_item.args { - // All key-value attributes are restricted to meta-item syntax. - match parse_meta(psess, attr) { - Ok(_) => {} - Err(err) => { - err.emit(); - } - } - } } } From 6fd528c98200347a54cc5a73b13909531ee75440 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:58:11 +0100 Subject: [PATCH 32/38] Move `check_attr` to attribute parsing --- .../rustc_ast_passes/src/ast_validation.rs | 5 ---- compiler/rustc_attr_parsing/src/interface.rs | 16 +++++++++- .../rustc_attr_parsing/src/validate_attr.rs | 30 +------------------ compiler/rustc_expand/src/expand.rs | 1 - tests/ui/attributes/issue-90873.stderr | 24 +++++++-------- .../key-value-nested-attr-fail.stderr | 24 +++++++-------- .../ui/attributes/unused-item-in-attr.stderr | 12 ++++---- tests/ui/consts/issue-90878-2.stderr | 12 ++++---- 8 files changed, 52 insertions(+), 72 deletions(-) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index a6e88f21ba74f..88816587ae3b4 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -25,7 +25,6 @@ use rustc_abi::{CVariadicStatus, CanonAbi, ExternAbi, InterruptKind}; use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, walk_list}; use rustc_ast::*; use rustc_ast_pretty::pprust::{self, State}; -use rustc_attr_parsing::validate_attr; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::{DiagCtxtHandle, Diagnostic, LintBuffer}; use rustc_feature::Features; @@ -1402,10 +1401,6 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara } impl Visitor<'_> for AstValidator<'_> { - fn visit_attribute(&mut self, attr: &Attribute) { - validate_attr::check_attr(&self.sess.psess, attr); - } - fn visit_ty(&mut self, ty: &Ty) { self.visit_ty_common(ty); self.walk_ty(ty) diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs index a4cf7b9342dd5..9bd489a5aea8f 100644 --- a/compiler/rustc_attr_parsing/src/interface.rs +++ b/compiler/rustc_attr_parsing/src/interface.rs @@ -23,6 +23,7 @@ use crate::diagnostics::ParsedDescription; use crate::generated::GeneratedAttrState; use crate::parser::{AllowExprMetavar, ArgParser, PathParser, RefPathParser}; use crate::synthetic::SyntheticAttrState; +use crate::validate_attr::parse_meta; use crate::{AttributeTemplate, ShouldEmit, diagnostics}; pub struct EmitAttribute( @@ -359,7 +360,8 @@ impl<'sess> AttributeParser<'sess> { n.item.path.segments.iter().map(|seg| seg.ident.name).collect::>(); let inner_span = lower_span(n.item.span); - if let Some(accept) = ATTRIBUTE_PARSERS.accepters.get(parts.as_slice()) { + let accepter = ATTRIBUTE_PARSERS.accepters.get(parts.as_slice()); + if let Some(accept) = accepter { self.check_attribute_safety( &attr_path, inner_span, @@ -492,6 +494,18 @@ impl<'sess> AttributeParser<'sess> { attributes.push(attr); }; + + if accepter.is_none() + && let rustc_ast::AttrArgs::Eq { .. } = n.item.args + { + // All key-value attributes are restricted to meta-item syntax. + match parse_meta(&self.sess.psess, &attr) { + Ok(_) => {} + Err(err) => { + err.emit(); + } + } + } } } } diff --git a/compiler/rustc_attr_parsing/src/validate_attr.rs b/compiler/rustc_attr_parsing/src/validate_attr.rs index 1b0cb8657015f..9dd67bb0dd24c 100644 --- a/compiler/rustc_attr_parsing/src/validate_attr.rs +++ b/compiler/rustc_attr_parsing/src/validate_attr.rs @@ -1,7 +1,6 @@ //! Meta-syntax validation logic of attributes for post-expansion. use std::convert::identity; -use std::slice; use rustc_ast::SyntheticAttr::CfgAttrTrace; use rustc_ast::token::Delimiter; @@ -12,40 +11,13 @@ use rustc_ast::{ }; use rustc_attr_ir::AttrPath; use rustc_errors::{Applicability, Diagnostic, PResult}; -use rustc_feature::BUILTIN_ATTRIBUTE_SET; use rustc_lint_defs::builtin::ILL_FORMED_ATTRIBUTE_INPUT; use rustc_parse::parse_in; use rustc_session::diagnostics::report_lit_error; use rustc_session::parse::ParseSess; use rustc_span::{Span, Symbol, sym}; -use crate::{AttributeParser, AttributeTemplate, diagnostics as errors, template}; - -pub fn check_attr(psess: &ParseSess, attr: &Attribute) { - use ast::SyntheticAttr::*; - match &attr.kind { - AttrKind::Normal(_) => {} - AttrKind::Synthetic(CfgTrace(_) | CfgAttrTrace(_)) - | AttrKind::DocComment(..) - | AttrKind::Generated(..) => return, - } - - // Parsed attributes are validated during attribute parsing - if AttributeParser::is_parsed_attribute(&attr.path()) { - return; - } - - let attr_item = attr.get_normal_item(); - if let AttrArgs::Eq { .. } = attr_item.args { - // All key-value attributes are restricted to meta-item syntax. - match parse_meta(psess, attr) { - Ok(_) => {} - Err(err) => { - err.emit(); - } - } - } -} +use crate::{AttributeTemplate, diagnostics as errors}; pub fn parse_meta<'a>(psess: &'a ParseSess, attr: &Attribute) -> PResult<'a, MetaItem> { let item = attr.get_normal_item(); diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index b9c1bb9545d2f..af1e4be5e8399 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -2235,7 +2235,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { let mut attrs = attrs.iter().peekable(); let mut span: Option = None; while let Some(attr) = attrs.next() { - validate_attr::check_attr(&self.cx.sess.psess, attr); AttributeParser::parse_limited_all( self.cx.sess, slice::from_ref(attr), diff --git a/tests/ui/attributes/issue-90873.stderr b/tests/ui/attributes/issue-90873.stderr index 444497538e8dc..afe36156f0e3a 100644 --- a/tests/ui/attributes/issue-90873.stderr +++ b/tests/ui/attributes/issue-90873.stderr @@ -1,15 +1,3 @@ -error: attribute value must be a literal - --> $DIR/issue-90873.rs:1:6 - | -LL | #![u=||{static d=||1;}] - | ^^^^^^^^^^^^^^^^^ - -error: attribute value must be a literal - --> $DIR/issue-90873.rs:6:6 - | -LL | #![a={impl std::ops::Neg for i8 {}}] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: cannot find attribute `u` in this scope --> $DIR/issue-90873.rs:1:4 | @@ -22,6 +10,18 @@ error: cannot find attribute `a` in this scope LL | #![a={impl std::ops::Neg for i8 {}}] | ^ +error: attribute value must be a literal + --> $DIR/issue-90873.rs:1:6 + | +LL | #![u=||{static d=||1;}] + | ^^^^^^^^^^^^^^^^^ + +error: attribute value must be a literal + --> $DIR/issue-90873.rs:6:6 + | +LL | #![a={impl std::ops::Neg for i8 {}}] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0601]: `main` function not found in crate `issue_90873` --> $DIR/issue-90873.rs:6:37 | diff --git a/tests/ui/attributes/key-value-nested-attr-fail.stderr b/tests/ui/attributes/key-value-nested-attr-fail.stderr index d01fd85b70489..468e95a113ef5 100644 --- a/tests/ui/attributes/key-value-nested-attr-fail.stderr +++ b/tests/ui/attributes/key-value-nested-attr-fail.stderr @@ -16,18 +16,6 @@ error: `cfg` is not supported in this position LL | #[clippy::insubstantial = #[cfg(true)] "insignificant"] | ^^^^^^^^^^^^ -error: this attribute is not allowed in this context - --> $DIR/key-value-nested-attr-fail.rs:51:24 - | -LL | #[clippy::immaterial = #[allow(dead_code)] "incorporeal"] - | ^^^^^^^^^^^^^^^^^^^ - -error: this attribute is not allowed in this context - --> $DIR/key-value-nested-attr-fail.rs:59:9 - | -LL | #[arg = #[allow(dead_code)] 0] - | ^^^^^^^^^^^^^^^^^^^ - error: this attribute is not allowed in this context --> $DIR/key-value-nested-attr-fail.rs:17:10 | @@ -61,6 +49,18 @@ error: this attribute is not allowed in this context LL | repr(Rust) | ^^^^^^^^^^ +error: this attribute is not allowed in this context + --> $DIR/key-value-nested-attr-fail.rs:51:24 + | +LL | #[clippy::immaterial = #[allow(dead_code)] "incorporeal"] + | ^^^^^^^^^^^^^^^^^^^ + +error: this attribute is not allowed in this context + --> $DIR/key-value-nested-attr-fail.rs:59:9 + | +LL | #[arg = #[allow(dead_code)] 0] + | ^^^^^^^^^^^^^^^^^^^ + error: attribute value must be a literal --> $DIR/key-value-nested-attr-fail.rs:65:25 | diff --git a/tests/ui/attributes/unused-item-in-attr.stderr b/tests/ui/attributes/unused-item-in-attr.stderr index 84130965d31cf..1d4437647d3cc 100644 --- a/tests/ui/attributes/unused-item-in-attr.stderr +++ b/tests/ui/attributes/unused-item-in-attr.stderr @@ -1,14 +1,14 @@ -error: attribute value must be a literal - --> $DIR/unused-item-in-attr.rs:1:7 - | -LL | #[w = { extern crate alloc; }] - | ^^^^^^^^^^^^^^^^^^^^^^^ - error: cannot find attribute `w` in this scope --> $DIR/unused-item-in-attr.rs:1:3 | LL | #[w = { extern crate alloc; }] | ^ +error: attribute value must be a literal + --> $DIR/unused-item-in-attr.rs:1:7 + | +LL | #[w = { extern crate alloc; }] + | ^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 2 previous errors diff --git a/tests/ui/consts/issue-90878-2.stderr b/tests/ui/consts/issue-90878-2.stderr index 0b332840042ef..f5991ef9bcf7b 100644 --- a/tests/ui/consts/issue-90878-2.stderr +++ b/tests/ui/consts/issue-90878-2.stderr @@ -1,14 +1,14 @@ -error: attribute value must be a literal - --> $DIR/issue-90878-2.rs:1:7 - | -LL | #![l=|x|[b;x ]] - | ^^^^^^^^^ - error: cannot find attribute `l` in this scope --> $DIR/issue-90878-2.rs:1:5 | LL | #![l=|x|[b;x ]] | ^ +error: attribute value must be a literal + --> $DIR/issue-90878-2.rs:1:7 + | +LL | #![l=|x|[b;x ]] + | ^^^^^^^^^ + error: aborting due to 2 previous errors From 0a179cceeaa018512a43b369e91ffce586e62c83 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Mon, 9 Nov 2026 12:58:27 +0100 Subject: [PATCH 33/38] Add test checking that the behaviour for diagnostic attrs is preserved --- tests/ui/diagnostic_namespace/invalid_lit.rs | 8 +++++++ .../diagnostic_namespace/invalid_lit.stderr | 22 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/ui/diagnostic_namespace/invalid_lit.rs create mode 100644 tests/ui/diagnostic_namespace/invalid_lit.stderr diff --git a/tests/ui/diagnostic_namespace/invalid_lit.rs b/tests/ui/diagnostic_namespace/invalid_lit.rs new file mode 100644 index 0000000000000..2198258fa498a --- /dev/null +++ b/tests/ui/diagnostic_namespace/invalid_lit.rs @@ -0,0 +1,8 @@ +#[diagnostic::on_unimplemented = 1 + 1] +//~^ ERROR attribute value must be a literal +#[diagnostic::not_exist = 1 + 1] +//~^ ERROR attribute value must be a literal +//~| WARN unknown diagnostic attribute +fn main() { + +} diff --git a/tests/ui/diagnostic_namespace/invalid_lit.stderr b/tests/ui/diagnostic_namespace/invalid_lit.stderr new file mode 100644 index 0000000000000..5659d4f56b02f --- /dev/null +++ b/tests/ui/diagnostic_namespace/invalid_lit.stderr @@ -0,0 +1,22 @@ +error: attribute value must be a literal + --> $DIR/invalid_lit.rs:1:34 + | +LL | #[diagnostic::on_unimplemented = 1 + 1] + | ^^^^^ + +error: attribute value must be a literal + --> $DIR/invalid_lit.rs:3:27 + | +LL | #[diagnostic::not_exist = 1 + 1] + | ^^^^^ + +warning: unknown diagnostic attribute + --> $DIR/invalid_lit.rs:3:15 + | +LL | #[diagnostic::not_exist = 1 + 1] + | ^^^^^^^^^ + | + = note: `#[warn(unknown_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default + +error: aborting due to 2 previous errors; 1 warning emitted + From eaf2a71851f539f9cea949006cbd72b62308d949 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 19 Oct 2026 09:33:01 +0200 Subject: [PATCH 34/38] fs::Dir tests: ensure remove and rename do not follow symlinks --- library/std/src/fs/tests.rs | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 605ad25270a63..15b81210928d4 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -3250,6 +3250,14 @@ fn test_dir_remove_file() { check!(f.flush()); drop(f); let dir = check!(Dir::open(tmpdir.path())); + + if got_symlink_permission(&tmpdir) { + // Removing a symlink should remove the link, not the destination. + check!(symlink_file("foo.txt", &tmpdir.join("link"))); + check!(dir.remove_file("link")); + assert!(check!(dir.metadata("foo.txt")).is_file()); // file still exists + } + check!(dir.remove_file("foo.txt")); assert!(!matches!(exists(tmpdir.join("foo.txt")), Ok(true))); } @@ -3266,6 +3274,14 @@ fn test_dir_rename_file() { let mut buf = [0u8; 3]; check!(f.read_exact(&mut buf)); assert_eq!(b"bar", &buf); + + // Renaming a symlink should rename the link, not the destination. + if got_symlink_permission(&tmpdir) { + check!(symlink_file("baz.txt", &tmpdir.join("link"))); + check!(dir.rename("link", &dir, "link-renamed")); + assert!(check!(dir.symlink_metadata("baz.txt")).is_file()); // file still exists + assert!(check!(dir.symlink_metadata("link-renamed")).is_symlink()); // symlink has new name + } } // FIXME: re-enable once QNX fixes TOCTOU bug for fs::remove_dir @@ -3277,6 +3293,21 @@ fn test_dir_remove_dir() { let tmpdir = tmpdir(); check!(fs::create_dir(tmpdir.join("foo"))); let dir = check!(Dir::open(tmpdir.path())); + + if got_symlink_permission(&tmpdir) { + // Removing a symlink should remove the link, not the destination. + check!(symlink_dir("foo", &tmpdir.join("link"))); + if cfg!(windows) { + // directory symlinks need `remove_dir` on Windows + dir.remove_file("link").unwrap_err(); + check!(dir.remove_dir("link")); + } else { + dir.remove_dir("link").unwrap_err(); + check!(dir.remove_file("link")); + } + assert!(check!(dir.metadata("foo")).is_dir()); // dir still exists + } + check!(dir.remove_dir("foo")); assert!(!matches!(exists(tmpdir.join("foo")), Ok(true))); } @@ -3289,6 +3320,14 @@ fn test_dir_rename_dir() { check!(dir.rename("foo", &dir, "baz")); let m = check!(tmpdir.join("baz").metadata()); assert!(m.is_dir()); + + // Renaming a symlink should rename the link, not the destination. + if got_symlink_permission(&tmpdir) { + check!(symlink_dir("baz", &tmpdir.join("link"))); + check!(dir.rename("link", &dir, "link-renamed")); + assert!(check!(dir.symlink_metadata("baz")).is_dir()); // dir still exists + assert!(check!(dir.symlink_metadata("link-renamed")).is_symlink()); // symlink has new name + } } #[test] From 811ebf70afd33068a39de321b79d2854e8c80a26 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 19 Oct 2026 09:35:35 +0200 Subject: [PATCH 35/38] windows: fix Dir::{remove_*,rename} symlink behavior --- library/std/src/sys/fs/windows/dir.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys/fs/windows/dir.rs b/library/std/src/sys/fs/windows/dir.rs index 60f8c2522de26..4a6ea4f20f19d 100644 --- a/library/std/src/sys/fs/windows/dir.rs +++ b/library/std/src/sys/fs/windows/dir.rs @@ -157,7 +157,8 @@ impl Dir { fn remove_native(&self, path: &[u16], dir: bool) -> io::Result<()> { let mut opts = OpenOptions::new(); opts.access_mode(c::DELETE); - let create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE }; + let mut create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE }; + create_opt |= c::FILE_OPEN_REPARSE_POINT; let handle = self.open_file_native(path, &opts, create_opt)?; File::from_inner(handle).delete().io_result() } @@ -165,9 +166,8 @@ impl Dir { fn rename_native(&self, from: &[u16], to_dir: &Self, to: &[u16]) -> io::Result<()> { let mut opts = OpenOptions::new(); opts.access_mode(c::DELETE); - // FIXME: custom_flags is ignored by `open_file_native`! - opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS); - let handle = self.open_file_native(from, &opts, /* create_opt */ 0)?; + let handle = + self.open_file_native(from, &opts, /* create_opt */ c::FILE_OPEN_REPARSE_POINT)?; // Calculate the layout of the `FILE_RENAME_INFORMATION` we pass to `NtSetInformationFile` // This is a dynamically sized struct so we need to get the position of the last field to calculate the actual size. const too_long_err: io::Error = From 9adef1bbbe4dbecf597b1d42ad69d64a6eea87db Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 10 Nov 2026 08:50:27 +0100 Subject: [PATCH 36/38] remove NOP File::flush from fs tests --- library/std/src/fs/tests.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 01977792b5751..d19f71c657e2c 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -2753,7 +2753,6 @@ fn test_hidden_file_truncation() { .open(&path) .unwrap(); file.write("hidden world!".as_bytes()).unwrap(); - file.flush().unwrap(); drop(file); // Create a new file by truncating the existing one. @@ -3298,7 +3297,6 @@ fn test_dir_write_file() { let dir = check!(Dir::open(tmpdir.path())); let mut f = check!(dir.open_file_with("foo.txt", &OpenOptions::new().write(true).create(true))); check!(f.write(b"bar")); - check!(f.flush()); drop(f); let mut f = check!(File::open(tmpdir.join("foo.txt"))); let mut buf = [0u8; 3]; @@ -3311,7 +3309,6 @@ fn test_dir_remove_file() { let tmpdir = tmpdir(); let mut f = check!(File::create(tmpdir.join("foo.txt"))); check!(f.write(b"bar")); - check!(f.flush()); drop(f); let dir = check!(Dir::open(tmpdir.path())); check!(dir.remove_file("foo.txt")); @@ -3368,7 +3365,6 @@ fn test_dir_open_dir() { let mut f = check!(dir2.open_file_with("bar.txt", &OpenOptions::new().create(true).write(true))); check!(f.write(b"baz")); - check!(f.flush()); drop(f); let dir3 = check!(dir1.open_dir("foo")); let mut f = check!(dir3.open_file("bar.txt")); From 70426a61042f7a0edaa8059c55b5d2249237b9b7 Mon Sep 17 00:00:00 2001 From: Toni Peter Date: Sat, 3 Oct 2026 13:26:59 +0200 Subject: [PATCH 37/38] Trace `#[rustc_trivial_field_reads]` sites through dead code analysis Allow `rustc_trivial_field_reads` on inherent methods Add test for multiple usage sites --- compiler/rustc_attr_ir/src/data_structures.rs | 2 +- .../rustc_attr_ir/src/encode_cross_crate.rs | 4 +- .../src/attributes/rustc_internal.rs | 9 +- compiler/rustc_attr_parsing/src/generated.rs | 2 +- compiler/rustc_middle/src/middle/dead_code.rs | 29 +- compiler/rustc_middle/src/queries.rs | 2 +- compiler/rustc_passes/src/check_attr.rs | 2 +- compiler/rustc_passes/src/dead.rs | 340 ++++++++++++------ compiler/rustc_passes/src/diagnostics.rs | 25 +- library/core/src/clone.rs | 2 +- library/core/src/fmt/mod.rs | 2 +- ...-debug-dead-code-in-the-same-struct.stderr | 6 +- tests/ui/derives/clone-debug-dead-code.stderr | 23 +- .../derive-debug-uninhabited-enum.stderr | 1 - .../auxiliary/macro_def.rs | 9 + .../deduplicate-usage-sites.rs | 30 ++ .../deduplicate-usage-sites.stderr | 21 ++ .../trivial-field-reads/from-macro.rs | 29 ++ .../trivial-field-reads/from-macro.stderr | 36 ++ .../trivial-field-reads/grouped-diagnostic.rs | 31 ++ .../grouped-diagnostic.stderr | 33 ++ .../trivial-field-reads/inherent-method.rs | 16 + .../inherent-method.stderr | 22 ++ .../trivial-field-reads/manual-trait-impl.rs | 20 ++ .../manual-trait-impl.stderr | 22 ++ .../mixed-allow-trivial.rs | 27 ++ .../trivial-field-reads/multiple-usages.rs | 35 ++ .../dead-code/trivial-field-reads/on-main.rs | 10 + .../trivial-field-reads/on-main.stderr | 19 + .../trivial-field-reads/two-usage-sites.rs | 34 ++ .../two-usage-sites.stderr | 43 +++ .../use-innermost-usage-site.rs | 31 ++ .../use-innermost-usage-site.stderr | 21 ++ tests/ui/lint/dead-code/unused-variant.stderr | 10 +- 34 files changed, 798 insertions(+), 150 deletions(-) create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/auxiliary/macro_def.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/from-macro.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/from-macro.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/inherent-method.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/inherent-method.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/mixed-allow-trivial.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/multiple-usages.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/on-main.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/on-main.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.stderr create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.rs create mode 100644 tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.stderr diff --git a/compiler/rustc_attr_ir/src/data_structures.rs b/compiler/rustc_attr_ir/src/data_structures.rs index 7379c874e4b02..e32a31ea7e458 100644 --- a/compiler/rustc_attr_ir/src/data_structures.rs +++ b/compiler/rustc_attr_ir/src/data_structures.rs @@ -1497,7 +1497,7 @@ pub enum AttributeKind { RustcThenThisWouldNeed(ThinVec), /// Represents `#[rustc_trivial_field_reads]` - RustcTrivialFieldReads, + RustcTrivialFieldReads(Span), /// Represents `#[sanitize]` /// diff --git a/compiler/rustc_attr_ir/src/encode_cross_crate.rs b/compiler/rustc_attr_ir/src/encode_cross_crate.rs index ac02373f7d58a..cabef51f754d1 100644 --- a/compiler/rustc_attr_ir/src/encode_cross_crate.rs +++ b/compiler/rustc_attr_ir/src/encode_cross_crate.rs @@ -198,7 +198,7 @@ impl AttributeKind { RustcStrictCoherence(..) => Yes, RustcTestMarker(..) => No, RustcThenThisWouldNeed(..) => No, - RustcTrivialFieldReads => Yes, + RustcTrivialFieldReads(..) => No, Sanitize { .. } => No, ShouldPanic { .. } => No, Splat(..) => Yes, @@ -417,7 +417,7 @@ impl AttributeKind { RustcStrictCoherence(..) => false, RustcTestMarker(..) => false, RustcThenThisWouldNeed(..) => false, - RustcTrivialFieldReads => false, + RustcTrivialFieldReads(..) => false, Sanitize { .. } => false, ShouldPanic { .. } => false, Splat(..) => false, diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs index 708d9aa7156e8..0c056240a81d4 100644 --- a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs @@ -420,10 +420,13 @@ pub(crate) struct RustcTrivialFieldReadsParser; impl NoArgsAttributeParser for RustcTrivialFieldReadsParser { const PATH: &[Symbol] = &[sym::rustc_trivial_field_reads]; - const ALLOWED_TARGETS: AllowedTargets<'_> = - AllowedTargets::AllowList(&[Allow(Target::Method(MethodKind::TraitImpl))]); + const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[ + Allow(Target::Method(MethodKind::TraitImpl)), + Allow(Target::Method(MethodKind::Inherent)), + Allow(Target::Fn), + ]); const STABILITY: AttributeStability = unstable!(rustc_attrs); - const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcTrivialFieldReads; + const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcTrivialFieldReads; } pub(crate) struct RustcNoMirInlineParser; diff --git a/compiler/rustc_attr_parsing/src/generated.rs b/compiler/rustc_attr_parsing/src/generated.rs index 599291fab7ac5..8e8fe81878fc0 100644 --- a/compiler/rustc_attr_parsing/src/generated.rs +++ b/compiler/rustc_attr_parsing/src/generated.rs @@ -42,7 +42,7 @@ impl GeneratedAttrState { GeneratedAttr::RustcTestMarker(test_marker) => { AttributeKind::RustcTestMarker(test_marker) } - GeneratedAttr::RustcTrivialFieldReads => AttributeKind::RustcTrivialFieldReads, + GeneratedAttr::RustcTrivialFieldReads => AttributeKind::RustcTrivialFieldReads(span), }; self.state.push(attr); } diff --git a/compiler/rustc_middle/src/middle/dead_code.rs b/compiler/rustc_middle/src/middle/dead_code.rs index 06275e1e0f3a0..a9d5bfe831851 100644 --- a/compiler/rustc_middle/src/middle/dead_code.rs +++ b/compiler/rustc_middle/src/middle/dead_code.rs @@ -1,14 +1,31 @@ -use rustc_data_structures::fx::FxIndexSet; -use rustc_hir::def_id::{DefId, LocalDefIdMap, LocalDefIdSet}; +use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, LocalDefIdSet}; use rustc_macros::StableHash; +use rustc_span::Span; /// A single snapshot of dead-code liveness analysis state. #[derive(Clone, Debug, StableHash)] pub struct DeadCodeLivenessSnapshot { - pub live_symbols: LocalDefIdSet, - /// Maps each ADT to derived traits (for example `Debug` and `Clone`) that should be ignored - /// when checking for dead code diagnostics. - pub ignored_derived_traits: LocalDefIdMap>, + pub live: LocalDefIdSet, + /// This maps defs that were only used from items annotated with + /// `#[rustc_trivial_field_reads]` to those items + pub sites_by_defid: LocalDefIdMap>, + /// For each of the items annotated with `#[rustc_trivial_field_reads]`, + /// we store the attr span here, so we can use it for diagnostics if needed + pub sites: LocalDefIdMap, +} + +impl DeadCodeLivenessSnapshot { + pub fn is_live(&self, id: &LocalDefId) -> bool { + self.live.contains(id) + } + + pub fn trivial_usage_sites(&self, def_id: &LocalDefId) -> impl Iterator { + self.sites_by_defid.get(def_id).into_iter().flatten().copied() + } + + pub fn trivial_usage_site_span_by_id(&self, site_id: LocalDefId) -> Span { + *self.sites.get(&site_id).unwrap() + } } /// Dead-code liveness data for both analysis phases. diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 7442daa296f03..26e2b7ebf4428 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -1229,7 +1229,7 @@ rustc_queries! { } /// Return dead-code liveness summary for the crate. - query live_symbols_and_ignored_derived_traits(_: ()) -> Result<&'tcx DeadCodeLivenessSummary, ErrorGuaranteed> { + query live_symbols_and_trivial_usage_sites(_: ()) -> Result<&'tcx DeadCodeLivenessSummary, ErrorGuaranteed> { arena_cache desc { "finding live symbols in crate" } } diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 41bc7b0a1539f..a2a9dde01dc71 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -387,7 +387,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { AttributeKind::RustcStrictCoherence(..) => (), AttributeKind::RustcTestMarker(..) => (), AttributeKind::RustcThenThisWouldNeed(..) => (), - AttributeKind::RustcTrivialFieldReads => (), + AttributeKind::RustcTrivialFieldReads(..) => (), AttributeKind::Sanitize { .. } => {} AttributeKind::ShouldPanic { .. } => (), AttributeKind::Splat(..) => (), diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index dbd75f0322697..4f52fa679bd91 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -7,13 +7,13 @@ use std::mem; use std::ops::ControlFlow; use std::sync::atomic::Ordering; -use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; +use hir::def_id::LocalDefIdSet; use rustc_abi::FieldIdx; use rustc_attr_ir::find_attr; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{ErrorGuaranteed, MultiSpan}; use rustc_hir::def::{CtorOf, DefKind, Res}; -use rustc_hir::def_id::{DefId, LocalDefId, LocalModId}; +use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap, LocalModId}; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{self as hir, ForeignItemId, ItemId, Node, PatKind, QPath}; use rustc_lint_defs::builtin::{DEAD_CODE, DEAD_CODE_PUB_IN_BINARY}; @@ -23,12 +23,11 @@ use rustc_middle::middle::dead_code::{DeadCodeLivenessSnapshot, DeadCodeLiveness use rustc_middle::middle::privacy::Level; use rustc_middle::query::Providers; use rustc_middle::ty::{self, AssocTag, TyCtxt}; -use rustc_span::{Symbol, bug, kw, span_bug}; +use rustc_span::{ExpnKind, MacroKind, Span, Symbol, bug, kw, span_bug}; use rustc_structures::CrateType; use crate::diagnostics::{ - ChangeFields, DeadCodePubInBinaryNote, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, - UselessAssignment, + ChangeFields, DeadCodePubInBinaryNote, MultipleDeadCodes, ParentInfo, UselessAssignment, }; /// Any local definition that may call something in its body block should be explored. For example, @@ -112,6 +111,7 @@ struct WorkItem { id: LocalDefId, propagated: ComesFromAllowExpect, own: ComesFromAllowExpect, + propagated_trivial_usage_site: Option, } enum ImplItemCheckResult { @@ -119,20 +119,67 @@ enum ImplItemCheckResult { Dead { require: LocalDefId }, } +#[derive(Eq, Hash, PartialEq, Debug)] +struct ScannedItem { + id: LocalDefId, + propagated: ComesFromAllowExpect, + trivial_usage_site: Option, +} + +#[derive(Default, Clone)] +struct LiveSymbols { + live: LocalDefIdSet, + sites_by_defid: LocalDefIdMap>, + sites: LocalDefIdMap, +} + +impl LiveSymbols { + fn insert(&mut self, def_id: LocalDefId, trivial_usage_site: Option) { + match trivial_usage_site { + Some(site) => { + // Only remember the trivial usage of the field + // if it it is dead or has only used trivially before + if !self.live.contains(&def_id) { + self.sites_by_defid.entry(def_id).or_default().insert(site); + } + } + None => { + self.live.insert(def_id); + self.sites_by_defid.remove(&def_id); + } + } + } + + fn add_trivial_usage_site(&mut self, id: LocalDefId, attr_span: Span) { + self.sites.insert(id, attr_span); + } + + fn make_snapshot(self, tcx: TyCtxt<'_>) -> DeadCodeLivenessSnapshot { + let sites_by_defid = self + .sites_by_defid + .items() + .map(|(def_id, site_ids)| { + #[expect(rustc::potential_query_instability)] + let mut site_ids = site_ids.iter().copied().collect::>(); + site_ids.sort_unstable_by_key(|id| tcx.def_path_hash(id.to_def_id())); + (*def_id, site_ids) + }) + .collect(); + DeadCodeLivenessSnapshot { live: self.live, sites_by_defid, sites: self.sites } + } +} + struct MarkSymbolVisitor<'tcx> { worklist: Vec, tcx: TyCtxt<'tcx>, maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>, - scanned: FxHashSet<(LocalDefId, ComesFromAllowExpect)>, - live_symbols: LocalDefIdSet, + scanned: FxHashSet, + live_symbols: LiveSymbols, repr_unconditionally_treats_fields_as_live: bool, repr_has_repr_simd_or_scalable: bool, + trivial_usage_sites: Vec, in_pat: bool, ignore_variant_stack: Vec, - // maps from ADTs to ignored derived traits (e.g. Debug and Clone) - // and the span of their respective impl (i.e., part of the derive - // macro) - ignored_derived_traits: LocalDefIdMap>, propagated_comes_from_allow_expect: ComesFromAllowExpect, unsolved_items: Vec, } @@ -170,11 +217,12 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { id: def_id, propagated: self.propagated_comes_from_allow_expect, own: own_comes_from_allow_expect, + propagated_trivial_usage_site: self.trivial_usage_sites.last().copied(), }); } if own_comes_from_allow_expect == ComesFromAllowExpect::No { - self.live_symbols.insert(def_id); + self.mark_live_symbol(def_id); } } } @@ -184,7 +232,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { debug_assert!(!should_explore(self.tcx, def_id)); if self.own_comes_from_allow_expect(def_id) == ComesFromAllowExpect::No { - self.live_symbols.insert(def_id); + self.mark_live_symbol(def_id); } } } @@ -386,8 +434,10 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { fn mark_live_symbols(&mut self) -> as Visitor<'tcx>>::Result { while let Some(work) = self.worklist.pop() { - let WorkItem { mut id, propagated, own } = work; + let WorkItem { mut id, propagated, own, propagated_trivial_usage_site } = work; self.propagated_comes_from_allow_expect = propagated; + self.trivial_usage_sites.clear(); + self.trivial_usage_sites.extend(propagated_trivial_usage_site.into_iter()); // in the case of tuple struct constructors we want to check the item, // not the generated tuple struct constructor function @@ -419,65 +469,89 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { match own { ComesFromAllowExpect::Yes => {} ComesFromAllowExpect::No => { - self.live_symbols.insert(id); + self.mark_live_symbol(id); } } - if !self.scanned.insert((id, propagated)) { + if self.should_skip_scanning_id( + id, + propagated, + self.trivial_usage_sites.last().copied(), + ) { continue; - } else if propagated == ComesFromAllowExpect::No { - // If the item is not coming from an `#[allow]` or `#[expect]`, - // we also mark it as scanned with `ComesFromAllowExpect::Yes` - // to avoid re-scanning it in the future. - self.scanned.insert((id, ComesFromAllowExpect::Yes)); } // Avoid accessing the HIR for the synthesized associated type generated for RPITITs. if self.tcx.is_impl_trait_in_trait(id.to_def_id()) { - self.live_symbols.insert(id); + self.mark_live_symbol(id); continue; } - self.visit_node(self.tcx.hir_node_by_def_id(id))?; + self.visit_node(id)?; } ControlFlow::Continue(()) } - /// Automatically generated items marked with `rustc_trivial_field_reads` - /// will be ignored for the purposes of dead code analysis (see PR #85200 - /// for discussion). - fn should_ignore_impl_item(&mut self, impl_item: &hir::ImplItem<'_>) -> bool { - if let hir::ImplItemImplKind::Trait { .. } = impl_item.impl_kind - && find_attr!(self.tcx, impl_item.owner_id, RustcTrivialFieldReads) - { - if let impl_of = self.tcx.local_parent(impl_item.owner_id.def_id) - && let trait_ref = - self.tcx.impl_trait_ref(impl_of).instantiate_identity().skip_norm_wip() - && let ty::Adt(adt_def, _) = trait_ref.self_ty().kind() - && let Some(adt_def_id) = adt_def.did().as_local() - { - self.ignored_derived_traits.entry(adt_def_id).or_default().insert(trait_ref.def_id); - } + fn should_skip_scanning_id( + &mut self, + id: LocalDefId, + propagated: ComesFromAllowExpect, + trivial_usage_site: Option, + ) -> bool { + // If the item was previously scanned from a normal live seed, + // we don't need to scan it again. + if self.scanned.contains(&ScannedItem { + id, + propagated: ComesFromAllowExpect::No, + trivial_usage_site: None, + }) { return true; } - + // If the item was scanned from the same allow/expect context and the same + // trivial usage site, we don't need to scan it again + if !self.scanned.insert(ScannedItem { id, propagated, trivial_usage_site }) { + return true; + } + // If the item is not coming from an `#[allow]` or `#[expect]`, + // we also mark it as scanned with `ComesFromAllowExpect::Yes` + // to avoid re-scanning it in the future. + if propagated == ComesFromAllowExpect::No { + self.scanned.insert(ScannedItem { + id, + propagated: ComesFromAllowExpect::Yes, + trivial_usage_site, + }); + } false } - fn visit_node( - &mut self, - node: Node<'tcx>, - ) -> as Visitor<'tcx>>::Result { - if let Node::ImplItem(impl_item) = node - && self.should_ignore_impl_item(impl_item) - { - return ControlFlow::Continue(()); + fn get_trivial_field_reads_attr(&mut self, id: LocalDefId, node: &Node<'_>) -> Option { + // This needs to be kept compatible with the allowed + // attribute positions in `RustcTrivialFieldReadsParser` + if !matches!( + node, + Node::Item(hir::Item { kind: rustc_hir::ItemKind::Fn { .. }, .. }) + | Node::ImplItem(hir::ImplItem { kind: rustc_hir::ImplItemKind::Fn { .. }, .. }) + ) { + return None; } + find_attr!(self.tcx, id, RustcTrivialFieldReads(span) => *span) + } + fn visit_node(&mut self, id: LocalDefId) -> as Visitor<'tcx>>::Result { + let node = self.tcx.hir_node(self.tcx.local_def_id_to_hir_id(id)); let unconditionally_treated_fields_as_live = self.repr_unconditionally_treats_fields_as_live; let had_repr_simd_or_scalable = self.repr_has_repr_simd_or_scalable; + let has_trivial_attr = if let Some(attr_span) = self.get_trivial_field_reads_attr(id, &node) + { + self.live_symbols.add_trivial_usage_site(id, attr_span); + self.trivial_usage_sites.push(id); + true + } else { + false + }; self.repr_unconditionally_treats_fields_as_live = false; self.repr_has_repr_simd_or_scalable = false; let walk_result = match node { @@ -538,6 +612,9 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { }; self.repr_has_repr_simd_or_scalable = had_repr_simd_or_scalable; self.repr_unconditionally_treats_fields_as_live = unconditionally_treated_fields_as_live; + if has_trivial_attr { + self.trivial_usage_sites.pop(); + } walk_result } @@ -577,13 +654,13 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { let mut trait_comes_from_allow = None; if let Some(trait_def_id) = trait_def_id { if defer_seeds_come_from_allow { - if !self.live_symbols.contains(&trait_def_id) { + if !self.live_symbols.live.contains(&trait_def_id) { return ImplItemCheckResult::Dead { require: trait_def_id }; } } else { trait_comes_from_allow = has_allow_dead_code_or_lang_attr(self.tcx, trait_def_id); - if !self.live_symbols.contains(&trait_def_id) { + if !self.live_symbols.live.contains(&trait_def_id) { return match trait_comes_from_allow { Some(comes_from_allow) => ImplItemCheckResult::Live(comes_from_allow), None => ImplItemCheckResult::Dead { require: trait_def_id }, @@ -596,7 +673,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { if let ty::Adt(adt, _) = self.tcx.type_of(impl_block_id).instantiate_identity().skip_norm_wip().kind() && let Some(adt_def_id) = adt.did().as_local() - && !self.live_symbols.contains(&adt_def_id) + && !self.live_symbols.live.contains(&adt_def_id) { if defer_seeds_come_from_allow { return ImplItemCheckResult::Dead { require: adt_def_id }; @@ -636,7 +713,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { rustc::potential_query_instability, reason = "The order of the unsolved items is not important, so we can just collect them into a vector." )] - fn mark_live_symbols_and_ignored_derived_traits( + fn mark_live_symbols_and_trivial_usage_sites( &mut self, defer_seeds_come_from_allow: bool, ) -> Result<(), ErrorGuaranteed> { @@ -663,14 +740,19 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { .unwrap_or(ComesFromAllowExpect::No) }; - WorkItem { id, propagated: comes_from_allow, own } + WorkItem { + id, + propagated: comes_from_allow, + own, + propagated_trivial_usage_site: None, + } })); if let ControlFlow::Break(guar) = self.mark_live_symbols() { return Err(guar); } let unsolved_items = unsolved_map - .extract_if(|require, _| self.live_symbols.contains(require)) + .extract_if(|require, _| self.live_symbols.live.contains(require)) .flat_map(|(_, items)| items) .collect(); @@ -685,6 +767,10 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { Ok(()) } + + fn mark_live_symbol(&mut self, def_id: LocalDefId) { + self.live_symbols.insert(def_id, self.trivial_usage_sites.last().copied()); + } } impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { @@ -723,7 +809,9 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { } if effective_visibilities.is_reachable(def_id) { Some(def_id) } else { None } }); - self.live_symbols.extend(live_fields); + for def_id in live_fields { + self.mark_live_symbol(def_id); + } intravisit::walk_struct_def(self, def) } @@ -825,7 +913,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { // referenced by it should be considered as used. let in_pat = mem::replace(&mut self.in_pat, false); - self.live_symbols.insert(c.def_id); + self.mark_live_symbol(c.def_id); let result = intravisit::walk_anon_const(self, c); self.in_pat = in_pat; @@ -838,7 +926,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { // referenced by it should be considered as used. let in_pat = mem::replace(&mut self.in_pat, false); - self.live_symbols.insert(c.def_id); + self.mark_live_symbol(c.def_id); let result = intravisit::walk_inline_const(self, c); self.in_pat = in_pat; @@ -867,6 +955,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { id: local_def_id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: self.trivial_usage_sites.last().copied(), }); } } @@ -936,6 +1025,7 @@ fn maybe_record_as_seed<'tcx>( id: owner_id.def_id, propagated: comes_from_allow, own: comes_from_allow, + propagated_trivial_usage_site: None, }); } @@ -948,6 +1038,7 @@ fn maybe_record_as_seed<'tcx>( id: variant.def_id.expect_local(), propagated: comes_from_allow, own: comes_from_allow, + propagated_trivial_usage_site: None, }); } } @@ -978,6 +1069,7 @@ fn maybe_record_as_seed<'tcx>( id: owner_id.def_id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: None, }); } DefKind::Const => { @@ -989,6 +1081,7 @@ fn maybe_record_as_seed<'tcx>( id: owner_id.def_id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: None, }); } } @@ -1020,6 +1113,7 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists { id: local_def_id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: None, }); } @@ -1035,6 +1129,7 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists { id: local_def_id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: None, }); } @@ -1044,6 +1139,7 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists { id: *id, propagated: ComesFromAllowExpect::No, own: ComesFromAllowExpect::No, + propagated_trivial_usage_site: None, }); } } @@ -1060,7 +1156,7 @@ fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> SeedWorklists { SeedWorklists { worklist, deferred_seeds, unsolved_items } } -fn live_symbols_and_ignored_derived_traits( +fn live_symbols_and_trivial_usage_sites( tcx: TyCtxt<'_>, (): (), ) -> Result { @@ -1073,34 +1169,28 @@ fn live_symbols_and_ignored_derived_traits( live_symbols: Default::default(), repr_unconditionally_treats_fields_as_live: false, repr_has_repr_simd_or_scalable: false, + trivial_usage_sites: vec![], in_pat: false, ignore_variant_stack: vec![], - ignored_derived_traits: Default::default(), propagated_comes_from_allow_expect: ComesFromAllowExpect::No, unsolved_items, }; - symbol_visitor.mark_live_symbols_and_ignored_derived_traits(true)?; - let pre_deferred_seeding = DeadCodeLivenessSnapshot { - live_symbols: symbol_visitor.live_symbols.clone(), - ignored_derived_traits: symbol_visitor.ignored_derived_traits.clone(), - }; + symbol_visitor.mark_live_symbols_and_trivial_usage_sites(true)?; + let pre_deferred_seeding = symbol_visitor.live_symbols.clone().make_snapshot(tcx); if !deferred_seeds.pub_reachables.is_empty() { symbol_visitor.worklist.extend(deferred_seeds.pub_reachables); - symbol_visitor.mark_live_symbols_and_ignored_derived_traits(true)?; + symbol_visitor.mark_live_symbols_and_trivial_usage_sites(true)?; } if !deferred_seeds.come_from_allow.is_empty() { symbol_visitor.worklist.extend(deferred_seeds.come_from_allow); - symbol_visitor.mark_live_symbols_and_ignored_derived_traits(false)?; + symbol_visitor.mark_live_symbols_and_trivial_usage_sites(false)?; } Ok(DeadCodeLivenessSummary { pre_deferred_seeding, - final_result: DeadCodeLivenessSnapshot { - live_symbols: symbol_visitor.live_symbols, - ignored_derived_traits: symbol_visitor.ignored_derived_traits, - }, + final_result: symbol_visitor.live_symbols.make_snapshot(tcx), }) } @@ -1113,8 +1203,7 @@ struct DeadItem { struct DeadVisitor<'tcx> { tcx: TyCtxt<'tcx>, target_lint: &'static Lint, - live_symbols: &'tcx LocalDefIdSet, - ignored_derived_traits: &'tcx LocalDefIdMap>, + live_symbols: &'tcx DeadCodeLivenessSnapshot, } enum ShouldWarnAboutField { @@ -1132,7 +1221,7 @@ enum ReportOn { impl<'tcx> DeadVisitor<'tcx> { fn should_warn_about_field(&mut self, field: &ty::FieldDef) -> ShouldWarnAboutField { - if self.live_symbols.contains(&field.did.expect_local()) { + if self.live_symbols.is_live(&field.did.expect_local()) { return ShouldWarnAboutField::No; } let field_type = self.tcx.type_of(field.did).instantiate_identity().skip_norm_wip(); @@ -1167,7 +1256,7 @@ impl<'tcx> DeadVisitor<'tcx> { let fulfill_if_expected = |node: DefId| { // Only consider local, dead symbols where lint level carries an expectation if let Some(node) = node.as_local() - && !self.live_symbols.contains(&node) + && !self.live_symbols.is_live(&node) && let (_, Some(expectation)) = self.def_lint_level_plus(node) { // Same mechanism as LintContext::fulfill_expectation. @@ -1263,25 +1352,7 @@ impl<'tcx> DeadVisitor<'tcx> { ParentInfo { num, descr, parent_descr, span } }); - let mut encl_def_id = parent_item.unwrap_or(first_item.def_id); - // `ignored_derived_traits` is computed for the enum, not for the variants. - if let DefKind::Variant = tcx.def_kind(encl_def_id) { - encl_def_id = tcx.local_parent(encl_def_id); - } - - let ignored_derived_impls = - self.ignored_derived_traits.get(&encl_def_id).map(|ign_traits| { - let trait_list = ign_traits - .iter() - .map(|trait_id| self.tcx.item_name(*trait_id)) - .collect::>(); - let trait_list_len = trait_list.len(); - IgnoredDerivedImpls { - name: self.tcx.item_name(encl_def_id.to_def_id()), - trait_list: trait_list.into(), - trait_list_len, - } - }); + let trivial_usage_sites = self.trivial_usage_sites(dead_codes); let diag = match report_on { ReportOn::TupleField => { @@ -1326,7 +1397,7 @@ impl<'tcx> DeadVisitor<'tcx> { dead_code_pub_in_binary_note: self.dead_code_pub_in_binary_note(), change_fields_suggestion: fields_suggestion, parent_info, - ignored_derived_impls, + trivial_usage_sites, } } ReportOn::NamedField => { @@ -1362,7 +1433,7 @@ impl<'tcx> DeadVisitor<'tcx> { name_list, dead_code_pub_in_binary_note: self.dead_code_pub_in_binary_note(), parent_info, - ignored_derived_impls, + trivial_usage_sites, enum_variants_with_same_name, } } @@ -1372,6 +1443,58 @@ impl<'tcx> DeadVisitor<'tcx> { self.tcx.emit_node_span_lint(self.target_lint, hir_id, MultiSpan::from_spans(spans), diag); } + fn trivial_usage_sites( + &self, + dead_items: &[&DeadItem], + ) -> Vec { + // For grouped diagnostics, we emit one note per usage site + // wherein we point to all the items which are ignored due to the site. + // Here, we invert the mapping from DefId -> [SiteId] to SiteId -> [DefId] + let mut sites: FxHashMap> = FxHashMap::default(); + for item in dead_items { + for site_id in self.live_symbols.trivial_usage_sites(&item.def_id) { + sites.entry(site_id).or_default().push(item.def_id); + } + } + // We immediately sort these by span afterwards, so + // the instability does not matter + #[expect(rustc::potential_query_instability)] + let mut notes: Vec<_> = sites + .into_iter() + .map(|(usage_site_id, def_ids)| { + let usage_site_hir_id = self.tcx.local_def_id_to_hir_id(usage_site_id); + let attr_span = self.live_symbols.trivial_usage_site_span_by_id(usage_site_id); + let names: Vec<_> = + def_ids.iter().map(|def_id| self.tcx.item_name(*def_id)).collect(); + let multiple = names.len() > 1; + let names = names.into(); + let (span, usage_msg) = match attr_span.ctxt().outer_expn_data().kind { + ExpnKind::Macro(MacroKind::Derive, name) => { + (attr_span, format!("in the expansion of the derive macro `{name}`")) + } + ExpnKind::Macro(_, name) => { + let span = if attr_span.in_external_macro(self.tcx.sess.source_map()) { + attr_span + } else { + // For local macros, point to the item, not the attr + self.tcx.hir_span(usage_site_hir_id) + }; + (span, format!("in the expansion of the macro `{name}`")) + } + _ => { + // The hir node always has a name, since `rustc_trivial_field_reads` + // can only be on functions and methods. + let msg = format!("in `{}`", self.tcx.hir_name(usage_site_hir_id)); + (self.tcx.hir_span(usage_site_hir_id), msg) + } + }; + crate::diagnostics::TrivialUsageSite { names, span, usage_msg, multiple } + }) + .collect(); + notes.sort_unstable_by_key(|note| note.span.lo_hi()); + notes + } + fn warn_multiple( &self, def_id: LocalDefId, @@ -1432,13 +1555,13 @@ impl<'tcx> DeadVisitor<'tcx> { return true; }; - self.live_symbols.contains(&def_id) || name.as_str().starts_with('_') + self.live_symbols.is_live(&def_id) || name.as_str().starts_with('_') } } fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModId) { let Ok(DeadCodeLivenessSummary { pre_deferred_seeding, final_result }) = - tcx.live_symbols_and_ignored_derived_traits(()).as_ref() + tcx.live_symbols_and_trivial_usage_sites(()).as_ref() else { return; }; @@ -1448,15 +1571,14 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModId) { if tcx.crate_types().contains(&CrateType::Executable) { let is_unused_pub = |def_id: LocalDefId| { tcx.effective_visibilities(()).is_public_at_level(def_id, Level::Reachable) - && !pre_deferred_seeding.live_symbols.contains(&def_id) + && !pre_deferred_seeding.is_live(&def_id) }; lint_dead_codes( tcx, DEAD_CODE_PUB_IN_BINARY, module, - &pre_deferred_seeding.live_symbols, - &pre_deferred_seeding.ignored_derived_traits, + &pre_deferred_seeding, module_items.free_items().filter(|free_item| is_unused_pub(free_item.owner_id.def_id)), module_items .foreign_items() @@ -1468,8 +1590,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModId) { tcx, DEAD_CODE, module, - &final_result.live_symbols, - &final_result.ignored_derived_traits, + &final_result, module_items.free_items(), module_items.foreign_items(), ); @@ -1479,12 +1600,11 @@ fn lint_dead_codes<'tcx>( tcx: TyCtxt<'tcx>, target_lint: &'static Lint, module: LocalModId, - live_symbols: &'tcx LocalDefIdSet, - ignored_derived_traits: &'tcx LocalDefIdMap>, + live_symbols: &'tcx DeadCodeLivenessSnapshot, free_items: impl Iterator, foreign_items: impl Iterator, ) { - let mut visitor = DeadVisitor { tcx, target_lint, live_symbols, ignored_derived_traits }; + let mut visitor = DeadVisitor { tcx, target_lint, live_symbols }; for item in free_items { let def_kind = tcx.def_kind(item.owner_id); @@ -1495,7 +1615,7 @@ fn lint_dead_codes<'tcx>( // for unused assoc items in unused trait, // we have diagnosed the unused trait. if def_kind == (DefKind::Impl { of_trait: false }) - || (def_kind == DefKind::Trait && live_symbols.contains(&item.owner_id.def_id)) + || (def_kind == DefKind::Trait && live_symbols.is_live(&item.owner_id.def_id)) { for &def_id in tcx.associated_item_def_ids(item.owner_id.def_id) { if let Some(local_def_id) = def_id.as_local() @@ -1511,9 +1631,9 @@ fn lint_dead_codes<'tcx>( visitor.warn_multiple(item.owner_id.def_id, "used", dead_codes, ReportOn::NamedField); } - if !live_symbols.contains(&item.owner_id.def_id) { + if !live_symbols.is_live(&item.owner_id.def_id) { let parent = tcx.local_parent(item.owner_id.def_id); - if parent != module.to_local_def_id() && !live_symbols.contains(&parent) { + if parent != module.to_local_def_id() && !live_symbols.is_live(&parent) { // We already have diagnosed something, but check parent's field for #[expect] visitor.fulfill_dead_code_expectations(item.owner_id.def_id, true); continue; @@ -1529,7 +1649,7 @@ fn lint_dead_codes<'tcx>( for variant in adt.variants() { let def_id = variant.def_id.expect_local(); - if !live_symbols.contains(&def_id) { + if !live_symbols.is_live(&def_id) { // Record to group diagnostics. let level_plus = visitor.def_lint_level_plus(def_id); dead_variants.push(DeadItem { def_id, name: variant.name, level_plus }); @@ -1574,5 +1694,5 @@ fn lint_dead_codes<'tcx>( pub(crate) fn provide(providers: &mut Providers) { *providers = - Providers { live_symbols_and_ignored_derived_traits, check_mod_deathness, ..*providers }; + Providers { live_symbols_and_trivial_usage_sites, check_mod_deathness, ..*providers }; } diff --git a/compiler/rustc_passes/src/diagnostics.rs b/compiler/rustc_passes/src/diagnostics.rs index 1f66718f379d6..aae198cf05257 100644 --- a/compiler/rustc_passes/src/diagnostics.rs +++ b/compiler/rustc_passes/src/diagnostics.rs @@ -545,7 +545,7 @@ pub(crate) enum MultipleDeadCodes<'tcx> { #[subdiagnostic] parent_info: Option>, #[subdiagnostic] - ignored_derived_impls: Option, + trivial_usage_sites: Vec, }, #[diag( "{ $multiple -> @@ -569,7 +569,7 @@ pub(crate) enum MultipleDeadCodes<'tcx> { #[subdiagnostic] parent_info: Option>, #[subdiagnostic] - ignored_derived_impls: Option, + trivial_usage_sites: Vec, }, } @@ -607,18 +607,17 @@ pub(crate) struct ParentInfo<'tcx> { #[derive(Subdiagnostic)] #[note( - "`{$name}` has {$trait_list_len -> - [one] a derived impl - *[other] derived impls - } for the {$trait_list_len -> - [one] trait {$trait_list}, but this is - *[other] traits {$trait_list}, but these are - } intentionally ignored during dead code analysis" + "{$names} { $multiple -> + *[true] are + [false] is + } used {$usage_msg}, but this is intentionally ignored during dead code analysis" )] -pub(crate) struct IgnoredDerivedImpls { - pub name: Symbol, - pub trait_list: DiagSymbolList, - pub trait_list_len: usize, +pub(crate) struct TrivialUsageSite { + #[primary_span] + pub span: Span, + pub names: DiagSymbolList, + pub multiple: bool, + pub usage_msg: String, } #[derive(Subdiagnostic)] diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 5e0c74f2a6324..3aa91203267dc 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -284,7 +284,7 @@ pub const unsafe trait TrivialClone: [const] Clone {} /// Derive macro generating an impl of the trait `Clone`. #[rustc_builtin_macro] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -#[allow_internal_unstable(core_intrinsics, derive_clone_copy_internals, trivial_clone, rustc_attrs)] +#[allow_internal_unstable(core_intrinsics, derive_clone_copy_internals, trivial_clone)] pub macro Clone($item:item) { /* compiler built-in */ } diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 967b5a7c62194..96dde7a11891b 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -1088,7 +1088,7 @@ pub(crate) mod macros { /// Derive macro generating an impl of the trait `Debug`. #[rustc_builtin_macro] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] - #[allow_internal_unstable(core_intrinsics, fmt_helpers_for_derive, rustc_attrs)] + #[allow_internal_unstable(core_intrinsics, fmt_helpers_for_derive)] pub macro Debug($item:item) { /* compiler built-in */ } diff --git a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr index e9b757b6bae72..9a6ed8455ff55 100644 --- a/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr +++ b/tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr @@ -13,7 +13,11 @@ LL | field3: (), LL | field4: (), | ^^^^^^ | - = note: `Whatever` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis +note: `field1`, `field2`, `field3`, and `field4` are used in the expansion of the derive macro `Debug`, but this is intentionally ignored during dead code analysis + --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:3:10 + | +LL | #[derive(Debug)] + | ^^^^^ note: the lint level is defined here --> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11 | diff --git a/tests/ui/derives/clone-debug-dead-code.stderr b/tests/ui/derives/clone-debug-dead-code.stderr index 38be486e33207..9d9811fead151 100644 --- a/tests/ui/derives/clone-debug-dead-code.stderr +++ b/tests/ui/derives/clone-debug-dead-code.stderr @@ -20,7 +20,11 @@ LL | struct B { f: () } | | | field in this struct | - = note: `B` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis +note: `f` is used in the expansion of the derive macro `Clone`, but this is intentionally ignored during dead code analysis + --> $DIR/clone-debug-dead-code.rs:9:10 + | +LL | #[derive(Clone)] + | ^^^^^ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:14:12 @@ -30,7 +34,11 @@ LL | struct C { f: () } | | | field in this struct | - = note: `C` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis +note: `f` is used in the expansion of the derive macro `Debug`, but this is intentionally ignored during dead code analysis + --> $DIR/clone-debug-dead-code.rs:13:10 + | +LL | #[derive(Debug)] + | ^^^^^ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:18:12 @@ -40,7 +48,16 @@ LL | struct D { f: () } | | | field in this struct | - = note: `D` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis +note: `f` is used in the expansion of the derive macro `Debug`, but this is intentionally ignored during dead code analysis + --> $DIR/clone-debug-dead-code.rs:17:10 + | +LL | #[derive(Debug,Clone)] + | ^^^^^ +note: `f` is used in the expansion of the derive macro `Clone`, but this is intentionally ignored during dead code analysis + --> $DIR/clone-debug-dead-code.rs:17:16 + | +LL | #[derive(Debug,Clone)] + | ^^^^^ error: field `f` is never read --> $DIR/clone-debug-dead-code.rs:21:12 diff --git a/tests/ui/derives/debug/derive-debug-uninhabited-enum.stderr b/tests/ui/derives/debug/derive-debug-uninhabited-enum.stderr index 90f4d34b1c5ca..956d290d3889d 100644 --- a/tests/ui/derives/debug/derive-debug-uninhabited-enum.stderr +++ b/tests/ui/derives/debug/derive-debug-uninhabited-enum.stderr @@ -7,7 +7,6 @@ LL | Bar(#[allow(dead_code)] u8), LL | Void(Void), | ^^^^ | - = note: `Foo` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis = note: `-W dead-code` implied by `-W unused` = help: to override `-W unused` add `#[expect(dead_code)]` or `#[allow(dead_code)]` diff --git a/tests/ui/lint/dead-code/trivial-field-reads/auxiliary/macro_def.rs b/tests/ui/lint/dead-code/trivial-field-reads/auxiliary/macro_def.rs new file mode 100644 index 0000000000000..3514014e9cacb --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/auxiliary/macro_def.rs @@ -0,0 +1,9 @@ +#[macro_export] +macro_rules! bar { + ($name: ident) => { + #[rustc_trivial_field_reads] + fn bar(s: &$name) { + println!("{}", s.0); + } + }; +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.rs b/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.rs new file mode 100644 index 0000000000000..abd29fd9e9463 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.rs @@ -0,0 +1,30 @@ +// This test uses an item through a trivial helper twice +// from different seeds, to ensure the note pointing to +// the `rustc_trivial_field_reads` attr is added only once +#![feature(rustc_attrs)] +#![deny(dead_code)] + +struct Data { + value: bool, //~ ERROR: field `value` is never read +} + +#[rustc_trivial_field_reads] +fn helper(data: &Data) { + println!("{}", data.value); +} + +#[rustc_trivial_field_reads] +fn intermediate(data: &Data) { + helper(data); +} + +#[allow(unused)] +fn allowed() { + let data = Data { value: true }; + helper(&data); +} + +fn main() { + let data = Data { value: true }; + intermediate(&data); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.stderr b/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.stderr new file mode 100644 index 0000000000000..480bae9f71561 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/deduplicate-usage-sites.stderr @@ -0,0 +1,21 @@ +error: field `value` is never read + --> $DIR/deduplicate-usage-sites.rs:8:5 + | +LL | struct Data { + | ---- field in this struct +LL | value: bool, + | ^^^^^ + | +note: `value` is used in `helper`, but this is intentionally ignored during dead code analysis + --> $DIR/deduplicate-usage-sites.rs:12:1 + | +LL | fn helper(data: &Data) { + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/deduplicate-usage-sites.rs:5:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/from-macro.rs b/tests/ui/lint/dead-code/trivial-field-reads/from-macro.rs new file mode 100644 index 0000000000000..bc31be1fb1457 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/from-macro.rs @@ -0,0 +1,29 @@ +//@ aux-build:macro_def.rs + +#![feature(rustc_attrs)] +#![allow(internal_features)] +#![deny(dead_code)] + +#[macro_use] +extern crate macro_def; + +#[derive(Clone)] +struct Struct(usize); //~ ERROR: field `0` is never read + +macro_rules! foo { + () => { + #[rustc_trivial_field_reads] + fn foo(s: &Struct) { + println!("{}", s.0); + } + }; +} + +foo!(); +bar!(Struct); + +fn main() { + let s = Struct(0); + foo(&s); + bar(&s); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/from-macro.stderr b/tests/ui/lint/dead-code/trivial-field-reads/from-macro.stderr new file mode 100644 index 0000000000000..786593c935631 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/from-macro.stderr @@ -0,0 +1,36 @@ +error: field `0` is never read + --> $DIR/from-macro.rs:11:15 + | +LL | struct Struct(usize); + | ------ ^^^^^ + | | + | field in this struct + | + = help: consider removing this field +note: `0` is used in the expansion of the derive macro `Clone`, but this is intentionally ignored during dead code analysis + --> $DIR/from-macro.rs:10:10 + | +LL | #[derive(Clone)] + | ^^^^^ +note: `0` is used in the expansion of the macro `foo`, but this is intentionally ignored during dead code analysis + --> $DIR/from-macro.rs:16:9 + | +LL | fn foo(s: &Struct) { + | ^^^^^^^^^^^^^^^^^^ +... +LL | foo!(); + | ------ in this macro invocation +note: `0` is used in the expansion of the macro `bar`, but this is intentionally ignored during dead code analysis + --> $DIR/from-macro.rs:23:1 + | +LL | bar!(Struct); + | ^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/from-macro.rs:5:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + = note: this error originates in the derive macro `Clone` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.rs b/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.rs new file mode 100644 index 0000000000000..ad869a5bfcbdc --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.rs @@ -0,0 +1,31 @@ +#![feature(rustc_attrs)] +#![deny(dead_code)] //~ NOTE: lint level is defined here +#![allow(internal_features)] + +struct Struct { //~ NOTE: fields in this struct + first: bool, //~ ERROR: fields `first` and `second` are never read + second: bool, +} + +#[rustc_trivial_field_reads] +fn read_first(data: &Struct) { //~ NOTE: `first` is used in `read_first` + let _ = data.first; +} + +#[rustc_trivial_field_reads] +fn read_second(data: &Struct) { //~ NOTE: `second` is used in `read_second` + let _ = data.second; +} + +#[rustc_trivial_field_reads] +fn read_first_and_second(data: &Struct) { //~ NOTE: `first` and `second` are used in `read_first_and_second` + let _ = data.first; + let _ = data.second; +} + +fn main() { + let data = Struct { first: false, second: false }; + read_first(&data); + read_second(&data); + read_first_and_second(&data); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.stderr b/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.stderr new file mode 100644 index 0000000000000..16d62bd0a215e --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/grouped-diagnostic.stderr @@ -0,0 +1,33 @@ +error: fields `first` and `second` are never read + --> $DIR/grouped-diagnostic.rs:6:5 + | +LL | struct Struct { + | ------ fields in this struct +LL | first: bool, + | ^^^^^ +LL | second: bool, + | ^^^^^^ + | +note: `first` is used in `read_first`, but this is intentionally ignored during dead code analysis + --> $DIR/grouped-diagnostic.rs:11:1 + | +LL | fn read_first(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `second` is used in `read_second`, but this is intentionally ignored during dead code analysis + --> $DIR/grouped-diagnostic.rs:16:1 + | +LL | fn read_second(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: `first` and `second` are used in `read_first_and_second`, but this is intentionally ignored during dead code analysis + --> $DIR/grouped-diagnostic.rs:21:1 + | +LL | fn read_first_and_second(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/grouped-diagnostic.rs:2:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.rs b/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.rs new file mode 100644 index 0000000000000..588ee37ed1c5f --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.rs @@ -0,0 +1,16 @@ +#![feature(rustc_attrs)] + +#![deny(dead_code)] + +struct Foo(usize); //~ ERROR: field `0` is never read + +impl Foo { + #[rustc_trivial_field_reads] + fn bar(&self) -> usize { + self.0 + } +} + +fn main() { + println!("{}", Foo(0).bar()); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.stderr b/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.stderr new file mode 100644 index 0000000000000..fd560a2b7b8fe --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/inherent-method.stderr @@ -0,0 +1,22 @@ +error: field `0` is never read + --> $DIR/inherent-method.rs:5:12 + | +LL | struct Foo(usize); + | --- ^^^^^ + | | + | field in this struct + | + = help: consider removing this field +note: `0` is used in `bar`, but this is intentionally ignored during dead code analysis + --> $DIR/inherent-method.rs:9:5 + | +LL | fn bar(&self) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/inherent-method.rs:3:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.rs b/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.rs new file mode 100644 index 0000000000000..d123c515ce90c --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.rs @@ -0,0 +1,20 @@ +#![feature(rustc_attrs)] + +#![deny(dead_code)] + +trait Trait { + fn bar(&self) -> usize; +} + +struct Foo(usize); //~ ERROR: field `0` is never read + +impl Trait for Foo { + #[rustc_trivial_field_reads] + fn bar(&self) -> usize { + self.0 + } +} + +fn main() { + println!("{}", Foo(0).bar()); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.stderr b/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.stderr new file mode 100644 index 0000000000000..e9a9404bffd8a --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/manual-trait-impl.stderr @@ -0,0 +1,22 @@ +error: field `0` is never read + --> $DIR/manual-trait-impl.rs:9:12 + | +LL | struct Foo(usize); + | --- ^^^^^ + | | + | field in this struct + | + = help: consider removing this field +note: `0` is used in `bar`, but this is intentionally ignored during dead code analysis + --> $DIR/manual-trait-impl.rs:13:5 + | +LL | fn bar(&self) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/manual-trait-impl.rs:3:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/mixed-allow-trivial.rs b/tests/ui/lint/dead-code/trivial-field-reads/mixed-allow-trivial.rs new file mode 100644 index 0000000000000..e867ed93e8731 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/mixed-allow-trivial.rs @@ -0,0 +1,27 @@ +//@ check-pass + +#![feature(rustc_attrs)] +#![allow(internal_features)] +#![deny(dead_code)] + +struct Struct { + value: u32, +} + +fn read(d: &Struct) { + let _ = d.value; +} + +#[rustc_trivial_field_reads] +fn trivial(d: &Struct) { + read(d); +} + +#[allow(dead_code)] +fn example() { + let d = Struct { value: 42 }; + read(&d); + trivial(&d); +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/multiple-usages.rs b/tests/ui/lint/dead-code/trivial-field-reads/multiple-usages.rs new file mode 100644 index 0000000000000..f0f6c13486fd2 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/multiple-usages.rs @@ -0,0 +1,35 @@ +// This test checks whether an item which is used trivially +// from a normal seed is then checked again when coming from +// a allow/expect seed, which should mark it as non-trivially +// used. +// +//@ check-pass + +#![feature(rustc_attrs)] +#![deny(dead_code)] + +trait Trait { + fn bar(&self); +} + +struct Foo(usize); + +fn print() { + println!("{}", Foo(0).0); +} + +impl Trait for Foo { + #[rustc_trivial_field_reads] + fn bar(&self) { + print(); + } +} + +#[expect(dead_code)] +fn entry() { + print(); +} + +fn main() { + Foo(0).bar(); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/on-main.rs b/tests/ui/lint/dead-code/trivial-field-reads/on-main.rs new file mode 100644 index 0000000000000..80658c745fa0f --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/on-main.rs @@ -0,0 +1,10 @@ +#![feature(rustc_attrs)] +#![deny(dead_code)] + +#[derive(Clone)] +struct Foo(usize); //~ ERROR: struct `Foo` is never constructed + +#[rustc_trivial_field_reads] +fn main() { + println!("{}", Foo(0).0); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/on-main.stderr b/tests/ui/lint/dead-code/trivial-field-reads/on-main.stderr new file mode 100644 index 0000000000000..14909533fd98a --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/on-main.stderr @@ -0,0 +1,19 @@ +error: struct `Foo` is never constructed + --> $DIR/on-main.rs:5:8 + | +LL | struct Foo(usize); + | ^^^ + | +note: `Foo` is used in `main`, but this is intentionally ignored during dead code analysis + --> $DIR/on-main.rs:8:1 + | +LL | fn main() { + | ^^^^^^^^^ +note: the lint level is defined here + --> $DIR/on-main.rs:2:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.rs b/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.rs new file mode 100644 index 0000000000000..71d697d69883d --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.rs @@ -0,0 +1,34 @@ +// This checks whether a single fn called from two trivial contexts produces a +// combined diagnostic for both of them + +#![feature(rustc_attrs)] +#![allow(internal_features)] +#![deny(dead_code)] //~ NOTE: the lint level is defined here + +struct Struct { //~ NOTE: field in this struct + value: u32, //~ ERROR: `value` is never read +} + +fn read(data: &Struct) { //~ ERROR: function `read` is never used + let _ = data.value; +} + +#[rustc_trivial_field_reads] +fn a(data: &Struct) { + //~^ NOTE: `value` is used in `a`, but this is intentionally ignored + //~| NOTE: `read` is used in `a`, but this is intentionally ignored + read(data); +} + +#[rustc_trivial_field_reads] +fn b(data: &Struct) { + //~^ NOTE: `value` is used in `b`, but this is intentionally ignored + //~| NOTE: `read` is used in `b`, but this is intentionally ignored + read(data); +} + +fn main() { + let data = Struct { value: 42 }; + a(&data); + b(&data); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.stderr b/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.stderr new file mode 100644 index 0000000000000..59eac12ff932c --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/two-usage-sites.stderr @@ -0,0 +1,43 @@ +error: field `value` is never read + --> $DIR/two-usage-sites.rs:9:5 + | +LL | struct Struct { + | ------ field in this struct +LL | value: u32, + | ^^^^^ + | +note: `value` is used in `a`, but this is intentionally ignored during dead code analysis + --> $DIR/two-usage-sites.rs:17:1 + | +LL | fn a(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^ +note: `value` is used in `b`, but this is intentionally ignored during dead code analysis + --> $DIR/two-usage-sites.rs:24:1 + | +LL | fn b(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/two-usage-sites.rs:6:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: function `read` is never used + --> $DIR/two-usage-sites.rs:12:4 + | +LL | fn read(data: &Struct) { + | ^^^^ + | +note: `read` is used in `a`, but this is intentionally ignored during dead code analysis + --> $DIR/two-usage-sites.rs:17:1 + | +LL | fn a(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^ +note: `read` is used in `b`, but this is intentionally ignored during dead code analysis + --> $DIR/two-usage-sites.rs:24:1 + | +LL | fn b(data: &Struct) { + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.rs b/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.rs new file mode 100644 index 0000000000000..869c45c8e0c50 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.rs @@ -0,0 +1,31 @@ +#![feature(rustc_attrs)] +#![deny(dead_code)] + +struct Data { + value: bool, //~ ERROR: field `value` is never read +} + +// This is marked as trivial +#[rustc_trivial_field_reads] +fn outer(data: &Data) -> bool { + data.read() +} + +impl Data { + // But so is this, and it is the one that ends up using `Data::value`, so + // the diagnostic should point here + #[rustc_trivial_field_reads] + fn read(&self) -> bool { + self.value + } +} + +#[allow(unused)] +fn allowed(data: &Data) { + let _ = data.read(); +} + +fn main() { + let data = Data { value: true }; + let _ = outer(&data); +} diff --git a/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.stderr b/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.stderr new file mode 100644 index 0000000000000..ecf6673229591 --- /dev/null +++ b/tests/ui/lint/dead-code/trivial-field-reads/use-innermost-usage-site.stderr @@ -0,0 +1,21 @@ +error: field `value` is never read + --> $DIR/use-innermost-usage-site.rs:5:5 + | +LL | struct Data { + | ---- field in this struct +LL | value: bool, + | ^^^^^ + | +note: `value` is used in `read`, but this is intentionally ignored during dead code analysis + --> $DIR/use-innermost-usage-site.rs:18:5 + | +LL | fn read(&self) -> bool { + | ^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/use-innermost-usage-site.rs:2:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/unused-variant.stderr b/tests/ui/lint/dead-code/unused-variant.stderr index 4bc8cf420da7b..7a36092c903fd 100644 --- a/tests/ui/lint/dead-code/unused-variant.stderr +++ b/tests/ui/lint/dead-code/unused-variant.stderr @@ -6,7 +6,11 @@ LL | enum Enum { LL | Variant1, | ^^^^^^^^ | - = note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis +note: `Variant1` is used in the expansion of the derive macro `Clone`, but this is intentionally ignored during dead code analysis + --> $DIR/unused-variant.rs:3:10 + | +LL | #[derive(Clone)] + | ^^^^^ note: the lint level is defined here --> $DIR/unused-variant.rs:1:9 | @@ -20,8 +24,6 @@ LL | enum TupleVariant { | ------------ variant in this enum LL | Variant1(i32), | ^^^^^^^^ - | - = note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis error: variant `Variant1` is never constructed --> $DIR/unused-variant.rs:17:5 @@ -30,8 +32,6 @@ LL | enum StructVariant { | ------------- variant in this enum LL | Variant1 { id: i32 }, | ^^^^^^^^ - | - = note: `StructVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis error: aborting due to 3 previous errors From 73309b6dc224da7aa7a5fa6fdbe9373959664358 Mon Sep 17 00:00:00 2001 From: Yilin Chen <1479826151@qq.com> Date: Tue, 10 Nov 2026 19:24:44 +0800 Subject: [PATCH 38/38] Add safety requirements for Pattern, Searcher and ReverseSearcher --- library/alloc/src/string.rs | 2 +- library/core/src/str/iter.rs | 22 +++++-- library/core/src/str/pattern.rs | 103 +++++++++++++++++++++++--------- 3 files changed, 92 insertions(+), 35 deletions(-) diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 08ef554bcbef0..97aa0ae1b45f0 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -2749,7 +2749,7 @@ impl<'a> Extend<&'a core::ascii::Char> for String { reason = "API not fully fleshed out and ready to be stabilized", issue = "27721" )] -impl<'b> Pattern for &'b String { +unsafe impl<'b> Pattern for &'b String { type Searcher<'a> = <&'b str as Pattern>::Searcher<'a>; fn into_searcher(self, haystack: &str) -> <&'b str as Pattern>::Searcher<'_> { diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 657d894d38878..7ca012ca4283c 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -661,7 +661,9 @@ impl<'a, P: Pattern> SplitInternal<'a, P> { let haystack = self.matcher.haystack(); match self.matcher.next_match() { - // SAFETY: `Searcher` guarantees that `a` and `b` lie on unicode boundaries. + // SAFETY: `Searcher` guarantees that: + // - `a` and `b` lie on unicode boundaries. + // - `a <= b <= haystack().len()` is satisfied. Some((a, b)) => unsafe { let elt = haystack.get_unchecked(self.start..a); self.start = b; @@ -679,9 +681,11 @@ impl<'a, P: Pattern> SplitInternal<'a, P> { let haystack = self.matcher.haystack(); match self.matcher.next_match() { - // SAFETY: `Searcher` guarantees that `b` lies on unicode boundary, - // and self.start is either the start of the original string, + // SAFETY: `Searcher` guarantees that: + // - `b` lies on unicode boundary. + // - `self.start` is either the start of the original string, // or `b` was assigned to it, so it also lies on unicode boundary. + // - `self.start <= b <= haystack().len()` is satisfied. Some((_, b)) => unsafe { let elt = haystack.get_unchecked(self.start..b); self.start = b; @@ -714,7 +718,11 @@ impl<'a, P: Pattern> SplitInternal<'a, P> { let haystack = self.matcher.haystack(); match self.matcher.next_match_back() { - // SAFETY: `Searcher` guarantees that `a` and `b` lie on unicode boundaries. + // SAFETY: `Searcher` guarantees that: + // - `a` and `b` lie on unicode boundaries. + // - `self.end` is either the end of the original string, + // or `a` was assigned to it, so it also lies on unicode boundary. + // - `a <= b <= haystack().len()` is satisfied. Some((a, b)) => unsafe { let elt = haystack.get_unchecked(b..self.end); self.end = a; @@ -751,9 +759,11 @@ impl<'a, P: Pattern> SplitInternal<'a, P> { let haystack = self.matcher.haystack(); match self.matcher.next_match_back() { - // SAFETY: `Searcher` guarantees that `b` lies on unicode boundary, - // and self.end is either the end of the original string, + // SAFETY: `Searcher` guarantees that: + // - `b` lies on unicode boundary. + // - self.end is either the end of the original string, // or `b` was assigned to it, so it also lies on unicode boundary. + // - `self.end <= b <= haystack.len()` is satisfied. Some((_, b)) => unsafe { let elt = haystack.get_unchecked(b..self.end); self.end = b; diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs index af48c2eae8dd6..4faf2fd178b60 100644 --- a/library/core/src/str/pattern.rs +++ b/library/core/src/str/pattern.rs @@ -70,6 +70,10 @@ use crate::{cmp, fmt}; /// | `&&str` | is substring | /// | `&String` | is substring | /// +/// # Safety +/// +/// Implementers must uphold the guarantees documented on `into_searcher`. +/// /// # Examples /// /// ``` @@ -96,12 +100,18 @@ use crate::{cmp, fmt}; /// assert_eq!("abcdef_z".find(|ch| ch > 'd' && ch < 'y'), Some(4)); /// assert_eq!("abcddd_z".find(|ch| ch > 'd' && ch < 'y'), None); /// ``` -pub trait Pattern: Sized { +pub unsafe trait Pattern: Sized { /// Associated searcher for this pattern type Searcher<'a>: Searcher<'a>; /// Constructs the associated searcher from /// `self` and the `haystack` to search in. + /// + /// # Guarantees + /// + /// - The returned searcher must search the provided `haystack`. + /// In particular, [`Searcher::haystack()`] must return the + /// same string slice passed to this method. fn into_searcher(self, haystack: &str) -> Self::Searcher<'_>; /// Checks whether the pattern matches anywhere in the haystack @@ -206,13 +216,16 @@ pub enum SearchStep { /// It will be implemented by associated `Searcher` /// types of the [`Pattern`] trait. /// -/// The trait is marked unsafe because the indices returned by the -/// [`next()`][Searcher::next] methods are required to lie on valid utf8 -/// boundaries in the haystack. This enables consumers of this trait to -/// slice the haystack without additional runtime checks. +/// # Safety +/// +/// Implementers must ensure that all trait functions abide by the +/// guarantees documented in the `# Guarantees` sections. The provided +/// methods automatically satisfy their guarantees. pub unsafe trait Searcher<'a> { /// Getter for the underlying string to be searched in /// + /// # Guarantees + /// /// Will always return the same [`&str`][str]. fn haystack(&self) -> &'a str; @@ -225,10 +238,13 @@ pub unsafe trait Searcher<'a> { /// - Returns [`Done`][SearchStep::Done] if every byte of the haystack has /// been visited. /// - /// The stream of [`Match`][SearchStep::Match] and - /// [`Reject`][SearchStep::Reject] values up to a [`Done`][SearchStep::Done] - /// will contain index ranges that are adjacent, non-overlapping, - /// covering the whole haystack, and laying on utf8 boundaries. + /// # Guarantees + /// + /// - The stream of [`Match`][SearchStep::Match] and + /// [`Reject`][SearchStep::Reject] values up to a [`Done`][SearchStep::Done] + /// will contain index ranges that are adjacent, non-overlapping, + /// covering the whole haystack, and lying on utf8 boundaries. This enables + /// consumers of this trait to slice the haystack without additional runtime checks. /// /// A [`Match`][SearchStep::Match] result needs to contain the whole matched /// pattern, however [`Reject`][SearchStep::Reject] results may be split up @@ -241,8 +257,15 @@ pub unsafe trait Searcher<'a> { /// Finds the next [`Match`][SearchStep::Match] result. See [`next()`][Searcher::next]. /// + /// # Guarantees + /// + /// - Every returned `Some((a, b))` must satisfy `a <= b <= self.haystack().len()`, + /// and both endpoints must lie on UTF-8 character boundaries. + /// - Matched ranges must be returned in forward order, without revisiting + /// previously consumed portions of the haystack. + /// /// Unlike [`next()`][Searcher::next], there is no guarantee that the returned ranges - /// of this and [`next_reject`][Searcher::next_reject] will overlap. This will return + /// of this and [`next_reject`][Searcher::next_reject] will not overlap. This will return /// `(start_match, end_match)`, where start_match is the index of where /// the match begins, and end_match is the index after the end of the match. #[inline] @@ -259,6 +282,13 @@ pub unsafe trait Searcher<'a> { /// Finds the next [`Reject`][SearchStep::Reject] result. See [`next()`][Searcher::next] /// and [`next_match()`][Searcher::next_match]. /// + /// # Guarantees + /// + /// - Every returned `Some((a, b))` must satisfy `a <= b <= self.haystack().len()`, + /// and both endpoints must lie on UTF-8 character boundaries. + /// - Matched ranges must be returned in forward order, without revisiting + /// previously consumed portions of the haystack. + /// /// Unlike [`next()`][Searcher::next], there is no guarantee that the returned ranges /// of this and [`next_match`][Searcher::next_match] will overlap. #[inline] @@ -285,8 +315,11 @@ pub unsafe trait Searcher<'a> { /// The index ranges returned by this trait are not required /// to exactly match those of the forward search in reverse. /// -/// For the reason why this trait is marked unsafe, see the -/// parent trait [`Searcher`]. +/// # Safety +/// +/// Implementers must ensure that all trait functions abide by the +/// guarantees documented in the `# Guarantees` sections. The provided +/// methods automatically satisfy their guarantees. pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { /// Performs the next search step starting from the back. /// @@ -297,10 +330,12 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { /// - Returns [`Done`][SearchStep::Done] if every byte of the haystack /// has been visited /// - /// The stream of [`Match`][SearchStep::Match] and - /// [`Reject`][SearchStep::Reject] values up to a [`Done`][SearchStep::Done] - /// will contain index ranges that are adjacent, non-overlapping, - /// covering the whole haystack, and laying on utf8 boundaries. + /// # Guarantees + /// + /// - The stream of [`Match`][SearchStep::Match] and + /// [`Reject`][SearchStep::Reject] values up to a [`Done`][SearchStep::Done] + /// will contain index ranges that are adjacent, non-overlapping, + /// covering the whole haystack, and lying on utf8 boundaries. /// /// A [`Match`][SearchStep::Match] result needs to contain the whole matched /// pattern, however [`Reject`][SearchStep::Reject] results may be split up @@ -311,8 +346,14 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { /// `[Reject(7, 8), Match(4, 7), Reject(1, 4), Reject(0, 1)]`. fn next_back(&mut self) -> SearchStep; - /// Finds the next [`Match`][SearchStep::Match] result. - /// See [`next_back()`][ReverseSearcher::next_back]. + /// Finds the next [`Match`][SearchStep::Match] result. See [`next_back()`][ReverseSearcher::next_back]. + /// + /// # Guarantees + /// + /// - Every returned `Some((a, b))` must satisfy `a <= b <= self.haystack().len()`, + /// and both endpoints must lie on UTF-8 character boundaries. + /// - Matched ranges must be returned in forward order, without revisiting + /// previously consumed portions of the haystack. #[inline] fn next_match_back(&mut self) -> Option<(usize, usize)> { loop { @@ -324,8 +365,14 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { } } - /// Finds the next [`Reject`][SearchStep::Reject] result. - /// See [`next_back()`][ReverseSearcher::next_back]. + /// Finds the next [`Reject`][SearchStep::Reject] result. See [`next_back()`][ReverseSearcher::next_back]. + /// + /// # Guarantees + /// + /// - Every returned `Some((a, b))` must satisfy `a <= b <= self.haystack().len()`, + /// and both endpoints must lie on UTF-8 character boundaries. + /// - Matched ranges must be returned in forward order, without revisiting + /// previously consumed portions of the haystack. #[inline] fn next_reject_back(&mut self) -> Option<(usize, usize)> { loop { @@ -559,7 +606,7 @@ impl<'a> DoubleEndedSearcher<'a> for CharSearcher<'a> {} /// ``` /// assert_eq!("Hello world".find('o'), Some(4)); /// ``` -impl Pattern for char { +unsafe impl Pattern for char { type Searcher<'a> = CharSearcher<'a>; #[inline] @@ -672,7 +719,7 @@ struct MultiCharEqSearcher<'a, C: MultiCharEq> { char_indices: super::CharIndices<'a>, } -impl Pattern for MultiCharEqPattern { +unsafe impl Pattern for MultiCharEqPattern { type Searcher<'a> = MultiCharEqSearcher<'a, C>; #[inline] @@ -827,7 +874,7 @@ pub struct CharArrayRefSearcher<'a, 'b, const N: usize>( /// assert_eq!("Hello world".find(['o', 'l']), Some(2)); /// assert_eq!("Hello world".find(['h', 'w']), Some(6)); /// ``` -impl Pattern for [char; N] { +unsafe impl Pattern for [char; N] { pattern_methods!('a, CharArraySearcher<'a, N>, MultiCharEqPattern, CharArraySearcher); } @@ -849,7 +896,7 @@ impl<'a, const N: usize> DoubleEndedSearcher<'a> for CharArraySearcher<'a, N> {} /// assert_eq!("Hello world".find(&['o', 'l']), Some(2)); /// assert_eq!("Hello world".find(&['h', 'w']), Some(6)); /// ``` -impl<'b, const N: usize> Pattern for &'b [char; N] { +unsafe impl<'b, const N: usize> Pattern for &'b [char; N] { pattern_methods!('a, CharArrayRefSearcher<'a, 'b, N>, MultiCharEqPattern, CharArrayRefSearcher); } @@ -891,7 +938,7 @@ impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b> {} /// assert_eq!("Hello world".find(&['o', 'l'][..]), Some(2)); /// assert_eq!("Hello world".find(&['h', 'w'][..]), Some(6)); /// ``` -impl<'b> Pattern for &'b [char] { +unsafe impl<'b> Pattern for &'b [char] { pattern_methods!('a, CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher); } @@ -940,7 +987,7 @@ impl<'a, F> DoubleEndedSearcher<'a> for CharPredicateSearcher<'a, F> where F: Fn /// assert_eq!("Hello world".find(char::is_uppercase), Some(0)); /// assert_eq!("Hello world".find(|c| "aeiou".contains(c)), Some(1)); /// ``` -impl Pattern for F +unsafe impl Pattern for F where F: FnMut(char) -> bool, { @@ -952,7 +999,7 @@ where ///////////////////////////////////////////////////////////////////////////// /// Delegates to the `&str` impl. -impl<'b, 'c> Pattern for &'c &'b str { +unsafe impl<'b, 'c> Pattern for &'c &'b str { pattern_methods!('a, StrSearcher<'a, 'b>, |&s| s, |s| s); } @@ -970,7 +1017,7 @@ impl<'b, 'c> Pattern for &'c &'b str { /// ``` /// assert_eq!("Hello world".find("world"), Some(6)); /// ``` -impl<'b> Pattern for &'b str { +unsafe impl<'b> Pattern for &'b str { type Searcher<'a> = StrSearcher<'a, 'b>; #[inline]