From 2bb00741d463143a10e632bb118d4ed336dbb75f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 19 Jul 2025 11:28:31 +0200 Subject: [PATCH 01/13] pattern_analysis: add option to get a full set of witnesses --- .../rustc_pattern_analysis/src/constructor.rs | 4 +- compiler/rustc_pattern_analysis/src/lib.rs | 7 ++ .../rustc_pattern_analysis/src/usefulness.rs | 4 +- .../tests/common/mod.rs | 21 ++++- .../tests/complexity.rs | 2 +- .../tests/exhaustiveness.rs | 92 ++++++++++++++++++- .../tests/intersection.rs | 2 +- 7 files changed, 116 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 09685640e5022..9a9e0db964c96 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -950,9 +950,7 @@ impl Constructor { } } Never => write!(f, "!")?, - Wildcard | Missing | NonExhaustive | Hidden | PrivateUninhabited => { - write!(f, "_ : {:?}", ty)? - } + Wildcard | Missing | NonExhaustive | Hidden | PrivateUninhabited => write!(f, "_")?, } Ok(()) } diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 66df35f9ee45f..d9bb93a829b59 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -57,6 +57,13 @@ pub trait PatCx: Sized + fmt::Debug { fn is_exhaustive_patterns_feature_on(&self) -> bool; + /// Whether to ensure the non-exhaustiveness witnesses we report for a complete set. This is + /// `false` by default to avoid some exponential blowup cases such as + /// . + fn exhaustive_witnesses(&self) -> bool { + false + } + /// The number of fields for this constructor. fn ctor_arity(&self, ctor: &Constructor, ty: &Self::Ty) -> usize; diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index b1c646e98840d..91377b2f2bdb3 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -1747,7 +1747,9 @@ fn compute_exhaustiveness_and_usefulness<'a, 'p, Cx: PatCx>( // `ctor` is *irrelevant* if there's another constructor in `split_ctors` that matches // strictly fewer rows. In that case we can sometimes skip it. See the top of the file for // details. - let ctor_is_relevant = matches!(ctor, Constructor::Missing) || missing_ctors.is_empty(); + let ctor_is_relevant = matches!(ctor, Constructor::Missing) + || missing_ctors.is_empty() + || mcx.tycx.exhaustive_witnesses(); let mut spec_matrix = matrix.specialize_constructor(pcx, &ctor, ctor_is_relevant)?; let mut witnesses = ensure_sufficient_stack(|| { compute_exhaustiveness_and_usefulness(mcx, &mut spec_matrix) diff --git a/compiler/rustc_pattern_analysis/tests/common/mod.rs b/compiler/rustc_pattern_analysis/tests/common/mod.rs index 0b939ef781659..7f2c2afcb5b2e 100644 --- a/compiler/rustc_pattern_analysis/tests/common/mod.rs +++ b/compiler/rustc_pattern_analysis/tests/common/mod.rs @@ -126,10 +126,11 @@ pub(super) fn compute_match_usefulness<'p>( ty: Ty, scrut_validity: PlaceValidity, complexity_limit: usize, + exhaustive_witnesses: bool, ) -> Result, ()> { init_tracing(); rustc_pattern_analysis::usefulness::compute_match_usefulness( - &Cx, + &Cx { exhaustive_witnesses }, arms, ty, scrut_validity, @@ -138,7 +139,9 @@ pub(super) fn compute_match_usefulness<'p>( } #[derive(Debug)] -pub(super) struct Cx; +pub(super) struct Cx { + exhaustive_witnesses: bool, +} /// The context for pattern analysis. Forwards anything interesting to `Ty` methods. impl PatCx for Cx { @@ -153,6 +156,10 @@ impl PatCx for Cx { false } + fn exhaustive_witnesses(&self) -> bool { + self.exhaustive_witnesses + } + fn ctor_arity(&self, ctor: &Constructor, ty: &Self::Ty) -> usize { ty.sub_tys(ctor).len() } @@ -219,16 +226,18 @@ macro_rules! pats { // Entrypoint // Parse `type; ..` ($ty:expr; $($rest:tt)*) => {{ - #[allow(unused_imports)] + #[allow(unused)] use rustc_pattern_analysis::{ constructor::{Constructor, IntRange, MaybeInfiniteInt, RangeEnd}, - pat::DeconstructedPat, + pat::{DeconstructedPat, IndexedPat}, }; let ty = $ty; // The heart of the macro is designed to push `IndexedPat`s into a `Vec`, so we work around // that. + #[allow(unused)] let sub_tys = ::std::iter::repeat(&ty); - let mut vec = Vec::new(); + #[allow(unused)] + let mut vec: Vec> = Vec::new(); pats!(@ctor(vec:vec, sub_tys:sub_tys, idx:0) $($rest)*); vec.into_iter().map(|ipat| ipat.pat).collect::>() }}; @@ -263,6 +272,8 @@ macro_rules! pats { let ctor = Constructor::Wildcard; pats!(@pat($($args)*, ctor:ctor) $($rest)*) }}; + // Nothing + (@ctor($($args:tt)*)) => {}; // Integers and int ranges (@ctor($($args:tt)*) $($start:literal)?..$end:literal $($rest:tt)*) => {{ diff --git a/compiler/rustc_pattern_analysis/tests/complexity.rs b/compiler/rustc_pattern_analysis/tests/complexity.rs index 93aecafe48d59..4754476f3834c 100644 --- a/compiler/rustc_pattern_analysis/tests/complexity.rs +++ b/compiler/rustc_pattern_analysis/tests/complexity.rs @@ -16,7 +16,7 @@ fn check(patterns: &[DeconstructedPat], complexity_limit: usize) -> Result<( let ty = *patterns[0].ty(); let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, complexity_limit) + compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, complexity_limit, false) .map(|_report| ()) } diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs index 3b8f346ef1949..961693f79c3c0 100644 --- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs +++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs @@ -11,16 +11,30 @@ use rustc_pattern_analysis::usefulness::PlaceValidity; mod common; /// Analyze a match made of these patterns. -fn check(patterns: Vec>) -> Vec> { - let ty = *patterns[0].ty(); +fn run( + ty: Ty, + patterns: Vec>, + exhaustive_witnesses: bool, +) -> Vec> { let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); - let report = - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, usize::MAX) - .unwrap(); + let report = compute_match_usefulness( + arms.as_slice(), + ty, + PlaceValidity::ValidOnly, + usize::MAX, + exhaustive_witnesses, + ) + .unwrap(); report.non_exhaustiveness_witnesses } +/// Analyze a match made of these patterns. Panics if there are no patterns +fn check(patterns: Vec>) -> Vec> { + let ty = *patterns[0].ty(); + run(ty, patterns, true) +} + #[track_caller] fn assert_exhaustive(patterns: Vec>) { let witnesses = check(patterns); @@ -35,6 +49,26 @@ fn assert_non_exhaustive(patterns: Vec>) { assert!(!witnesses.is_empty()) } +use WhichWitnesses::*; +enum WhichWitnesses { + AllOfThem, + OnlySome, +} + +#[track_caller] +/// We take the type as input to support empty matches. +fn assert_witnesses( + which: WhichWitnesses, + ty: Ty, + patterns: Vec>, + expected: Vec<&str>, +) { + let exhaustive_wit = matches!(which, AllOfThem); + let witnesses = run(ty, patterns, exhaustive_wit); + let witnesses: Vec<_> = witnesses.iter().map(|w| format!("{w:?}")).collect(); + assert_eq!(witnesses, expected) +} + #[test] fn test_int_ranges() { let ty = Ty::U8; @@ -59,6 +93,8 @@ fn test_int_ranges() { #[test] fn test_nested() { + // enum E { A(bool), B(bool) } + // ty = (E, E) let ty = Ty::BigStruct { arity: 2, ty: &Ty::BigEnum { arity: 2, ty: &Ty::Bool } }; assert_non_exhaustive(pats!(ty; Struct(Variant.0, _), @@ -78,6 +114,52 @@ fn test_nested() { )); } +#[test] +fn test_witnesses() { + // TY = Option + const TY: Ty = Ty::Enum(&[Ty::Bool, Ty::Tuple(&[])]); + // ty = (Option, Option) + let ty = Ty::Tuple(&[TY, TY]); + assert_witnesses(AllOfThem, ty, vec![], vec!["(_, _)"]); + assert_witnesses( + OnlySome, + ty, + pats!(ty; + (Variant.0(false), Variant.0(false)), + ), + vec!["(Enum::Variant1(_), _)"], + ); + assert_witnesses( + AllOfThem, + ty, + pats!(ty; + (Variant.0(false), Variant.0(false)), + ), + vec![ + "(Enum::Variant0(false), Enum::Variant0(true))", + "(Enum::Variant0(false), Enum::Variant1(_))", + "(Enum::Variant0(true), _)", + "(Enum::Variant1(_), _)", + ], + ); + assert_witnesses( + OnlySome, + ty, + pats!(ty; + (_, Variant.0(false)), + ), + vec!["(_, Enum::Variant1(_))"], + ); + assert_witnesses( + AllOfThem, + ty, + pats!(ty; + (_, Variant.0(false)), + ), + vec!["(_, Enum::Variant0(true))", "(_, Enum::Variant1(_))"], + ); +} + #[test] fn test_empty() { // `TY = Result` diff --git a/compiler/rustc_pattern_analysis/tests/intersection.rs b/compiler/rustc_pattern_analysis/tests/intersection.rs index 8e6f84dcbc8e1..d4d390517e259 100644 --- a/compiler/rustc_pattern_analysis/tests/intersection.rs +++ b/compiler/rustc_pattern_analysis/tests/intersection.rs @@ -16,7 +16,7 @@ fn check(patterns: Vec>) -> Vec> { let arms: Vec<_> = patterns.iter().map(|pat| MatchArm { pat, has_guard: false, arm_data: () }).collect(); let report = - compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, usize::MAX) + compute_match_usefulness(arms.as_slice(), ty, PlaceValidity::ValidOnly, usize::MAX, false) .unwrap(); report.arm_intersections.into_iter().map(|bitset| bitset.iter().collect()).collect() } From 9b01de20e10376d379ae32baa6a315d8e30cb351 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 19 Jul 2025 21:18:14 +0200 Subject: [PATCH 02/13] List all the variants of non-exhaustive enums in exhaustive mode --- .../rustc_pattern_analysis/src/usefulness.rs | 3 ++- .../tests/common/mod.rs | 27 ++++++++++++++++--- .../tests/exhaustiveness.rs | 22 +++++++++++++-- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 91377b2f2bdb3..19446a1efe9cb 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -994,7 +994,8 @@ impl PlaceInfo { if !missing_ctors.is_empty() && !report_individual_missing_ctors { // Report `_` as missing. missing_ctors = vec![Constructor::Wildcard]; - } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) { + } else if missing_ctors.iter().any(|c| c.is_non_exhaustive()) && !cx.exhaustive_witnesses() + { // We need to report a `_` anyway, so listing other constructors would be redundant. // `NonExhaustive` is displayed as `_` just like `Wildcard`, but it will be picked // up by diagnostics to add a note about why `_` is required here. diff --git a/compiler/rustc_pattern_analysis/tests/common/mod.rs b/compiler/rustc_pattern_analysis/tests/common/mod.rs index 7f2c2afcb5b2e..8497521881a25 100644 --- a/compiler/rustc_pattern_analysis/tests/common/mod.rs +++ b/compiler/rustc_pattern_analysis/tests/common/mod.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use rustc_pattern_analysis::constructor::{ Constructor, ConstructorSet, IntRange, MaybeInfiniteInt, RangeEnd, VariantVisibility, }; @@ -22,8 +23,10 @@ fn init_tracing() { .try_init(); } +pub const UNIT: Ty = Ty::Tuple(&[]); +pub const NEVER: Ty = Ty::Enum(&[]); + /// A simple set of types. -#[allow(dead_code)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub(super) enum Ty { /// Booleans @@ -38,6 +41,8 @@ pub(super) enum Ty { BigStruct { arity: usize, ty: &'static Ty }, /// A enum with `arity` variants of type `ty`. BigEnum { arity: usize, ty: &'static Ty }, + /// Like `Enum` but non-exhaustive. + NonExhaustiveEnum(&'static [Ty]), } /// The important logic. @@ -47,7 +52,7 @@ impl Ty { match (ctor, *self) { (Struct, Ty::Tuple(tys)) => tys.iter().copied().collect(), (Struct, Ty::BigStruct { arity, ty }) => (0..arity).map(|_| *ty).collect(), - (Variant(i), Ty::Enum(tys)) => vec![tys[*i]], + (Variant(i), Ty::Enum(tys) | Ty::NonExhaustiveEnum(tys)) => vec![tys[*i]], (Variant(_), Ty::BigEnum { ty, .. }) => vec![*ty], (Bool(..) | IntRange(..) | NonExhaustive | Missing | Wildcard, _) => vec![], _ => panic!("Unexpected ctor {ctor:?} for type {self:?}"), @@ -61,6 +66,7 @@ impl Ty { Ty::Enum(tys) => tys.iter().all(|ty| ty.is_empty()), Ty::BigStruct { arity, ty } => arity != 0 && ty.is_empty(), Ty::BigEnum { arity, ty } => arity == 0 || ty.is_empty(), + Ty::NonExhaustiveEnum(..) => false, } } @@ -90,6 +96,19 @@ impl Ty { .collect(), non_exhaustive: false, }, + Ty::NonExhaustiveEnum(tys) => ConstructorSet::Variants { + variants: tys + .iter() + .map(|ty| { + if ty.is_empty() { + VariantVisibility::Empty + } else { + VariantVisibility::Visible + } + }) + .collect(), + non_exhaustive: true, + }, Ty::BigEnum { arity: 0, .. } => ConstructorSet::NoConstructors, Ty::BigEnum { arity, ty } => { let vis = if ty.is_empty() { @@ -113,7 +132,9 @@ impl Ty { match (*self, ctor) { (Ty::Tuple(..), _) => Ok(()), (Ty::BigStruct { .. }, _) => write!(f, "BigStruct"), - (Ty::Enum(..), Constructor::Variant(i)) => write!(f, "Enum::Variant{i}"), + (Ty::Enum(..) | Ty::NonExhaustiveEnum(..), Constructor::Variant(i)) => { + write!(f, "Enum::Variant{i}") + } (Ty::BigEnum { .. }, Constructor::Variant(i)) => write!(f, "BigEnum::Variant{i}"), _ => write!(f, "{:?}::{:?}", self, ctor), } diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs index 961693f79c3c0..14ca0d057f06e 100644 --- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs +++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs @@ -117,7 +117,7 @@ fn test_nested() { #[test] fn test_witnesses() { // TY = Option - const TY: Ty = Ty::Enum(&[Ty::Bool, Ty::Tuple(&[])]); + const TY: Ty = Ty::Enum(&[Ty::Bool, UNIT]); // ty = (Option, Option) let ty = Ty::Tuple(&[TY, TY]); assert_witnesses(AllOfThem, ty, vec![], vec!["(_, _)"]); @@ -158,12 +158,30 @@ fn test_witnesses() { ), vec!["(_, Enum::Variant0(true))", "(_, Enum::Variant1(_))"], ); + + let ty = Ty::NonExhaustiveEnum(&[UNIT, UNIT, UNIT]); + assert_witnesses( + OnlySome, + ty, + pats!(ty; + Variant.0, + ), + vec!["_"], + ); + assert_witnesses( + AllOfThem, + ty, + pats!(ty; + Variant.0, + ), + vec!["Enum::Variant1(_)", "Enum::Variant2(_)", "_"], + ); } #[test] fn test_empty() { // `TY = Result` - const TY: Ty = Ty::Enum(&[Ty::Bool, Ty::Enum(&[])]); + const TY: Ty = Ty::Enum(&[Ty::Bool, NEVER]); assert_exhaustive(pats!(TY; Variant.0, )); From af07c08c60fe779c2e73c561403cb5edf4f15e9b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 19 Jul 2025 22:14:12 +0200 Subject: [PATCH 03/13] Silence a warning --- compiler/rustc_pattern_analysis/tests/common/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_pattern_analysis/tests/common/mod.rs b/compiler/rustc_pattern_analysis/tests/common/mod.rs index 8497521881a25..94f2a127b9b0a 100644 --- a/compiler/rustc_pattern_analysis/tests/common/mod.rs +++ b/compiler/rustc_pattern_analysis/tests/common/mod.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] +#![allow(dead_code, unreachable_pub)] use rustc_pattern_analysis::constructor::{ Constructor, ConstructorSet, IntRange, MaybeInfiniteInt, RangeEnd, VariantVisibility, }; @@ -23,8 +23,8 @@ fn init_tracing() { .try_init(); } -pub const UNIT: Ty = Ty::Tuple(&[]); -pub const NEVER: Ty = Ty::Enum(&[]); +pub(super) const UNIT: Ty = Ty::Tuple(&[]); +pub(super) const NEVER: Ty = Ty::Enum(&[]); /// A simple set of types. #[derive(Debug, Copy, Clone, PartialEq, Eq)] From a9fd8d041bf40b0b2425ad79062d09a441352efa Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Tue, 22 Jul 2025 19:00:32 +0200 Subject: [PATCH 04/13] bootstrap: Move musl-root fallback out of sanity check Previously, the musl root would only be set to the fallback /usr by the sanity check, which isn't ran for the bootstrap tests. Signed-off-by: Jens Reidel --- src/bootstrap/src/core/sanity.rs | 6 ------ src/bootstrap/src/lib.rs | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index b39d464493e56..15e04f591296c 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -338,12 +338,6 @@ than building it. // Make sure musl-root is valid. if target.contains("musl") && !target.contains("unikraft") { - // If this is a native target (host is also musl) and no musl-root is given, - // fall back to the system toolchain in /usr before giving up - if build.musl_root(*target).is_none() && build.config.is_host_target(*target) { - let target = build.config.target_config.entry(*target).or_default(); - target.musl_root = Some("/usr".into()); - } match build.musl_libdir(*target) { Some(libdir) => { if fs::metadata(libdir.join("libc.a")).is_err() { diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 63aab4d116a93..2aee9f0728449 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1329,23 +1329,33 @@ impl Build { } } - /// Returns the "musl root" for this `target`, if defined + /// Returns the "musl root" for this `target`, if defined. + /// + /// If this is a native target (host is also musl) and no musl-root is given, + /// it falls back to the system toolchain in /usr. fn musl_root(&self, target: TargetSelection) -> Option<&Path> { - self.config + let configured_root = self + .config .target_config .get(&target) .and_then(|t| t.musl_root.as_ref()) .or(self.config.musl_root.as_ref()) - .map(|p| &**p) + .map(|p| &**p); + + if self.config.is_host_target(target) && configured_root.is_none() { + return Some(Path::new("/usr")); + } else { + configured_root + } } /// Returns the "musl libdir" for this `target`. fn musl_libdir(&self, target: TargetSelection) -> Option { - let t = self.config.target_config.get(&target)?; - if let libdir @ Some(_) = &t.musl_libdir { - return libdir.clone(); - } - self.musl_root(target).map(|root| root.join("lib")) + self.config + .target_config + .get(&target) + .and_then(|t| t.musl_libdir.clone()) + .or_else(|| self.musl_root(target).map(|root| root.join("lib"))) } /// Returns the `lib` directory for the WASI target specified, if From 3d186ea611c9dd1360d1fee15f08d718b601384f Mon Sep 17 00:00:00 2001 From: Caiweiran Date: Wed, 23 Jul 2025 11:14:07 +0000 Subject: [PATCH 05/13] Fix tests/assembly-llvm/dwarf-mixed-versions-lto.rs test failure on riscv64 --- tests/assembly-llvm/dwarf-mixed-versions-lto.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/assembly-llvm/dwarf-mixed-versions-lto.rs b/tests/assembly-llvm/dwarf-mixed-versions-lto.rs index 9910a6e2f5fcc..828328df84330 100644 --- a/tests/assembly-llvm/dwarf-mixed-versions-lto.rs +++ b/tests/assembly-llvm/dwarf-mixed-versions-lto.rs @@ -1,6 +1,7 @@ // This test ensures that if LTO occurs between crates with different DWARF versions, we // will choose the highest DWARF version for the final binary. This matches Clang's behavior. // Note: `.2byte` directive is used on MIPS. +// Note: `.half` directive is used on RISC-V. //@ only-linux //@ aux-build:dwarf-mixed-versions-lto-aux.rs @@ -15,6 +16,6 @@ fn main() { } // CHECK: .section .debug_info -// CHECK-NOT: {{\.(short|hword|2byte)}} 2 -// CHECK-NOT: {{\.(short|hword|2byte)}} 4 -// CHECK: {{\.(short|hword|2byte)}} 5 +// CHECK-NOT: {{\.(short|hword|2byte|half)}} 2 +// CHECK-NOT: {{\.(short|hword|2byte|half)}} 4 +// CHECK: {{\.(short|hword|2byte|half)}} 5 From 2e49c52855c6a726d4f42705fe42d3c237f14b32 Mon Sep 17 00:00:00 2001 From: Caiweiran Date: Wed, 23 Jul 2025 11:23:36 +0000 Subject: [PATCH 06/13] Fix tests/codegen-llvm/const-vector.rs test failure on riscv64 --- tests/codegen-llvm/const-vector.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/codegen-llvm/const-vector.rs b/tests/codegen-llvm/const-vector.rs index a2249f4fff7bf..f430749234111 100644 --- a/tests/codegen-llvm/const-vector.rs +++ b/tests/codegen-llvm/const-vector.rs @@ -15,6 +15,7 @@ #![feature(arm_target_feature)] #![feature(mips_target_feature)] #![allow(non_camel_case_types)] +#![feature(riscv_target_feature)] #[path = "../auxiliary/minisimd.rs"] mod minisimd; @@ -42,6 +43,7 @@ extern "unadjusted" { #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))] #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))] #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))] +#[cfg_attr(target_arch = "riscv64", target_feature(enable = "v"))] pub fn do_call() { unsafe { // CHECK: call void @test_i8x2(<2 x i8> From de93fb13feeb6263bef61d4035e78ab8651c5714 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 23 Jul 2025 13:31:22 +0200 Subject: [PATCH 07/13] Add `ignore-backends` annotations in failing GCC backend ui tests --- .../allocator/no_std-alloc-error-handler-custom.rs | 1 + .../allocator/no_std-alloc-error-handler-default.rs | 1 + tests/ui/asm/may_unwind.rs | 1 + tests/ui/asm/x86_64/may_unwind.rs | 1 + tests/ui/async-await/deep-futures-are-freeze.rs | 1 + .../dont-project-to-specializable-projection.rs | 1 + .../dont-project-to-specializable-projection.stderr | 8 ++++---- tests/ui/backtrace/dylib-dep.rs | 1 + tests/ui/cfg/cfg-panic-abort.rs | 1 + .../StackColoring-not-blowup-stack-issue-40883.rs | 2 ++ .../equal-pointers-unequal/as-cast/inline1.rs | 1 + .../equal-pointers-unequal/as-cast/inline2.rs | 1 + .../equal-pointers-unequal/as-cast/segfault.rs | 1 + .../codegen/equal-pointers-unequal/as-cast/zero.rs | 1 + .../exposed-provenance/inline1.rs | 1 + .../exposed-provenance/inline2.rs | 1 + .../exposed-provenance/segfault.rs | 1 + .../exposed-provenance/zero.rs | 1 + .../strict-provenance/inline1.rs | 1 + .../strict-provenance/inline2.rs | 1 + .../strict-provenance/segfault.rs | 1 + .../equal-pointers-unequal/strict-provenance/zero.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 | 6 +++--- 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 + tests/ui/consts/missing_span_in_backtrace.stderr | 12 ++++++------ tests/ui/consts/try-operator.rs | 1 + tests/ui/coroutine/panic-drops-resume.rs | 1 + tests/ui/coroutine/panic-drops.rs | 1 + tests/ui/coroutine/panic-safe.rs | 2 +- tests/ui/coroutine/resume-after-return.rs | 1 + tests/ui/coroutine/unwind-abort-mix.rs | 1 + tests/ui/delegation/fn-header.rs | 1 + tests/ui/drop/dynamic-drop-async.rs | 1 + tests/ui/drop/dynamic-drop.rs | 1 + tests/ui/intrinsics/panic-uninitialized-zeroed.rs | 1 + tests/ui/issues/issue-14875.rs | 1 + tests/ui/issues/issue-29948.rs | 1 + tests/ui/iterators/iter-sum-overflow-debug.rs | 1 + .../iterators/iter-sum-overflow-overflow-checks.rs | 1 + tests/ui/lto/all-crates.rs | 1 + tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs | 1 + tests/ui/lto/thin-lto-inlines2.rs | 1 + tests/ui/mir/mir_drop_order.rs | 1 + tests/ui/mir/mir_let_chains_drop_order.rs | 1 + .../ui/mir/mir_match_guard_let_chains_drop_order.rs | 1 + tests/ui/numbers-arithmetic/u128-as-f32.rs | 1 + .../panic-runtime/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/panic-runtime/lto-abort.rs | 1 + tests/ui/parser/unclosed-delimiter-in-dep.rs | 2 ++ tests/ui/process/nofile-limit.rs | 2 ++ tests/ui/process/println-with-broken-pipe.rs | 1 + .../rfc-2091-track-caller/std-panic-locations.rs | 1 + tests/ui/runtime/on-broken-pipe/child-processes.rs | 1 + tests/ui/runtime/rt-explody-panic-payloads.rs | 1 + .../sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs | 1 + tests/ui/sanitizer/cfi/async-closures.rs | 1 + tests/ui/sanitizer/cfi/can-reveal-opaques.rs | 1 + tests/ui/sanitizer/cfi/closures.rs | 1 + tests/ui/sanitizer/cfi/complex-receiver.rs | 1 + tests/ui/sanitizer/cfi/coroutine.rs | 1 + tests/ui/sanitizer/cfi/drop-in-place.rs | 1 + tests/ui/sanitizer/cfi/drop-no-principal.rs | 1 + tests/ui/sanitizer/cfi/fn-ptr.rs | 1 + tests/ui/sanitizer/cfi/self-ref.rs | 1 + tests/ui/sanitizer/cfi/sized-associated-ty.rs | 1 + tests/ui/sanitizer/cfi/supertraits.rs | 1 + tests/ui/sanitizer/cfi/virtual-auto.rs | 1 + tests/ui/sanitizer/kcfi-mangling.rs | 1 + tests/ui/simd/intrinsic/generic-arithmetic-pass.rs | 2 ++ tests/ui/simd/intrinsic/generic-as.rs | 1 + tests/ui/simd/issue-17170.rs | 2 ++ tests/ui/simd/issue-39720.rs | 1 + tests/ui/simd/masked-load-store.rs | 1 + tests/ui/simd/repr_packed.rs | 1 + tests/ui/simd/simd-bitmask-notpow2.rs | 2 ++ tests/ui/statics/const_generics.rs | 1 + .../const-traits/const-drop-fail.new_precise.stderr | 8 ++++---- .../const-traits/const-drop-fail.new_stock.stderr | 8 ++++---- .../const-traits/const-drop-fail.old_precise.stderr | 8 ++++---- .../const-traits/const-drop-fail.old_stock.stderr | 8 ++++---- tests/ui/traits/const-traits/const-drop-fail.rs | 1 + .../uninhabited-transparent-return-abi.rs | 1 + 92 files changed, 123 insertions(+), 34 deletions(-) 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 1b0f0608fc61b..7b7ca2f6cc6bd 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-custom.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-custom.rs @@ -2,6 +2,7 @@ //@ 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 51ecf1a6731ac..5a6c0b33d5108 100644 --- a/tests/ui/allocator/no_std-alloc-error-handler-default.rs +++ b/tests/ui/allocator/no_std-alloc-error-handler-default.rs @@ -2,6 +2,7 @@ //@ 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/asm/may_unwind.rs b/tests/ui/asm/may_unwind.rs index 1d4f50d5fe89d..0fef317a2cfd1 100644 --- a/tests/ui/asm/may_unwind.rs +++ b/tests/ui/asm/may_unwind.rs @@ -1,6 +1,7 @@ //@ run-pass //@ needs-asm-support //@ needs-unwind +//@ ignore-backends: gcc #![feature(asm_unwind)] diff --git a/tests/ui/asm/x86_64/may_unwind.rs b/tests/ui/asm/x86_64/may_unwind.rs index d3a2916df9db6..9657f49ab3087 100644 --- a/tests/ui/asm/x86_64/may_unwind.rs +++ b/tests/ui/asm/x86_64/may_unwind.rs @@ -2,6 +2,7 @@ //@ run-pass //@ needs-asm-support //@ needs-unwind +//@ ignore-backends: gcc #![feature(asm_unwind)] diff --git a/tests/ui/async-await/deep-futures-are-freeze.rs b/tests/ui/async-await/deep-futures-are-freeze.rs index c4300163db1a4..79dbc033bf74b 100644 --- a/tests/ui/async-await/deep-futures-are-freeze.rs +++ b/tests/ui/async-await/deep-futures-are-freeze.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ build-pass //@ compile-flags: -Copt-level=s -Clto=fat //@ no-prefer-dynamic 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 4bafb39f60096..d6180bb2f45d8 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,3 +1,4 @@ +//@ 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 62cca41f6cfd8..3d82f572a1a69 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,11 +1,11 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/dont-project-to-specializable-projection.rs:13:5 + --> $DIR/dont-project-to-specializable-projection.rs:14:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found future | note: type in trait - --> $DIR/dont-project-to-specializable-projection.rs:9:5 + --> $DIR/dont-project-to-specializable-projection.rs:10:5 | LL | async fn foo(_: T) -> &'static str; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,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:13:5 + --> $DIR/dont-project-to-specializable-projection.rs:14:5 | LL | default async fn foo(_: T) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,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:48:28 + --> $DIR/dont-project-to-specializable-projection.rs:49:28 | LL | match fut.as_mut().poll(ctx) { | ^^^^ method not found in `Pin<&mut impl Future>` diff --git a/tests/ui/backtrace/dylib-dep.rs b/tests/ui/backtrace/dylib-dep.rs index a41931ad54891..05fdb9afef80d 100644 --- a/tests/ui/backtrace/dylib-dep.rs +++ b/tests/ui/backtrace/dylib-dep.rs @@ -8,6 +8,7 @@ //@ ignore-fuchsia Backtraces not symbolized //@ ignore-musl musl doesn't support dynamic libraries (at least when the original test was written). //@ needs-unwind +//@ ignore-backends: gcc //@ compile-flags: -g -Copt-level=0 -Cstrip=none -Cforce-frame-pointers=yes //@ ignore-emscripten Requires custom symbolization code //@ aux-crate: dylib_dep_helper=dylib-dep-helper.rs diff --git a/tests/ui/cfg/cfg-panic-abort.rs b/tests/ui/cfg/cfg-panic-abort.rs index 448fde2108668..b39888573b3a6 100644 --- a/tests/ui/cfg/cfg-panic-abort.rs +++ b/tests/ui/cfg/cfg-panic-abort.rs @@ -1,6 +1,7 @@ //@ build-pass //@ compile-flags: -C panic=abort //@ no-prefer-dynamic +//@ ignore-backends: gcc #[cfg(panic = "unwind")] pub fn bad() -> i32 { } diff --git a/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs b/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs index a4646d67c6847..40d838b7e8e8a 100644 --- a/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs +++ b/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs @@ -1,4 +1,6 @@ //@ run-pass +//@ ignore-backends: gcc + #![allow(dead_code)] // check that we don't have linear stack usage with multiple calls to `push` diff --git a/tests/ui/codegen/equal-pointers-unequal/as-cast/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/as-cast/inline1.rs index d13fd4b63b306..53e29e75781a4 100644 --- a/tests/ui/codegen/equal-pointers-unequal/as-cast/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/as-cast/inline1.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/as-cast/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/as-cast/inline2.rs index 5ec3c7cbdf55b..47639762e7a66 100644 --- a/tests/ui/codegen/equal-pointers-unequal/as-cast/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/as-cast/inline2.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs index 97a875f15bc89..70cbb9a52f706 100644 --- a/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/as-cast/segfault.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs b/tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs index 731c5b67882bd..694fb34828cd8 100644 --- a/tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs index cdf07eade8740..ade32663d48ea 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline1.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs index 94739708ab8bd..d8feaeee4fa6b 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/inline2.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs index b163c282d9336..ad1d7b56c8cb7 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/segfault.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs index b7824f53d77f8..a50369b46cb4c 100644 --- a/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/exposed-provenance/zero.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs index 5f4ee731f7d34..0b5b2df9f0e52 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline1.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs index 0f838af1fb190..1812a1163f0ab 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/inline2.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Based on https://github.com/rust-lang/rust/issues/107975#issuecomment-1432161340 diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs index fea41e0361294..637f0042adaef 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/segfault.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs index 20ed991ed3d66..5879b3f4f4f3f 100644 --- a/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs +++ b/tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs @@ -1,6 +1,7 @@ //@ known-bug: #107975 //@ compile-flags: -Copt-level=2 //@ run-pass +//@ ignore-backends: gcc // Derived from https://github.com/rust-lang/rust/issues/107975#issuecomment-1431758601 diff --git a/tests/ui/consts/const-eval/parse_ints.rs b/tests/ui/consts/const-eval/parse_ints.rs index 409fae9e51d92..6a7e157ea5039 100644 --- a/tests/ui/consts/const-eval/parse_ints.rs +++ b/tests/ui/consts/const-eval/parse_ints.rs @@ -1,3 +1,5 @@ +//@ 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 7e529c037250e..9c9d083e7ca23 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_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:5:24 + --> $DIR/parse_ints.rs:7:24 | LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `_TOO_LOW` failed inside this call @@ -11,7 +11,7 @@ note: inside `core::num::::from_ascii_radix` = 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_radix: radix must lie in the range `[2, 36]` - --> $DIR/parse_ints.rs:6:25 + --> $DIR/parse_ints.rs:8: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 db2d50f4d22c9..8c21f7b1a5a90 100644 --- a/tests/ui/consts/const_cmp_type_id.rs +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ compile-flags: -Znext-solver #![feature(const_type_id, 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 540eec5098b40..05b94caef79e6 100644 --- a/tests/ui/consts/const_cmp_type_id.stderr +++ b/tests/ui/consts/const_cmp_type_id.stderr @@ -1,5 +1,5 @@ error[E0015]: cannot call non-const operator in constants - --> $DIR/const_cmp_type_id.rs:10:18 + --> $DIR/const_cmp_type_id.rs:11: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 5f364cd995e02..f43823fa1551b 100644 --- a/tests/ui/consts/issue-73976-monomorphic.rs +++ b/tests/ui/consts/issue-73976-monomorphic.rs @@ -1,3 +1,4 @@ +//@ 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 22791e7d15e5d..f2ddc928d122e 100644 --- a/tests/ui/consts/issue-94675.rs +++ b/tests/ui/consts/issue-94675.rs @@ -1,3 +1,5 @@ +//@ 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 608ce0cfef012..d7664de5c07a7 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -1,17 +1,17 @@ error[E0277]: the trait bound `Vec: [const] Index<_>` is not satisfied - --> $DIR/issue-94675.rs:9:9 + --> $DIR/issue-94675.rs:11:9 | LL | self.bar[0] = baz.len(); | ^^^^^^^^^^^ error[E0277]: the trait bound `Vec: [const] IndexMut` is not satisfied - --> $DIR/issue-94675.rs:9:9 + --> $DIR/issue-94675.rs:11:9 | LL | self.bar[0] = baz.len(); | ^^^^^^^^^^^ error[E0277]: the trait bound `Vec: [const] Index` is not satisfied - --> $DIR/issue-94675.rs:9:9 + --> $DIR/issue-94675.rs:11:9 | 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 6eae885ea8aed..78587bbb4dd90 100644 --- a/tests/ui/consts/issue-miri-1910.rs +++ b/tests/ui/consts/issue-miri-1910.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ error-pattern unable to turn pointer into raw bytes //@ normalize-stderr: "alloc[0-9]+\+0x[a-z0-9]+" -> "ALLOC" diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index 140b1861bb42a..2b6e079e3809e 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:8:5 | LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `C` failed here diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index 893dc321604fe..4f3f9aa6adacc 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ compile-flags: -Z ui-testing=no use std::{ diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index de4acbffa2898..0ac1e281107d8 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,11 +1,11 @@ error[E0080]: unable to copy parts of a pointer from memory at ALLOC0 - --> $DIR/missing_span_in_backtrace.rs:14:9 + --> $DIR/missing_span_in_backtrace.rs:15:9 | -14 | / ptr::swap_nonoverlapping( -15 | | &mut ptr1 as *mut _ as *mut MaybeUninit, -16 | | &mut ptr2 as *mut _ as *mut MaybeUninit, -17 | | mem::size_of::<&i32>(), -18 | | ); +15 | / ptr::swap_nonoverlapping( +16 | | &mut ptr1 as *mut _ as *mut MaybeUninit, +17 | | &mut ptr2 as *mut _ as *mut MaybeUninit, +18 | | mem::size_of::<&i32>(), +19 | | ); | |_________^ evaluation of `X` failed inside this call | = help: this code performed an operation that depends on the underlying bytes representing a pointer diff --git a/tests/ui/consts/try-operator.rs b/tests/ui/consts/try-operator.rs index 59d9fcb1cbdbf..cd0bf8ea57167 100644 --- a/tests/ui/consts/try-operator.rs +++ b/tests/ui/consts/try-operator.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ run-pass #![feature(try_trait_v2)] diff --git a/tests/ui/coroutine/panic-drops-resume.rs b/tests/ui/coroutine/panic-drops-resume.rs index b23666b7885fb..ee58dab3e3703 100644 --- a/tests/ui/coroutine/panic-drops-resume.rs +++ b/tests/ui/coroutine/panic-drops-resume.rs @@ -2,6 +2,7 @@ //@ 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 8c2cf560f2acc..c8ac401372f78 100644 --- a/tests/ui/coroutine/panic-drops.rs +++ b/tests/ui/coroutine/panic-drops.rs @@ -1,5 +1,6 @@ //@ 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 6b9b4cb33c322..cee2afacb6145 100644 --- a/tests/ui/coroutine/panic-safe.rs +++ b/tests/ui/coroutine/panic-safe.rs @@ -1,6 +1,6 @@ //@ 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 7028e1e81e55c..f566bd37d3d10 100644 --- a/tests/ui/coroutine/resume-after-return.rs +++ b/tests/ui/coroutine/resume-after-return.rs @@ -1,3 +1,4 @@ +//@ 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 517c6613e3d8b..175c2928a8010 100644 --- a/tests/ui/coroutine/unwind-abort-mix.rs +++ b/tests/ui/coroutine/unwind-abort-mix.rs @@ -6,6 +6,7 @@ //@ 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/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs index 9de0d549f20ac..608aef8d9683b 100644 --- a/tests/ui/delegation/fn-header.rs +++ b/tests/ui/delegation/fn-header.rs @@ -1,6 +1,7 @@ //@ check-pass //@ edition:2018 //@ aux-crate:fn_header_aux=fn-header-aux.rs +//@ ignore-backends: gcc #![feature(c_variadic)] #![feature(fn_delegation)] diff --git a/tests/ui/drop/dynamic-drop-async.rs b/tests/ui/drop/dynamic-drop-async.rs index e7a32d3c24e92..64de6995c7a82 100644 --- a/tests/ui/drop/dynamic-drop-async.rs +++ b/tests/ui/drop/dynamic-drop-async.rs @@ -6,6 +6,7 @@ //@ 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 b695b5702d943..1bd75e1852c4a 100644 --- a/tests/ui/drop/dynamic-drop.rs +++ b/tests/ui/drop/dynamic-drop.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] #![feature(if_let_guard)] diff --git a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs index 346a94c37dd86..cdf8aa854826a 100644 --- a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs +++ b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs @@ -4,6 +4,7 @@ //@ revisions: default strict //@ [strict]compile-flags: -Zstrict-init-checks //@ needs-subprocess +//@ ignore-backends: gcc #![allow(deprecated, invalid_value)] #![feature(never_type)] diff --git a/tests/ui/issues/issue-14875.rs b/tests/ui/issues/issue-14875.rs index 235d255716f33..e330c64a335fc 100644 --- a/tests/ui/issues/issue-14875.rs +++ b/tests/ui/issues/issue-14875.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc // Check that values are not leaked when a dtor panics (#14875) diff --git a/tests/ui/issues/issue-29948.rs b/tests/ui/issues/issue-29948.rs index 77e1f6807d9b7..77a3885da042a 100644 --- a/tests/ui/issues/issue-29948.rs +++ b/tests/ui/issues/issue-29948.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc use std::panic; diff --git a/tests/ui/iterators/iter-sum-overflow-debug.rs b/tests/ui/iterators/iter-sum-overflow-debug.rs index 32efc925a454e..974282b03792b 100644 --- a/tests/ui/iterators/iter-sum-overflow-debug.rs +++ b/tests/ui/iterators/iter-sum-overflow-debug.rs @@ -1,5 +1,6 @@ //@ 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 8fffd19e2beae..aba6f9a188f3a 100644 --- a/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs +++ b/tests/ui/iterators/iter-sum-overflow-overflow-checks.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc //@ compile-flags: -C overflow-checks use std::panic; diff --git a/tests/ui/lto/all-crates.rs b/tests/ui/lto/all-crates.rs index ceabf9f05dffd..fa17684dcff8b 100644 --- a/tests/ui/lto/all-crates.rs +++ b/tests/ui/lto/all-crates.rs @@ -2,6 +2,7 @@ //@ compile-flags: -Clto=thin //@ no-prefer-dynamic +//@ ignore-backends: gcc fn main() { println!("hello!"); diff --git a/tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs b/tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs index a38d0e2b2e3c0..8579fd599f77a 100644 --- a/tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs +++ b/tests/ui/lto/lto-thin-rustc-loads-linker-plugin.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ compile-flags: -C lto=thin //@ aux-build:lto-rustc-loads-linker-plugin.rs //@ run-pass diff --git a/tests/ui/lto/thin-lto-inlines2.rs b/tests/ui/lto/thin-lto-inlines2.rs index 735557ab491c5..4c7b9278b0822 100644 --- a/tests/ui/lto/thin-lto-inlines2.rs +++ b/tests/ui/lto/thin-lto-inlines2.rs @@ -4,6 +4,7 @@ //@ aux-build:thin-lto-inlines-aux.rs //@ no-prefer-dynamic //@ ignore-emscripten can't inspect instructions on emscripten +//@ ignore-backends: gcc // We want to assert here that ThinLTO will inline across codegen units. There's // not really a great way to do that in general so we sort of hack around it by diff --git a/tests/ui/mir/mir_drop_order.rs b/tests/ui/mir/mir_drop_order.rs index 21d1054c4222d..a7a1a26a956bf 100644 --- a/tests/ui/mir/mir_drop_order.rs +++ b/tests/ui/mir/mir_drop_order.rs @@ -1,5 +1,6 @@ //@ 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 8a54f21b57fa5..1579e298ee79a 100644 --- a/tests/ui/mir/mir_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_let_chains_drop_order.rs @@ -1,5 +1,6 @@ //@ 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 e98d57d1154c4..3196513454b6b 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,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc //@ revisions: edition2021 edition2024 //@ [edition2021] edition: 2021 //@ [edition2024] edition: 2024 diff --git a/tests/ui/numbers-arithmetic/u128-as-f32.rs b/tests/ui/numbers-arithmetic/u128-as-f32.rs index 88579f507eb75..57c82d5a24f23 100644 --- a/tests/ui/numbers-arithmetic/u128-as-f32.rs +++ b/tests/ui/numbers-arithmetic/u128-as-f32.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ ignore-backends: gcc #![feature(test)] #![deny(overflowing_literals)] 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 0566d2319df1a..bef2d8bcff050 100644 --- a/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/tests/ui/panic-runtime/abort-link-to-unwinding-crates.rs @@ -3,6 +3,7 @@ //@ 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 8cdfd018a9282..2a52228801f8e 100644 --- a/tests/ui/panic-runtime/abort.rs +++ b/tests/ui/panic-runtime/abort.rs @@ -2,6 +2,7 @@ //@ 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 a4013f2a6cf70..98718ab8342b8 100644 --- a/tests/ui/panic-runtime/link-to-abort.rs +++ b/tests/ui/panic-runtime/link-to-abort.rs @@ -2,6 +2,7 @@ //@ compile-flags:-C panic=abort //@ no-prefer-dynamic +//@ ignore-backends: gcc #![feature(panic_abort)] diff --git a/tests/ui/panic-runtime/lto-abort.rs b/tests/ui/panic-runtime/lto-abort.rs index cf15ae6435bfd..cf36cd8c810a2 100644 --- a/tests/ui/panic-runtime/lto-abort.rs +++ b/tests/ui/panic-runtime/lto-abort.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ run-pass //@ compile-flags:-C lto -C panic=abort //@ no-prefer-dynamic diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs index 40f517f317ef7..4f0423a704f2e 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.rs +++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs @@ -1,3 +1,5 @@ +//@ ignore-backends: gcc + mod unclosed_delim_mod; fn main() { diff --git a/tests/ui/process/nofile-limit.rs b/tests/ui/process/nofile-limit.rs index dafc982607c1c..64777b514256e 100644 --- a/tests/ui/process/nofile-limit.rs +++ b/tests/ui/process/nofile-limit.rs @@ -7,6 +7,8 @@ //@ only-linux //@ no-prefer-dynamic //@ compile-flags: -Ctarget-feature=+crt-static -Crpath=no -Crelocation-model=static +//@ ignore-backends: gcc + #![feature(exit_status_error)] #![feature(rustc_private)] extern crate libc; diff --git a/tests/ui/process/println-with-broken-pipe.rs b/tests/ui/process/println-with-broken-pipe.rs index fbac9b6cd958f..58b83a2dd9a2f 100644 --- a/tests/ui/process/println-with-broken-pipe.rs +++ b/tests/ui/process/println-with-broken-pipe.rs @@ -5,6 +5,7 @@ //@ ignore-fuchsia //@ ignore-horizon //@ ignore-android +//@ ignore-backends: gcc //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC" //@ compile-flags: -Zon-broken-pipe=error 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 bd62a6447851f..b1df1b191bcf1 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,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc //@ revisions: default mir-opt //@[mir-opt] compile-flags: -Zmir-opt-level=4 diff --git a/tests/ui/runtime/on-broken-pipe/child-processes.rs b/tests/ui/runtime/on-broken-pipe/child-processes.rs index 0da2347481b19..c0c8ad4e2f5e6 100644 --- a/tests/ui/runtime/on-broken-pipe/child-processes.rs +++ b/tests/ui/runtime/on-broken-pipe/child-processes.rs @@ -1,6 +1,7 @@ //@ revisions: default error kill inherit //@ ignore-cross-compile 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/rt-explody-panic-payloads.rs b/tests/ui/runtime/rt-explody-panic-payloads.rs index d564a26ca7374..1d5795f8e8652 100644 --- a/tests/ui/runtime/rt-explody-panic-payloads.rs +++ b/tests/ui/runtime/rt-explody-panic-payloads.rs @@ -1,6 +1,7 @@ //@ run-pass //@ needs-unwind //@ needs-subprocess +//@ ignore-backends: gcc use std::env; use std::process::Command; diff --git a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs index f4f383e008a08..fad57198dfbeb 100644 --- a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs +++ b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs @@ -6,6 +6,7 @@ //@ edition: 2021 //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu +//@ ignore-backends: gcc //@ build-pass trait Iterable { diff --git a/tests/ui/sanitizer/cfi/async-closures.rs b/tests/ui/sanitizer/cfi/async-closures.rs index 351853ab1a710..9b0992630002f 100644 --- a/tests/ui/sanitizer/cfi/async-closures.rs +++ b/tests/ui/sanitizer/cfi/async-closures.rs @@ -4,6 +4,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/can-reveal-opaques.rs b/tests/ui/sanitizer/cfi/can-reveal-opaques.rs index 99c12d72eb524..a881c6b92b285 100644 --- a/tests/ui/sanitizer/cfi/can-reveal-opaques.rs +++ b/tests/ui/sanitizer/cfi/can-reveal-opaques.rs @@ -2,6 +2,7 @@ //@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu +//@ ignore-backends: gcc //@ build-pass // See comment below for why this test exists. diff --git a/tests/ui/sanitizer/cfi/closures.rs b/tests/ui/sanitizer/cfi/closures.rs index 424e70560dbb4..fc9718faa2869 100644 --- a/tests/ui/sanitizer/cfi/closures.rs +++ b/tests/ui/sanitizer/cfi/closures.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/complex-receiver.rs b/tests/ui/sanitizer/cfi/complex-receiver.rs index c7b45a775ca1d..aac44c33227fd 100644 --- a/tests/ui/sanitizer/cfi/complex-receiver.rs +++ b/tests/ui/sanitizer/cfi/complex-receiver.rs @@ -5,6 +5,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/coroutine.rs b/tests/ui/sanitizer/cfi/coroutine.rs index 39a754f103637..084a521f597fb 100644 --- a/tests/ui/sanitizer/cfi/coroutine.rs +++ b/tests/ui/sanitizer/cfi/coroutine.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ edition: 2024 //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi diff --git a/tests/ui/sanitizer/cfi/drop-in-place.rs b/tests/ui/sanitizer/cfi/drop-in-place.rs index 8ce2c43260261..160338a5b54a7 100644 --- a/tests/ui/sanitizer/cfi/drop-in-place.rs +++ b/tests/ui/sanitizer/cfi/drop-in-place.rs @@ -2,6 +2,7 @@ // // FIXME(#122848): Remove only-linux when fixed. //@ only-linux +//@ ignore-backends: gcc //@ needs-sanitizer-cfi //@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi //@ run-pass diff --git a/tests/ui/sanitizer/cfi/drop-no-principal.rs b/tests/ui/sanitizer/cfi/drop-no-principal.rs index c1c88c8c71c73..e3a46fe9d7595 100644 --- a/tests/ui/sanitizer/cfi/drop-no-principal.rs +++ b/tests/ui/sanitizer/cfi/drop-no-principal.rs @@ -3,6 +3,7 @@ //@ needs-sanitizer-cfi // FIXME(#122848) Remove only-linux once OSX CFI binaries works //@ only-linux +//@ ignore-backends: gcc //@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi //@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0 // FIXME(#118761) Should be run-pass once the labels on drop are compatible. diff --git a/tests/ui/sanitizer/cfi/fn-ptr.rs b/tests/ui/sanitizer/cfi/fn-ptr.rs index 505b4b8e7f032..d3209c62ddf91 100644 --- a/tests/ui/sanitizer/cfi/fn-ptr.rs +++ b/tests/ui/sanitizer/cfi/fn-ptr.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/self-ref.rs b/tests/ui/sanitizer/cfi/self-ref.rs index 3b524ac661cf8..b93d49296b639 100644 --- a/tests/ui/sanitizer/cfi/self-ref.rs +++ b/tests/ui/sanitizer/cfi/self-ref.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/sized-associated-ty.rs b/tests/ui/sanitizer/cfi/sized-associated-ty.rs index f5b4e22e9d99b..eefc3e2e9db9f 100644 --- a/tests/ui/sanitizer/cfi/sized-associated-ty.rs +++ b/tests/ui/sanitizer/cfi/sized-associated-ty.rs @@ -4,6 +4,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/supertraits.rs b/tests/ui/sanitizer/cfi/supertraits.rs index f80b316918804..f5a984b9583da 100644 --- a/tests/ui/sanitizer/cfi/supertraits.rs +++ b/tests/ui/sanitizer/cfi/supertraits.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/cfi/virtual-auto.rs b/tests/ui/sanitizer/cfi/virtual-auto.rs index 6971d516a2057..e6f2ebd4b2cd7 100644 --- a/tests/ui/sanitizer/cfi/virtual-auto.rs +++ b/tests/ui/sanitizer/cfi/virtual-auto.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ ignore-backends: gcc //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static diff --git a/tests/ui/sanitizer/kcfi-mangling.rs b/tests/ui/sanitizer/kcfi-mangling.rs index fde7b5451b6e2..ba36dc184ec7e 100644 --- a/tests/ui/sanitizer/kcfi-mangling.rs +++ b/tests/ui/sanitizer/kcfi-mangling.rs @@ -4,6 +4,7 @@ //@ no-prefer-dynamic //@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0 //@ build-pass +//@ ignore-backends: gcc trait Foo { fn foo(&self); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index bf38a8b17202f..09f5d41a87c13 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -1,4 +1,6 @@ //@ run-pass +//@ ignore-backends: gcc + #![allow(non_camel_case_types)] #![feature(repr_simd, core_intrinsics)] diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index f9ed416b6ff54..bba712e62966a 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ ignore-backends: gcc #![feature(repr_simd, core_intrinsics)] diff --git a/tests/ui/simd/issue-17170.rs b/tests/ui/simd/issue-17170.rs index 2d13962843c44..508f480a58db3 100644 --- a/tests/ui/simd/issue-17170.rs +++ b/tests/ui/simd/issue-17170.rs @@ -1,4 +1,6 @@ //@ run-pass +//@ ignore-backends: gcc + #![feature(repr_simd)] #[repr(simd)] diff --git a/tests/ui/simd/issue-39720.rs b/tests/ui/simd/issue-39720.rs index 09d6142c92019..41617c744d6e6 100644 --- a/tests/ui/simd/issue-39720.rs +++ b/tests/ui/simd/issue-39720.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ ignore-backends: gcc #![feature(repr_simd, core_intrinsics)] diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index da32ba611c485..bc4307fb26d6b 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ run-pass #![feature(repr_simd, core_intrinsics)] diff --git a/tests/ui/simd/repr_packed.rs b/tests/ui/simd/repr_packed.rs index f0c6de7c402f1..9cf679dc4327b 100644 --- a/tests/ui/simd/repr_packed.rs +++ b/tests/ui/simd/repr_packed.rs @@ -1,3 +1,4 @@ +//@ ignore-backends: gcc //@ run-pass #![feature(repr_simd, core_intrinsics)] diff --git a/tests/ui/simd/simd-bitmask-notpow2.rs b/tests/ui/simd/simd-bitmask-notpow2.rs index b9af591d1b94a..991fe0d893379 100644 --- a/tests/ui/simd/simd-bitmask-notpow2.rs +++ b/tests/ui/simd/simd-bitmask-notpow2.rs @@ -2,6 +2,8 @@ // FIXME: broken codegen on big-endian (https://github.com/rust-lang/rust/issues/127205) // This should be merged into `simd-bitmask` once that's fixed. //@ ignore-endian-big +//@ ignore-backends: gcc + #![feature(repr_simd, core_intrinsics)] #[path = "../../auxiliary/minisimd.rs"] diff --git a/tests/ui/statics/const_generics.rs b/tests/ui/statics/const_generics.rs index 6cc0a65f77d52..1921b2c99a365 100644 --- a/tests/ui/statics/const_generics.rs +++ b/tests/ui/statics/const_generics.rs @@ -3,6 +3,7 @@ //! This is not an intentional guarantee, it just describes the status quo. //@ run-pass +//@ ignore-backends: gcc // With optimizations, LLVM will deduplicate the constant `X` whose // value is `&42` to just be a reference to the static. This is correct, // but obscures the issue we're trying to show. 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 9c49ee56b0f4d..ff803ff889b8f 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,5 +1,5 @@ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:33:5 + --> $DIR/const-drop-fail.rs:34:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -8,13 +8,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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:35:5 + --> $DIR/const-drop-fail.rs:36:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -23,7 +23,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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 9c49ee56b0f4d..ff803ff889b8f 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,5 +1,5 @@ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:33:5 + --> $DIR/const-drop-fail.rs:34:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -8,13 +8,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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:35:5 + --> $DIR/const-drop-fail.rs:36:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -23,7 +23,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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 9c49ee56b0f4d..ff803ff889b8f 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,5 +1,5 @@ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:33:5 + --> $DIR/const-drop-fail.rs:34:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -8,13 +8,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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:35:5 + --> $DIR/const-drop-fail.rs:36:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -23,7 +23,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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 9c49ee56b0f4d..ff803ff889b8f 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,5 +1,5 @@ error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied - --> $DIR/const-drop-fail.rs:33:5 + --> $DIR/const-drop-fail.rs:34:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -8,13 +8,13 @@ LL | NonTrivialDrop, | ^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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:35:5 + --> $DIR/const-drop-fail.rs:36:5 | LL | const _: () = check($exp); | ----- required by a bound introduced by this call @@ -23,7 +23,7 @@ LL | ConstImplWithDropGlue(NonTrivialDrop), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by a bound in `check` - --> $DIR/const-drop-fail.rs:24:19 + --> $DIR/const-drop-fail.rs:25: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 4513d71f61342..b74716f00617f 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.rs +++ b/tests/ui/traits/const-traits/const-drop-fail.rs @@ -1,6 +1,7 @@ //@[new_precise] compile-flags: -Znext-solver //@[new_stock] compile-flags: -Znext-solver //@ revisions: new_stock old_stock new_precise old_precise +//@ 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/uninhabited/uninhabited-transparent-return-abi.rs b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs index 2c2788a3e5642..e439a82be5abb 100644 --- a/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs +++ b/tests/ui/uninhabited/uninhabited-transparent-return-abi.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-unwind +//@ ignore-backends: gcc // See https://github.com/rust-lang/rust/issues/135802 enum Void {} From 910ee2d15a505070cbc80dcceaf74ba2b8a5b15a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 23 Jul 2025 13:46:35 +0200 Subject: [PATCH 08/13] Fix `compiletest` bad handling of `ignore-backends` --- src/tools/compiletest/src/directives/cfg.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/compiletest/src/directives/cfg.rs b/src/tools/compiletest/src/directives/cfg.rs index 35f6a9e164486..802a1d63d1f20 100644 --- a/src/tools/compiletest/src/directives/cfg.rs +++ b/src/tools/compiletest/src/directives/cfg.rs @@ -285,6 +285,11 @@ fn parse_cfg_name_directive<'a>( if name == "gdb-version" { outcome = MatchOutcome::External; } + + // Don't error out for ignore-backends,as it is handled elsewhere. + if name == "backends" { + outcome = MatchOutcome::External; + } } ParsedNameDirective { From 23fda6084b5e9a618b74a9c417f5353783b72ae9 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Wed, 23 Jul 2025 17:29:59 +0800 Subject: [PATCH 09/13] RustWrapper: Suppress getNextNonDebugInfoInstruction Link: https://github.com/llvm/llvm-project/pull/144383 --- compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 82568ed4ae177..c9814beedd660 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1610,7 +1610,7 @@ extern "C" void LLVMRustPositionBefore(LLVMBuilderRef B, LLVMValueRef Instr) { extern "C" void LLVMRustPositionAfter(LLVMBuilderRef B, LLVMValueRef Instr) { if (auto I = dyn_cast(unwrap(Instr))) { - auto J = I->getNextNonDebugInstruction(); + auto J = I->getNextNode(); unwrap(B)->SetInsertPoint(J); } } From 93d2003c9a4a35522b3528a4df638dd4e315bd14 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Jul 2025 07:27:01 -0700 Subject: [PATCH 10/13] Update `dlmalloc` dependency of libstd This primarily pulls in alexcrichton/dlmalloc-rs/55 and alexcrichton/dlmalloc-rs/54 to address 144199. Notably the highest byte in the wasm address space is no longer allocatable and additionally the allocator internally uses `wrapping_add` instead of `add` on pointers since on 32-bit platforms offsets might be larger than half the address space. --- library/Cargo.lock | 4 ++-- library/std/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index 94155e0839817..cb356480ead8a 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -78,9 +78,9 @@ dependencies = [ [[package]] name = "dlmalloc" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01597dde41c0b9da50d5f8c219023d63d8f27f39a27095070fd191fddc83891" +checksum = "fa3a2dbee57b69fbb5dbe852fa9c0925697fb0c7fbcb1593e90e5ffaedf13d51" dependencies = [ "cfg-if", "libc", diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index ba1e1f5218af7..57859ea914700 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -63,7 +63,7 @@ rand = { version = "0.9.0", default-features = false, features = ["alloc"] } rand_xorshift = "0.4.0" [target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), target_os = "xous", all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies] -dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] } +dlmalloc = { version = "0.2.10", features = ['rustc-dep-of-std'] } [target.x86_64-fortanix-unknown-sgx.dependencies] fortanix-sgx-abi = { version = "0.5.0", features = [ From e7441fbf61d3189dae16468fe6a3900ad466ed69 Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Wed, 23 Jul 2025 20:00:42 +0200 Subject: [PATCH 11/13] Clippy fixup Signed-off-by: Jens Reidel --- src/bootstrap/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 2aee9f0728449..51a84ad5272c9 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1343,7 +1343,7 @@ impl Build { .map(|p| &**p); if self.config.is_host_target(target) && configured_root.is_none() { - return Some(Path::new("/usr")); + Some(Path::new("/usr")) } else { configured_root } From a924d44115b632775ef0d2e12382e285953b0c2c Mon Sep 17 00:00:00 2001 From: Oneirical Date: Sun, 13 Jul 2025 15:56:27 -0400 Subject: [PATCH 12/13] Rehome tests/ui/issues/ tests [1/?] --- .../trait-object-cast-segfault-4333.rs} | 2 ++ .../dynamic-size-of-prefix-correctly-36278.rs} | 2 ++ ...eneric-parameter-in-const-expression-39211.rs} | 2 ++ ...ic-parameter-in-const-expression-39211.stderr} | 4 ++-- ...exporting-impl-from-root-causes-ice-2472-b.rs} | 0 .../exporting-impl-from-root-causes-ice-2472.rs | 15 +++++++++++++++ .../invalid-derive-comparison-34229.rs} | 2 ++ .../invalid-derive-comparison-34229.stderr} | 2 +- .../drop-immediate-non-box-ty-9446.rs} | 2 ++ .../recursive-enum-memory-32326.rs} | 2 ++ .../recursive-enum-memory-32326.stderr} | 2 +- .../generic-impl-method-match-autoderef-18514.rs} | 0 .../generic-impl-method-match-autoderef-18514.rs} | 6 ++++-- tests/ui/issues/issue-2472.rs | 13 ------------- tests/ui/issues/issue-49544.rs | 9 --------- .../iterator-adapter-undeclared-type-49544.rs} | 0 .../iterator-adapter-undeclared-type-49544.rs | 11 +++++++++++ .../macro-invocation-with-curly-braces-34418.rs} | 2 ++ ...licting-send-impls-for-marker-trait-106755.rs} | 2 ++ ...ing-send-impls-for-marker-trait-106755.stderr} | 12 ++++++------ .../innocent-looking-match-crash-46964.rs} | 2 ++ ...rent-method-resolution-on-deref-type-53843.rs} | 2 ++ .../private-field-access-in-mutex-54062.rs} | 2 ++ .../private-field-access-in-mutex-54062.stderr} | 2 +- ...recursive-impl-trait-iterator-by-ref-67552.rs} | 2 ++ ...rsive-impl-trait-iterator-by-ref-67552.stderr} | 6 +++--- .../early-return-with-unreachable-code-24353.rs} | 2 ++ .../relaxing-default-bound-error-37534.rs} | 2 ++ .../relaxing-default-bound-error-37534.stderr} | 4 ++-- .../trie-node-structure-usage-3389.rs} | 2 ++ .../for-binder-placement-error-39089.rs} | 2 ++ .../for-binder-placement-error-39089.stderr} | 2 +- .../dyn-trait-size-error-23281.rs} | 2 ++ .../dyn-trait-size-error-23281.stderr} | 6 +++--- .../trait-associated-type-bounds-36839.rs} | 2 ++ ...ait-implementation-for-primitive-type-5280.rs} | 2 ++ .../trait-implementation-for-usize-5321.rs} | 2 ++ ...een-associated-types-with-lifetimers-21174.rs} | 2 ++ ...associated-types-with-lifetimers-21174.stderr} | 2 +- .../float-type-inference-unification-14382.rs} | 2 ++ .../fn-traits-overloading-arity-18952.rs} | 2 ++ .../unboxed-closure-call-22789.rs} | 2 ++ .../unreachable-bool-read-7246.rs} | 2 ++ .../unreachable-bool-read-7246.stderr} | 6 +++--- .../unsized-function-argument-41229.rs} | 2 ++ .../unsized-function-argument-41229.stderr} | 2 +- 46 files changed, 107 insertions(+), 49 deletions(-) rename tests/ui/{issues/issue-4333.rs => cast/trait-object-cast-segfault-4333.rs} (76%) rename tests/ui/{issues/issue-36278-prefix-nesting.rs => codegen/dynamic-size-of-prefix-correctly-36278.rs} (91%) rename tests/ui/{issues/issue-39211.rs => const-generics/generic-parameter-in-const-expression-39211.rs} (83%) rename tests/ui/{issues/issue-39211.stderr => const-generics/generic-parameter-in-const-expression-39211.stderr} (78%) rename tests/ui/{issues/auxiliary/issue-2472-b.rs => cross-crate/auxiliary/exporting-impl-from-root-causes-ice-2472-b.rs} (100%) create mode 100644 tests/ui/cross-crate/exporting-impl-from-root-causes-ice-2472.rs rename tests/ui/{issues/issue-34229.rs => derives/invalid-derive-comparison-34229.rs} (74%) rename tests/ui/{issues/issue-34229.stderr => derives/invalid-derive-comparison-34229.stderr} (93%) rename tests/ui/{issues/issue-9446.rs => drop/drop-immediate-non-box-ty-9446.rs} (92%) rename tests/ui/{issues/issue-32326.rs => enum/recursive-enum-memory-32326.rs} (81%) rename tests/ui/{issues/issue-32326.stderr => enum/recursive-enum-memory-32326.stderr} (90%) rename tests/ui/{issues/auxiliary/issue-18514.rs => generics/auxiliary/generic-impl-method-match-autoderef-18514.rs} (100%) rename tests/ui/{issues/issue-18514.rs => generics/generic-impl-method-match-autoderef-18514.rs} (68%) delete mode 100644 tests/ui/issues/issue-2472.rs delete mode 100644 tests/ui/issues/issue-49544.rs rename tests/ui/{issues/auxiliary/issue-49544.rs => iterators/auxiliary/iterator-adapter-undeclared-type-49544.rs} (100%) create mode 100644 tests/ui/iterators/iterator-adapter-undeclared-type-49544.rs rename tests/ui/{issues/issue-34418.rs => macros/macro-invocation-with-curly-braces-34418.rs} (79%) rename tests/ui/{issues/issue-106755.rs => marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.rs} (92%) rename tests/ui/{issues/issue-106755.stderr => marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr} (80%) rename tests/ui/{issues/issue-46964.rs => match/innocent-looking-match-crash-46964.rs} (87%) rename tests/ui/{issues/issue-53843.rs => methods/inherent-method-resolution-on-deref-type-53843.rs} (86%) rename tests/ui/{issues/issue-54062.rs => privacy/private-field-access-in-mutex-54062.rs} (80%) rename tests/ui/{issues/issue-54062.stderr => privacy/private-field-access-in-mutex-54062.stderr} (82%) rename tests/ui/{issues/issue-67552.rs => recursion/recursive-impl-trait-iterator-by-ref-67552.rs} (90%) rename tests/ui/{issues/issue-67552.stderr => recursion/recursive-impl-trait-iterator-by-ref-67552.stderr} (68%) rename tests/ui/{issues/issue-24353.rs => return/early-return-with-unreachable-code-24353.rs} (64%) rename tests/ui/{issues/issue-37534.rs => sized/relaxing-default-bound-error-37534.rs} (74%) rename tests/ui/{issues/issue-37534.stderr => sized/relaxing-default-bound-error-37534.stderr} (80%) rename tests/ui/{issues/issue-3389.rs => structs/trie-node-structure-usage-3389.rs} (92%) rename tests/ui/{issues/issue-39089.rs => trait-bounds/for-binder-placement-error-39089.rs} (69%) rename tests/ui/{issues/issue-39089.stderr => trait-bounds/for-binder-placement-error-39089.stderr} (82%) rename tests/ui/{issues/issue-23281.rs => traits/dyn-trait-size-error-23281.rs} (77%) rename tests/ui/{issues/issue-23281.stderr => traits/dyn-trait-size-error-23281.stderr} (86%) rename tests/ui/{issues/issue-36839.rs => traits/trait-associated-type-bounds-36839.rs} (86%) rename tests/ui/{issues/issue-5280.rs => traits/trait-implementation-for-primitive-type-5280.rs} (84%) rename tests/ui/{issues/issue-5321-immediates-with-bare-self.rs => traits/trait-implementation-for-usize-5321.rs} (78%) rename tests/ui/{issues/issue-21174.rs => transmutability/transmute-between-associated-types-with-lifetimers-21174.rs} (83%) rename tests/ui/{issues/issue-21174.stderr => transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr} (86%) rename tests/ui/{issues/issue-14382.rs => type-inference/float-type-inference-unification-14382.rs} (85%) rename tests/ui/{issues/issue-18952.rs => unboxed-closures/fn-traits-overloading-arity-18952.rs} (96%) rename tests/ui/{issues/issue-22789.rs => unboxed-closures/unboxed-closure-call-22789.rs} (71%) rename tests/ui/{issues/issue-7246.rs => unreachable-code/unreachable-bool-read-7246.rs} (80%) rename tests/ui/{issues/issue-7246.stderr => unreachable-code/unreachable-bool-read-7246.stderr} (80%) rename tests/ui/{issues/issue-41229-ref-str.rs => unsized/unsized-function-argument-41229.rs} (61%) rename tests/ui/{issues/issue-41229-ref-str.stderr => unsized/unsized-function-argument-41229.stderr} (92%) diff --git a/tests/ui/issues/issue-4333.rs b/tests/ui/cast/trait-object-cast-segfault-4333.rs similarity index 76% rename from tests/ui/issues/issue-4333.rs rename to tests/ui/cast/trait-object-cast-segfault-4333.rs index dccaa6f68bd03..24e86d4d930ad 100644 --- a/tests/ui/issues/issue-4333.rs +++ b/tests/ui/cast/trait-object-cast-segfault-4333.rs @@ -7,3 +7,5 @@ pub fn main() { let stdout = &mut io::stdout() as &mut dyn io::Write; stdout.write(b"Hello!"); } + +// https://github.com/rust-lang/rust/issues/4333 diff --git a/tests/ui/issues/issue-36278-prefix-nesting.rs b/tests/ui/codegen/dynamic-size-of-prefix-correctly-36278.rs similarity index 91% rename from tests/ui/issues/issue-36278-prefix-nesting.rs rename to tests/ui/codegen/dynamic-size-of-prefix-correctly-36278.rs index 3f2ca7a246064..78c0129faa164 100644 --- a/tests/ui/issues/issue-36278-prefix-nesting.rs +++ b/tests/ui/codegen/dynamic-size-of-prefix-correctly-36278.rs @@ -18,3 +18,5 @@ fn main() { size_of_unsized = mem::size_of_val::>(&y); assert_eq!(size_of_sized, size_of_unsized); } + +// https://github.com/rust-lang/rust/issues/36278 diff --git a/tests/ui/issues/issue-39211.rs b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.rs similarity index 83% rename from tests/ui/issues/issue-39211.rs rename to tests/ui/const-generics/generic-parameter-in-const-expression-39211.rs index ab86afc34102b..b2566e5447119 100644 --- a/tests/ui/issues/issue-39211.rs +++ b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.rs @@ -12,3 +12,5 @@ fn m() { } fn main() { } + +// https://github.com/rust-lang/rust/issues/39211 diff --git a/tests/ui/issues/issue-39211.stderr b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr similarity index 78% rename from tests/ui/issues/issue-39211.stderr rename to tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr index 2124bc667ff5f..2a80aff834a36 100644 --- a/tests/ui/issues/issue-39211.stderr +++ b/tests/ui/const-generics/generic-parameter-in-const-expression-39211.stderr @@ -1,5 +1,5 @@ error: constant expression depends on a generic parameter - --> $DIR/issue-39211.rs:9:17 + --> $DIR/generic-parameter-in-const-expression-39211.rs:9:17 | LL | let a = [3; M::Row::DIM]; | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let a = [3; M::Row::DIM]; = note: this may fail depending on what value the parameter takes error: constant expression depends on a generic parameter - --> $DIR/issue-39211.rs:9:13 + --> $DIR/generic-parameter-in-const-expression-39211.rs:9:13 | LL | let a = [3; M::Row::DIM]; | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/auxiliary/issue-2472-b.rs b/tests/ui/cross-crate/auxiliary/exporting-impl-from-root-causes-ice-2472-b.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-2472-b.rs rename to tests/ui/cross-crate/auxiliary/exporting-impl-from-root-causes-ice-2472-b.rs diff --git a/tests/ui/cross-crate/exporting-impl-from-root-causes-ice-2472.rs b/tests/ui/cross-crate/exporting-impl-from-root-causes-ice-2472.rs new file mode 100644 index 0000000000000..86d637b579dc6 --- /dev/null +++ b/tests/ui/cross-crate/exporting-impl-from-root-causes-ice-2472.rs @@ -0,0 +1,15 @@ +//@ run-pass +//@ aux-build:exporting-impl-from-root-causes-ice-2472-b.rs + + +extern crate exporting_impl_from_root_causes_ice_2472_b as lib; + +use lib::{S, T}; + +pub fn main() { + let s = S(()); + s.foo(); + s.bar(); +} + +// https://github.com/rust-lang/rust/issues/2472 diff --git a/tests/ui/issues/issue-34229.rs b/tests/ui/derives/invalid-derive-comparison-34229.rs similarity index 74% rename from tests/ui/issues/issue-34229.rs rename to tests/ui/derives/invalid-derive-comparison-34229.rs index 13e627a492f40..d77ca78dc8167 100644 --- a/tests/ui/issues/issue-34229.rs +++ b/tests/ui/derives/invalid-derive-comparison-34229.rs @@ -3,3 +3,5 @@ //~^ ERROR can't compare `Comparable` fn main() {} + +// https://github.com/rust-lang/rust/issues/34229 diff --git a/tests/ui/issues/issue-34229.stderr b/tests/ui/derives/invalid-derive-comparison-34229.stderr similarity index 93% rename from tests/ui/issues/issue-34229.stderr rename to tests/ui/derives/invalid-derive-comparison-34229.stderr index 2385284de0b16..e3a9970670eef 100644 --- a/tests/ui/issues/issue-34229.stderr +++ b/tests/ui/derives/invalid-derive-comparison-34229.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Comparable` with `Comparable` - --> $DIR/issue-34229.rs:2:46 + --> $DIR/invalid-derive-comparison-34229.rs:2:46 | LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); | ---------- ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` diff --git a/tests/ui/issues/issue-9446.rs b/tests/ui/drop/drop-immediate-non-box-ty-9446.rs similarity index 92% rename from tests/ui/issues/issue-9446.rs rename to tests/ui/drop/drop-immediate-non-box-ty-9446.rs index a6ea91e8785d2..ad3f7b64aa947 100644 --- a/tests/ui/issues/issue-9446.rs +++ b/tests/ui/drop/drop-immediate-non-box-ty-9446.rs @@ -28,3 +28,5 @@ pub fn main() { Wrapper::new("Bob".to_string()).say_hi(); } } + +// https://github.com/rust-lang/rust/issues/9446 diff --git a/tests/ui/issues/issue-32326.rs b/tests/ui/enum/recursive-enum-memory-32326.rs similarity index 81% rename from tests/ui/issues/issue-32326.rs rename to tests/ui/enum/recursive-enum-memory-32326.rs index e928c66e2cc7e..6b8b04a7c91ac 100644 --- a/tests/ui/issues/issue-32326.rs +++ b/tests/ui/enum/recursive-enum-memory-32326.rs @@ -8,3 +8,5 @@ enum Expr { //~ ERROR E0072 } fn main() { } + +// https://github.com/rust-lang/rust/issues/32326 diff --git a/tests/ui/issues/issue-32326.stderr b/tests/ui/enum/recursive-enum-memory-32326.stderr similarity index 90% rename from tests/ui/issues/issue-32326.stderr rename to tests/ui/enum/recursive-enum-memory-32326.stderr index 1989a915cc14c..0260a6758ed76 100644 --- a/tests/ui/issues/issue-32326.stderr +++ b/tests/ui/enum/recursive-enum-memory-32326.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Expr` has infinite size - --> $DIR/issue-32326.rs:5:1 + --> $DIR/recursive-enum-memory-32326.rs:5:1 | LL | enum Expr { | ^^^^^^^^^ diff --git a/tests/ui/issues/auxiliary/issue-18514.rs b/tests/ui/generics/auxiliary/generic-impl-method-match-autoderef-18514.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-18514.rs rename to tests/ui/generics/auxiliary/generic-impl-method-match-autoderef-18514.rs diff --git a/tests/ui/issues/issue-18514.rs b/tests/ui/generics/generic-impl-method-match-autoderef-18514.rs similarity index 68% rename from tests/ui/issues/issue-18514.rs rename to tests/ui/generics/generic-impl-method-match-autoderef-18514.rs index 89f58d3988d9e..3520e9362093e 100644 --- a/tests/ui/issues/issue-18514.rs +++ b/tests/ui/generics/generic-impl-method-match-autoderef-18514.rs @@ -5,12 +5,14 @@ // expression that autoderefs through an overloaded generic deref // impl. -//@ aux-build:issue-18514.rs +//@ aux-build:generic-impl-method-match-autoderef-18514.rs -extern crate issue_18514 as ice; +extern crate generic_impl_method_match_autoderef_18514 as ice; use ice::{Tr, St}; fn main() { let st: St<()> = St(vec![]); st.tr(); } + +// https://github.com/rust-lang/rust/issues/18514 diff --git a/tests/ui/issues/issue-2472.rs b/tests/ui/issues/issue-2472.rs deleted file mode 100644 index f8f539ed1d19d..0000000000000 --- a/tests/ui/issues/issue-2472.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -//@ aux-build:issue-2472-b.rs - - -extern crate issue_2472_b; - -use issue_2472_b::{S, T}; - -pub fn main() { - let s = S(()); - s.foo(); - s.bar(); -} diff --git a/tests/ui/issues/issue-49544.rs b/tests/ui/issues/issue-49544.rs deleted file mode 100644 index bb052501f8b15..0000000000000 --- a/tests/ui/issues/issue-49544.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ aux-build:issue-49544.rs -//@ check-pass - -extern crate issue_49544; -use issue_49544::foo; - -fn main() { - let _ = foo(); -} diff --git a/tests/ui/issues/auxiliary/issue-49544.rs b/tests/ui/iterators/auxiliary/iterator-adapter-undeclared-type-49544.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-49544.rs rename to tests/ui/iterators/auxiliary/iterator-adapter-undeclared-type-49544.rs diff --git a/tests/ui/iterators/iterator-adapter-undeclared-type-49544.rs b/tests/ui/iterators/iterator-adapter-undeclared-type-49544.rs new file mode 100644 index 0000000000000..f2532ceb1baa9 --- /dev/null +++ b/tests/ui/iterators/iterator-adapter-undeclared-type-49544.rs @@ -0,0 +1,11 @@ +//@ aux-build:iterator-adapter-undeclared-type-49544.rs +//@ check-pass + +extern crate iterator_adapter_undeclared_type_49544 as lib; +use lib::foo; + +fn main() { + let _ = foo(); +} + +// https://github.com/rust-lang/rust/issues/49544 diff --git a/tests/ui/issues/issue-34418.rs b/tests/ui/macros/macro-invocation-with-curly-braces-34418.rs similarity index 79% rename from tests/ui/issues/issue-34418.rs rename to tests/ui/macros/macro-invocation-with-curly-braces-34418.rs index 0dcefb019359f..46dbdd35ef658 100644 --- a/tests/ui/issues/issue-34418.rs +++ b/tests/ui/macros/macro-invocation-with-curly-braces-34418.rs @@ -17,3 +17,5 @@ fn g() { } fn main() {} + +// https://github.com/rust-lang/rust/issues/34418 diff --git a/tests/ui/issues/issue-106755.rs b/tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.rs similarity index 92% rename from tests/ui/issues/issue-106755.rs rename to tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.rs index d7e7122ebda16..891b8c1f74d6e 100644 --- a/tests/ui/issues/issue-106755.rs +++ b/tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.rs @@ -20,3 +20,5 @@ impl !Send for TestType {} //~^ ERROR `!Send` impls cannot be specialized fn main() {} + +// https://github.com/rust-lang/rust/issues/106755 diff --git a/tests/ui/issues/issue-106755.stderr b/tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr similarity index 80% rename from tests/ui/issues/issue-106755.stderr rename to tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr index da6b8c5c56325..100b3bf1ae311 100644 --- a/tests/ui/issues/issue-106755.stderr +++ b/tests/ui/marker_trait_attr/conflicting-send-impls-for-marker-trait-106755.stderr @@ -1,5 +1,5 @@ error[E0751]: found both positive and negative implementation of trait `Send` for type `TestType<_>`: - --> $DIR/issue-106755.rs:13:1 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:13:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ positive implementation here @@ -8,7 +8,7 @@ LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ negative implementation here error[E0119]: conflicting implementations of trait `Send` for type `TestType<_>` - --> $DIR/issue-106755.rs:17:1 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:17:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------------------ first implementation here @@ -17,26 +17,26 @@ LL | unsafe impl Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` error[E0367]: `!Send` impl requires `T: MyTrait` but the struct it is implemented for does not - --> $DIR/issue-106755.rs:13:9 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:13:9 | LL | impl !Send for TestType {} | ^^^^^^^ | note: the implementor must specify the same requirement - --> $DIR/issue-106755.rs:9:1 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:9:1 | LL | struct TestType(::std::marker::PhantomData); | ^^^^^^^^^^^^^^^^^^ error[E0366]: `!Send` impls cannot be specialized - --> $DIR/issue-106755.rs:19:1 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:19:1 | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `i32` is not a generic parameter note: use the same sequence of generic lifetime, type and const parameters as the struct definition - --> $DIR/issue-106755.rs:9:1 + --> $DIR/conflicting-send-impls-for-marker-trait-106755.rs:9:1 | LL | struct TestType(::std::marker::PhantomData); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-46964.rs b/tests/ui/match/innocent-looking-match-crash-46964.rs similarity index 87% rename from tests/ui/issues/issue-46964.rs rename to tests/ui/match/innocent-looking-match-crash-46964.rs index 6a29d91df7383..c3efe8747035a 100644 --- a/tests/ui/issues/issue-46964.rs +++ b/tests/ui/match/innocent-looking-match-crash-46964.rs @@ -17,3 +17,5 @@ pub fn crash() -> bool { } fn main() {} + +// https://github.com/rust-lang/rust/issues/46964 diff --git a/tests/ui/issues/issue-53843.rs b/tests/ui/methods/inherent-method-resolution-on-deref-type-53843.rs similarity index 86% rename from tests/ui/issues/issue-53843.rs rename to tests/ui/methods/inherent-method-resolution-on-deref-type-53843.rs index d4b0b1e332bdf..0b2ab9afc399e 100644 --- a/tests/ui/issues/issue-53843.rs +++ b/tests/ui/methods/inherent-method-resolution-on-deref-type-53843.rs @@ -24,3 +24,5 @@ fn main() { let pin = Pin(&mut unit); pin.poll(); } + +// https://github.com/rust-lang/rust/issues/53843 diff --git a/tests/ui/issues/issue-54062.rs b/tests/ui/privacy/private-field-access-in-mutex-54062.rs similarity index 80% rename from tests/ui/issues/issue-54062.rs rename to tests/ui/privacy/private-field-access-in-mutex-54062.rs index 093d6601d4e2e..f145f9c3e529b 100644 --- a/tests/ui/issues/issue-54062.rs +++ b/tests/ui/privacy/private-field-access-in-mutex-54062.rs @@ -10,3 +10,5 @@ fn testing(test: Test) { let _ = test.comps.inner.try_lock(); //~^ ERROR: field `inner` of struct `Mutex` is private } + +// https://github.com/rust-lang/rust/issues/54062 diff --git a/tests/ui/issues/issue-54062.stderr b/tests/ui/privacy/private-field-access-in-mutex-54062.stderr similarity index 82% rename from tests/ui/issues/issue-54062.stderr rename to tests/ui/privacy/private-field-access-in-mutex-54062.stderr index 75eef543f272e..1424410759746 100644 --- a/tests/ui/issues/issue-54062.stderr +++ b/tests/ui/privacy/private-field-access-in-mutex-54062.stderr @@ -1,5 +1,5 @@ error[E0616]: field `inner` of struct `Mutex` is private - --> $DIR/issue-54062.rs:10:24 + --> $DIR/private-field-access-in-mutex-54062.rs:10:24 | LL | let _ = test.comps.inner.try_lock(); | ^^^^^ private field diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs similarity index 90% rename from tests/ui/issues/issue-67552.rs rename to tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs index 53f0e931d60bc..0875d385ddcb5 100644 --- a/tests/ui/issues/issue-67552.rs +++ b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs @@ -29,3 +29,5 @@ where //~^ ERROR reached the recursion limit while instantiating } } + +// https://github.com/rust-lang/rust/issues/67552 diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.stderr similarity index 68% rename from tests/ui/issues/issue-67552.stderr rename to tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.stderr index def0a29f3e51e..fe005984fab24 100644 --- a/tests/ui/issues/issue-67552.stderr +++ b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.stderr @@ -1,17 +1,17 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` - --> $DIR/issue-67552.rs:28:9 + --> $DIR/recursive-impl-trait-iterator-by-ref-67552.rs:28:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:21:1 + --> $DIR/recursive-impl-trait-iterator-by-ref-67552.rs:21:1 | LL | / fn rec(mut it: T) LL | | where LL | | T: Iterator, | |________________^ - = note: the full type name has been written to '$TEST_BUILD_DIR/issue-67552.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/recursive-impl-trait-iterator-by-ref-67552.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-24353.rs b/tests/ui/return/early-return-with-unreachable-code-24353.rs similarity index 64% rename from tests/ui/issues/issue-24353.rs rename to tests/ui/return/early-return-with-unreachable-code-24353.rs index 369fc238d1173..13add4652d994 100644 --- a/tests/ui/issues/issue-24353.rs +++ b/tests/ui/return/early-return-with-unreachable-code-24353.rs @@ -6,3 +6,5 @@ fn main() { let x = (); x } + +// https://github.com/rust-lang/rust/issues/24353 diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/sized/relaxing-default-bound-error-37534.rs similarity index 74% rename from tests/ui/issues/issue-37534.rs rename to tests/ui/sized/relaxing-default-bound-error-37534.rs index 63f6479ae2e24..d30e9f92ce9fb 100644 --- a/tests/ui/issues/issue-37534.rs +++ b/tests/ui/sized/relaxing-default-bound-error-37534.rs @@ -3,3 +3,5 @@ struct Foo {} //~| ERROR bound modifier `?` can only be applied to `Sized` fn main() {} + +// https://github.com/rust-lang/rust/issues/37534 diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/sized/relaxing-default-bound-error-37534.stderr similarity index 80% rename from tests/ui/issues/issue-37534.stderr rename to tests/ui/sized/relaxing-default-bound-error-37534.stderr index 0860735420301..8b9597f33e307 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/sized/relaxing-default-bound-error-37534.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found derive macro `Hash` - --> $DIR/issue-37534.rs:1:16 + --> $DIR/relaxing-default-bound-error-37534.rs:1:16 | LL | struct Foo {} | ^^^^ not a trait @@ -10,7 +10,7 @@ LL + use std::hash::Hash; | error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-37534.rs:1:15 + --> $DIR/relaxing-default-bound-error-37534.rs:1:15 | LL | struct Foo {} | ^^^^^ diff --git a/tests/ui/issues/issue-3389.rs b/tests/ui/structs/trie-node-structure-usage-3389.rs similarity index 92% rename from tests/ui/issues/issue-3389.rs rename to tests/ui/structs/trie-node-structure-usage-3389.rs index 4e73a2cf0015e..1518e10794443 100644 --- a/tests/ui/issues/issue-3389.rs +++ b/tests/ui/structs/trie-node-structure-usage-3389.rs @@ -24,3 +24,5 @@ pub fn main() { print_str_vector(node.content.clone()); } + +// https://github.com/rust-lang/rust/issues/3389 diff --git a/tests/ui/issues/issue-39089.rs b/tests/ui/trait-bounds/for-binder-placement-error-39089.rs similarity index 69% rename from tests/ui/issues/issue-39089.rs rename to tests/ui/trait-bounds/for-binder-placement-error-39089.rs index 822c47503afe9..47976bdfff45a 100644 --- a/tests/ui/issues/issue-39089.rs +++ b/tests/ui/trait-bounds/for-binder-placement-error-39089.rs @@ -2,3 +2,5 @@ fn f Sized>() {} //~^ ERROR `for<...>` binder should be placed before trait bound modifiers fn main() {} + +// https://github.com/rust-lang/rust/issues/39089 diff --git a/tests/ui/issues/issue-39089.stderr b/tests/ui/trait-bounds/for-binder-placement-error-39089.stderr similarity index 82% rename from tests/ui/issues/issue-39089.stderr rename to tests/ui/trait-bounds/for-binder-placement-error-39089.stderr index a81010aedff5a..12fcbc5757f9d 100644 --- a/tests/ui/issues/issue-39089.stderr +++ b/tests/ui/trait-bounds/for-binder-placement-error-39089.stderr @@ -1,5 +1,5 @@ error: `for<...>` binder should be placed before trait bound modifiers - --> $DIR/issue-39089.rs:1:13 + --> $DIR/for-binder-placement-error-39089.rs:1:13 | LL | fn f Sized>() {} | - ^^^^ diff --git a/tests/ui/issues/issue-23281.rs b/tests/ui/traits/dyn-trait-size-error-23281.rs similarity index 77% rename from tests/ui/issues/issue-23281.rs rename to tests/ui/traits/dyn-trait-size-error-23281.rs index 72716896426e4..8e44b8c879934 100644 --- a/tests/ui/issues/issue-23281.rs +++ b/tests/ui/traits/dyn-trait-size-error-23281.rs @@ -10,3 +10,5 @@ struct Vec { } fn main() {} + +// https://github.com/rust-lang/rust/issues/23281 diff --git a/tests/ui/issues/issue-23281.stderr b/tests/ui/traits/dyn-trait-size-error-23281.stderr similarity index 86% rename from tests/ui/issues/issue-23281.stderr rename to tests/ui/traits/dyn-trait-size-error-23281.stderr index ee079f2deeca3..d7b791a045274 100644 --- a/tests/ui/issues/issue-23281.stderr +++ b/tests/ui/traits/dyn-trait-size-error-23281.stderr @@ -1,17 +1,17 @@ error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time - --> $DIR/issue-23281.rs:4:27 + --> $DIR/dyn-trait-size-error-23281.rs:4:27 | LL | pub fn function(funs: Vec ()>) {} | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)` note: required by an implicit `Sized` bound in `Vec` - --> $DIR/issue-23281.rs:8:12 + --> $DIR/dyn-trait-size-error-23281.rs:8:12 | LL | struct Vec { | ^ required by the implicit `Sized` requirement on this type parameter in `Vec` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` - --> $DIR/issue-23281.rs:8:12 + --> $DIR/dyn-trait-size-error-23281.rs:8:12 | LL | struct Vec { | ^ this could be changed to `T: ?Sized`... diff --git a/tests/ui/issues/issue-36839.rs b/tests/ui/traits/trait-associated-type-bounds-36839.rs similarity index 86% rename from tests/ui/issues/issue-36839.rs rename to tests/ui/traits/trait-associated-type-bounds-36839.rs index 654c0f6e4b54a..156c063abc23f 100644 --- a/tests/ui/issues/issue-36839.rs +++ b/tests/ui/traits/trait-associated-type-bounds-36839.rs @@ -19,3 +19,5 @@ impl Broken for T { fn main() { let _m: &dyn Broken = &(); } + +// https://github.com/rust-lang/rust/issues/36839 diff --git a/tests/ui/issues/issue-5280.rs b/tests/ui/traits/trait-implementation-for-primitive-type-5280.rs similarity index 84% rename from tests/ui/issues/issue-5280.rs rename to tests/ui/traits/trait-implementation-for-primitive-type-5280.rs index 66452c3677679..72a4283bc7e2b 100644 --- a/tests/ui/issues/issue-5280.rs +++ b/tests/ui/traits/trait-implementation-for-primitive-type-5280.rs @@ -16,3 +16,5 @@ impl FontTableTagConversions for FontTableTag { pub fn main() { 5.tag_to_string(); } + +// https://github.com/rust-lang/rust/issues/5280 diff --git a/tests/ui/issues/issue-5321-immediates-with-bare-self.rs b/tests/ui/traits/trait-implementation-for-usize-5321.rs similarity index 78% rename from tests/ui/issues/issue-5321-immediates-with-bare-self.rs rename to tests/ui/traits/trait-implementation-for-usize-5321.rs index cb35a641c5e39..ab997b6627a5f 100644 --- a/tests/ui/issues/issue-5321-immediates-with-bare-self.rs +++ b/tests/ui/traits/trait-implementation-for-usize-5321.rs @@ -13,3 +13,5 @@ impl Fooable for usize { pub fn main() { 2.yes(); } + +// https://github.com/rust-lang/rust/issues/5321 diff --git a/tests/ui/issues/issue-21174.rs b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs similarity index 83% rename from tests/ui/issues/issue-21174.rs rename to tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs index 07827425116af..22cb379ffdab0 100644 --- a/tests/ui/issues/issue-21174.rs +++ b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.rs @@ -9,3 +9,5 @@ fn foo<'a, T: Trait<'a>>(value: T::A) { } fn main() { } + +// https://github.com/rust-lang/rust/issues/21174 diff --git a/tests/ui/issues/issue-21174.stderr b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr similarity index 86% rename from tests/ui/issues/issue-21174.stderr rename to tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr index a6b75c913524d..5c0cd91cee13a 100644 --- a/tests/ui/issues/issue-21174.stderr +++ b/tests/ui/transmutability/transmute-between-associated-types-with-lifetimers-21174.stderr @@ -1,5 +1,5 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/issue-21174.rs:7:30 + --> $DIR/transmute-between-associated-types-with-lifetimers-21174.rs:7:30 | LL | let new: T::B = unsafe { std::mem::transmute(value) }; | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-14382.rs b/tests/ui/type-inference/float-type-inference-unification-14382.rs similarity index 85% rename from tests/ui/issues/issue-14382.rs rename to tests/ui/type-inference/float-type-inference-unification-14382.rs index 74d938783aefe..5bf497d2eabc0 100644 --- a/tests/ui/issues/issue-14382.rs +++ b/tests/ui/type-inference/float-type-inference-unification-14382.rs @@ -13,3 +13,5 @@ fn main() { let m : Matrix4 = translate(x); println!("m: {:?}", m); } + +// https://github.com/rust-lang/rust/issues/14382 diff --git a/tests/ui/issues/issue-18952.rs b/tests/ui/unboxed-closures/fn-traits-overloading-arity-18952.rs similarity index 96% rename from tests/ui/issues/issue-18952.rs rename to tests/ui/unboxed-closures/fn-traits-overloading-arity-18952.rs index 9fdafb1ff4a90..4e3bc9b671a5e 100644 --- a/tests/ui/issues/issue-18952.rs +++ b/tests/ui/unboxed-closures/fn-traits-overloading-arity-18952.rs @@ -54,3 +54,5 @@ fn main() { assert_eq!(foo(1, 1), (2, 2)); assert_eq!(foo(1, 1, 1), (4, 4, 4)); } + +// https://github.com/rust-lang/rust/issues/18952 diff --git a/tests/ui/issues/issue-22789.rs b/tests/ui/unboxed-closures/unboxed-closure-call-22789.rs similarity index 71% rename from tests/ui/issues/issue-22789.rs rename to tests/ui/unboxed-closures/unboxed-closure-call-22789.rs index 95ebe6baaa38b..0bc8bed05884c 100644 --- a/tests/ui/issues/issue-22789.rs +++ b/tests/ui/unboxed-closures/unboxed-closure-call-22789.rs @@ -6,3 +6,5 @@ fn main() { let k = |x: i32| { x + 1 }; Fn::call(&k, (0,)); } + +// https://github.com/rust-lang/rust/issues/22789 diff --git a/tests/ui/issues/issue-7246.rs b/tests/ui/unreachable-code/unreachable-bool-read-7246.rs similarity index 80% rename from tests/ui/issues/issue-7246.rs rename to tests/ui/unreachable-code/unreachable-bool-read-7246.rs index 7b16fa024f8e4..8bbaa1025493f 100644 --- a/tests/ui/issues/issue-7246.rs +++ b/tests/ui/unreachable-code/unreachable-bool-read-7246.rs @@ -9,3 +9,5 @@ pub unsafe fn g() { } pub fn main() {} + +// https://github.com/rust-lang/rust/issues/7246 diff --git a/tests/ui/issues/issue-7246.stderr b/tests/ui/unreachable-code/unreachable-bool-read-7246.stderr similarity index 80% rename from tests/ui/issues/issue-7246.stderr rename to tests/ui/unreachable-code/unreachable-bool-read-7246.stderr index 1fb6ab14e644b..6072160cb5f13 100644 --- a/tests/ui/issues/issue-7246.stderr +++ b/tests/ui/unreachable-code/unreachable-bool-read-7246.stderr @@ -1,5 +1,5 @@ error: unreachable statement - --> $DIR/issue-7246.rs:7:5 + --> $DIR/unreachable-bool-read-7246.rs:7:5 | LL | return; | ------ any code following this expression is unreachable @@ -7,13 +7,13 @@ LL | if *ptr::null() {}; | ^^^^^^^^^^^^^^^^^^^ unreachable statement | note: the lint level is defined here - --> $DIR/issue-7246.rs:1:9 + --> $DIR/unreachable-bool-read-7246.rs:1:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ warning: dereferencing a null pointer - --> $DIR/issue-7246.rs:7:8 + --> $DIR/unreachable-bool-read-7246.rs:7:8 | LL | if *ptr::null() {}; | ^^^^^^^^^^^^ this code causes undefined behavior when executed diff --git a/tests/ui/issues/issue-41229-ref-str.rs b/tests/ui/unsized/unsized-function-argument-41229.rs similarity index 61% rename from tests/ui/issues/issue-41229-ref-str.rs rename to tests/ui/unsized/unsized-function-argument-41229.rs index fe5e6cd6ec5b1..9210431dc2f74 100644 --- a/tests/ui/issues/issue-41229-ref-str.rs +++ b/tests/ui/unsized/unsized-function-argument-41229.rs @@ -2,3 +2,5 @@ pub fn example(ref s: str) {} //~^ ERROR the size for values of type fn main() {} + +// https://github.com/rust-lang/rust/issues/41229 diff --git a/tests/ui/issues/issue-41229-ref-str.stderr b/tests/ui/unsized/unsized-function-argument-41229.stderr similarity index 92% rename from tests/ui/issues/issue-41229-ref-str.stderr rename to tests/ui/unsized/unsized-function-argument-41229.stderr index d4ef2a7772591..326e5681f70e6 100644 --- a/tests/ui/issues/issue-41229-ref-str.stderr +++ b/tests/ui/unsized/unsized-function-argument-41229.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-41229-ref-str.rs:1:23 + --> $DIR/unsized-function-argument-41229.rs:1:23 | LL | pub fn example(ref s: str) {} | ^^^ doesn't have a size known at compile-time From 11061831f703fdb5d05816860368e4b9ab4edee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Jul 2025 03:15:20 +0000 Subject: [PATCH 13/13] Mention type that could be `Clone` but isn't in more cases When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option`, which does not implement the `Copy` trait | note: if `Foo` implemented `Clone`, you could clone the value --> f111.rs:4:1 | 4 | struct Foo; | ^^^^^^^^^^ consider implementing `Clone` for this type ... 15 | if foo.map_or(false, |f| f.foo()) { | --- you could clone this value ``` --- .../src/diagnostics/conflict_errors.rs | 52 ++++++++++++ .../borrowck/borrowck-partial-reinit-1.stderr | 18 +++++ .../borrowck/borrowck-partial-reinit-2.stderr | 9 +++ .../borrowck-union-move-assign.stderr | 9 +++ tests/ui/borrowck/borrowck-union-move.stderr | 54 +++++++++++++ ...ield-mutation-of-moved-out-with-mut.stderr | 18 +++++ ...e-54499-field-mutation-of-moved-out.stderr | 18 +++++ ...7-reject-move-out-of-borrow-via-pat.stderr | 8 ++ .../match/if-let-guards-errors.e2018.stderr | 9 +++ .../match/if-let-guards-errors.e2021.stderr | 9 +++ ...clone-when-some-obligation-is-unmet.stderr | 8 ++ ...1232-partial-init-and-erroneous-use.stderr | 18 +++++ ...ef-patterns-closure-captures-inside.stderr | 81 +++++++++++++++++++ tests/ui/static/static-items-cant-move.stderr | 9 +++ .../suggestions/option-content-move2.stderr | 9 +++ .../union-borrow-move-parent-sibling.stderr | 18 +++++ tests/ui/unsafe-binders/moves.stderr | 9 +++ ...after-move-implicity-coerced-object.stderr | 8 ++ 18 files changed, 364 insertions(+) diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 040a0607db561..7031a9bb3d425 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1290,6 +1290,58 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { span, format!("if `{ty}` implemented `Clone`, you could clone the value"), ); + } else if let ty::Adt(_, _) = ty.kind() + && let Some(clone_trait) = self.infcx.tcx.lang_items().clone_trait() + { + // For cases like `Option`, where `Option: Clone` if `T: Clone`, we point + // at the types that should be `Clone`. + let ocx = ObligationCtxt::new_with_diagnostics(self.infcx); + let cause = ObligationCause::misc(expr.span, self.mir_def_id()); + ocx.register_bound(cause, self.infcx.param_env, ty, clone_trait); + let errors = ocx.select_all_or_error(); + if errors.iter().all(|error| { + match error.obligation.predicate.as_clause().and_then(|c| c.as_trait_clause()) { + Some(clause) => match clause.self_ty().skip_binder().kind() { + ty::Adt(def, _) => def.did().is_local() && clause.def_id() == clone_trait, + _ => false, + }, + None => false, + } + }) { + let mut type_spans = vec![]; + let mut types = FxIndexSet::default(); + for clause in errors + .iter() + .filter_map(|e| e.obligation.predicate.as_clause()) + .filter_map(|c| c.as_trait_clause()) + { + let ty::Adt(def, _) = clause.self_ty().skip_binder().kind() else { continue }; + type_spans.push(self.infcx.tcx.def_span(def.did())); + types.insert( + self.infcx + .tcx + .short_string(clause.self_ty().skip_binder(), &mut err.long_ty_path()), + ); + } + let mut span: MultiSpan = type_spans.clone().into(); + for sp in type_spans { + span.push_span_label(sp, "consider implementing `Clone` for this type"); + } + span.push_span_label(expr.span, "you could clone this value"); + let types: Vec<_> = types.into_iter().collect(); + let msg = match &types[..] { + [only] => format!("`{only}`"), + [head @ .., last] => format!( + "{} and `{last}`", + head.iter().map(|t| format!("`{t}`")).collect::>().join(", ") + ), + [] => unreachable!(), + }; + err.span_note( + span, + format!("if {msg} implemented `Clone`, you could clone the value"), + ); + } } } diff --git a/tests/ui/borrowck/borrowck-partial-reinit-1.stderr b/tests/ui/borrowck/borrowck-partial-reinit-1.stderr index 65f2bd6cfbda9..d261f3ac5722d 100644 --- a/tests/ui/borrowck/borrowck-partial-reinit-1.stderr +++ b/tests/ui/borrowck/borrowck-partial-reinit-1.stderr @@ -8,6 +8,15 @@ LL | drop(t); | - value moved here LL | t.b = Some(u); | ^^^ value assigned here after move + | +note: if `Test2` implemented `Clone`, you could clone the value + --> $DIR/borrowck-partial-reinit-1.rs:3:1 + | +LL | struct Test2 { + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(t); + | - you could clone this value error[E0382]: assign of moved value: `t` --> $DIR/borrowck-partial-reinit-1.rs:33:5 @@ -19,6 +28,15 @@ LL | drop(t); | - value moved here LL | t.0 = Some(u); | ^^^ value assigned here after move + | +note: if `Test3` implemented `Clone`, you could clone the value + --> $DIR/borrowck-partial-reinit-1.rs:7:1 + | +LL | struct Test3(Option); + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(t); + | - you could clone this value error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-partial-reinit-2.stderr b/tests/ui/borrowck/borrowck-partial-reinit-2.stderr index e25ca082b7b55..dde70eb444eb6 100644 --- a/tests/ui/borrowck/borrowck-partial-reinit-2.stderr +++ b/tests/ui/borrowck/borrowck-partial-reinit-2.stderr @@ -7,6 +7,15 @@ LL | let mut u = Test { a: 2, b: Some(Box::new(t))}; | - value moved here LL | t.b = Some(Box::new(u)); | ^^^ value assigned here after move + | +note: if `Test` implemented `Clone`, you could clone the value + --> $DIR/borrowck-partial-reinit-2.rs:1:1 + | +LL | struct Test { + | ^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let mut u = Test { a: 2, b: Some(Box::new(t))}; + | - you could clone this value error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/borrowck-union-move-assign.stderr b/tests/ui/borrowck/borrowck-union-move-assign.stderr index 8c0239a3ae91f..8721481dc1d9b 100644 --- a/tests/ui/borrowck/borrowck-union-move-assign.stderr +++ b/tests/ui/borrowck/borrowck-union-move-assign.stderr @@ -7,6 +7,15 @@ LL | let a = u.a; | --- value moved here LL | let a = u.a; | ^^^ value used here after move + | +note: if `U` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move-assign.rs:7:1 + | +LL | union U { + | ^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.a; + | --- you could clone this value error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/borrowck-union-move.stderr b/tests/ui/borrowck/borrowck-union-move.stderr index 731607fbdd1f7..0bae7ac522709 100644 --- a/tests/ui/borrowck/borrowck-union-move.stderr +++ b/tests/ui/borrowck/borrowck-union-move.stderr @@ -7,6 +7,15 @@ LL | let a = u.n1; | ---- value moved here LL | let a = u.n1; | ^^^^ value used here after move + | +note: if `Unn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:7:1 + | +LL | union Unn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n1; + | ---- you could clone this value error[E0382]: use of moved value: `u` --> $DIR/borrowck-union-move.rs:31:21 @@ -17,6 +26,15 @@ LL | let a = u.n1; | ---- value moved here LL | let a = u; | ^ value used here after move + | +note: if `Unn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:7:1 + | +LL | union Unn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n1; + | ---- you could clone this value error[E0382]: use of moved value: `u` --> $DIR/borrowck-union-move.rs:36:21 @@ -27,6 +45,15 @@ LL | let a = u.n1; | ---- value moved here LL | let a = u.n2; | ^^^^ value used here after move + | +note: if `Unn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:7:1 + | +LL | union Unn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n1; + | ---- you could clone this value error[E0382]: use of moved value: `u` --> $DIR/borrowck-union-move.rs:63:21 @@ -37,6 +64,15 @@ LL | let a = u.n; | --- value moved here LL | let a = u.n; | ^^^ value used here after move + | +note: if `Ucn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:15:1 + | +LL | union Ucn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n; + | --- you could clone this value error[E0382]: use of moved value: `u` --> $DIR/borrowck-union-move.rs:68:21 @@ -47,6 +83,15 @@ LL | let a = u.n; | --- value moved here LL | let a = u.c; | ^^^ value used here after move + | +note: if `Ucn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:15:1 + | +LL | union Ucn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n; + | --- you could clone this value error[E0382]: use of moved value: `u` --> $DIR/borrowck-union-move.rs:83:21 @@ -57,6 +102,15 @@ LL | let a = u.n; | --- value moved here LL | let a = u; | ^ value used here after move + | +note: if `Ucn` implemented `Clone`, you could clone the value + --> $DIR/borrowck-union-move.rs:15:1 + | +LL | union Ucn { + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.n; + | --- you could clone this value error: aborting due to 6 previous errors diff --git a/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr b/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr index b188766e221be..167fd6b227f5a 100644 --- a/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr +++ b/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.stderr @@ -17,6 +17,15 @@ LL | drop(u); | - value moved here LL | u.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move + | +note: if `Tpair` implemented `Clone`, you could clone the value + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:6:1 + | +LL | struct Tpair(S, i32); + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(u); + | - you could clone this value error[E0382]: assign to part of moved value: `v` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:31:9 @@ -27,6 +36,15 @@ LL | drop(v); | - value moved here LL | v.x = S(1); | ^^^^^^^^^^ value partially assigned here after move + | +note: if `Spair` implemented `Clone`, you could clone the value + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:7:1 + | +LL | struct Spair { x: S, y: i32 } + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(v); + | - you could clone this value error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr b/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr index 774b6cf0ea6d2..78c5040e52a65 100644 --- a/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr +++ b/tests/ui/borrowck/issue-54499-field-mutation-of-moved-out.stderr @@ -50,6 +50,15 @@ LL | drop(u); | - value moved here LL | u.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move + | +note: if `Tpair` implemented `Clone`, you could clone the value + --> $DIR/issue-54499-field-mutation-of-moved-out.rs:6:1 + | +LL | struct Tpair(S, i32); + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(u); + | - you could clone this value error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9 @@ -82,6 +91,15 @@ LL | drop(v); | - value moved here LL | v.x = S(1); | ^^^^^^^^^^ value partially assigned here after move + | +note: if `Spair` implemented `Clone`, you could clone the value + --> $DIR/issue-54499-field-mutation-of-moved-out.rs:7:1 + | +LL | struct Spair { x: S, y: i32 } + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(v); + | - you could clone this value error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9 diff --git a/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 121c2e870e7ac..5a0d353a48170 100644 --- a/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/tests/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -4,6 +4,14 @@ error[E0507]: cannot move out of `*array` which is behind a shared reference LL | *array | ^^^^^^ move occurs because `*array` has type `Vec`, which does not implement the `Copy` trait | +note: if `Value` implemented `Clone`, you could clone the value + --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:4:1 + | +LL | struct Value; + | ^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | *array + | ------ you could clone this value help: consider removing the dereference here | LL - *array diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr index 394629c000136..057960ec0142c 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr @@ -26,6 +26,15 @@ LL | E::Number(_) if let E::String(s) = *value => { } ... LL | let x = value; | ^^^^^ value used here after move + | +note: if `E` implemented `Clone`, you could clone the value + --> $DIR/if-let-guards-errors.rs:32:1 + | +LL | E::Number(_) if let E::String(s) = *value => { } + | ------ you could clone this value +... +LL | enum E { + | ^^^^^^ consider implementing `Clone` for this type error: aborting due to 2 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr index 5672845019b8f..4a6e39088278b 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr @@ -26,6 +26,15 @@ LL | E::Number(_) if let E::String(s) = *value => { } ... LL | let x = value; | ^^^^^ value used here after move + | +note: if `E` implemented `Clone`, you could clone the value + --> $DIR/if-let-guards-errors.rs:32:1 + | +LL | E::Number(_) if let E::String(s) = *value => { } + | ------ you could clone this value +... +LL | enum E { + | ^^^^^^ consider implementing `Clone` for this type error: aborting due to 2 previous errors diff --git a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr index c626796e01d25..6272455cc57ee 100644 --- a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr +++ b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr @@ -8,6 +8,14 @@ LL | let mut copy: Vec = map.clone().into_values().collect(); | note: `HashMap::::into_values` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL +note: if `Hash128_1` implemented `Clone`, you could clone the value + --> $DIR/suggest-clone-when-some-obligation-is-unmet.rs:8:1 + | +LL | pub struct Hash128_1; + | ^^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let mut copy: Vec = map.clone().into_values().collect(); + | ----------- you could clone this value help: you could `clone` the value and consume it, if the `Hash128_1: Clone` trait bound could be satisfied | LL - let mut copy: Vec = map.clone().into_values().collect(); diff --git a/tests/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/tests/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index 63f230be7d4b3..3363c4ea28bf8 100644 --- a/tests/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/tests/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -27,6 +27,15 @@ LL | drop(d); | - value moved here LL | d.x = 10; | ^^^^^^^^ value assigned here after move + | +note: if `D` implemented `Clone`, you could clone the value + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:11:1 + | +LL | struct D { + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(d); + | - you could clone this value error[E0381]: partially assigned binding `d` isn't fully initialized --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:45:5 @@ -57,6 +66,15 @@ LL | drop(d); | - value moved here LL | d.s.y = 20; | ^^^^^^^^^^ value partially assigned here after move + | +note: if `D` implemented `Clone`, you could clone the value + --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:11:1 + | +LL | struct D { + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | drop(d); + | - you could clone this value error: aborting due to 6 previous errors diff --git a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-inside.stderr b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-inside.stderr index f19fed0891740..deb14d141a92d 100644 --- a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-inside.stderr +++ b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures-inside.stderr @@ -146,6 +146,15 @@ LL | m!((ref mut borrow, mov) = tup0); ... LL | drop(&tup0); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!((ref mut borrow, mov) = tup0); + | ---- you could clone this value error[E0382]: borrow of moved value: `tup1` --> $DIR/move-ref-patterns-closure-captures-inside.rs:76:10 @@ -161,6 +170,15 @@ LL | m!((mov, _, ref mut borrow) = tup1); ... LL | drop(&tup1); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!((mov, _, ref mut borrow) = tup1); + | ---- you could clone this value error[E0382]: borrow of moved value: `tup2` --> $DIR/move-ref-patterns-closure-captures-inside.rs:77:10 @@ -176,6 +194,15 @@ LL | m!((ref borrow, mov) = tup2); ... LL | drop(&tup2); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!((ref borrow, mov) = tup2); + | ---- you could clone this value error[E0382]: borrow of moved value: `tup3` --> $DIR/move-ref-patterns-closure-captures-inside.rs:78:10 @@ -191,6 +218,15 @@ LL | m!((mov, _, ref borrow) = tup3); ... LL | drop(&tup3); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!((mov, _, ref borrow) = tup3); + | ---- you could clone this value error[E0382]: borrow of moved value: `tup4` --> $DIR/move-ref-patterns-closure-captures-inside.rs:79:21 @@ -206,6 +242,15 @@ LL | m!((ref borrow, mov) = tup4); ... LL | m!((ref x, _) = &tup4); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!((ref borrow, mov) = tup4); + | ---- you could clone this value error[E0382]: borrow of moved value: `arr0` --> $DIR/move-ref-patterns-closure-captures-inside.rs:80:10 @@ -221,6 +266,15 @@ LL | m!([mov @ .., ref borrow] = arr0); ... LL | drop(&arr0); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!([mov @ .., ref borrow] = arr0); + | ---- you could clone this value error[E0382]: borrow of moved value: `arr1` --> $DIR/move-ref-patterns-closure-captures-inside.rs:81:35 @@ -236,6 +290,15 @@ LL | m!([_, ref mut borrow @ .., _, mov] = arr1); ... LL | m!([_, mov1, mov2, mov3, _] = &arr1); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!([_, ref mut borrow @ .., _, mov] = arr1); + | ---- you could clone this value error[E0382]: borrow of moved value: `arr2` --> $DIR/move-ref-patterns-closure-captures-inside.rs:82:10 @@ -251,6 +314,15 @@ LL | m!([mov @ .., ref borrow] = arr2); ... LL | drop(&arr2); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!([mov @ .., ref borrow] = arr2); + | ---- you could clone this value error[E0382]: borrow of moved value: `arr3` --> $DIR/move-ref-patterns-closure-captures-inside.rs:83:35 @@ -265,6 +337,15 @@ LL | m!([_, ref borrow @ .., _, mov] = arr3); ... LL | m!([_, mov1, mov2, mov3, _] = &arr3); | ^^^^^ value borrowed here after move + | +note: if `S` implemented `Clone`, you could clone the value + --> $DIR/move-ref-patterns-closure-captures-inside.rs:2:5 + | +LL | struct S; // Not `Copy`. + | ^^^^^^^^ consider implementing `Clone` for this type +... +LL | m!([_, ref borrow @ .., _, mov] = arr3); + | ---- you could clone this value error[E0382]: borrow of moved value: `tup0` --> $DIR/move-ref-patterns-closure-captures-inside.rs:111:10 diff --git a/tests/ui/static/static-items-cant-move.stderr b/tests/ui/static/static-items-cant-move.stderr index 1361e7089e834..7c806613c5c04 100644 --- a/tests/ui/static/static-items-cant-move.stderr +++ b/tests/ui/static/static-items-cant-move.stderr @@ -3,6 +3,15 @@ error[E0507]: cannot move out of static item `BAR` | LL | test(BAR); | ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait + | +note: if `Foo` implemented `Clone`, you could clone the value + --> $DIR/static-items-cant-move.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | test(BAR); + | --- you could clone this value error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/option-content-move2.stderr b/tests/ui/suggestions/option-content-move2.stderr index 436441d6f1b9e..c73e874b40368 100644 --- a/tests/ui/suggestions/option-content-move2.stderr +++ b/tests/ui/suggestions/option-content-move2.stderr @@ -13,6 +13,15 @@ LL | move || { LL | LL | var = Some(NotCopyable); | --- variable moved due to use in closure + | +note: if `NotCopyable` implemented `Clone`, you could clone the value + --> $DIR/option-content-move2.rs:1:1 + | +LL | struct NotCopyable; + | ^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | var = Some(NotCopyable); + | --- you could clone this value error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closure --> $DIR/option-content-move2.rs:21:9 diff --git a/tests/ui/union/union-borrow-move-parent-sibling.stderr b/tests/ui/union/union-borrow-move-parent-sibling.stderr index f8e9609cb1c5e..461ee407e2ddb 100644 --- a/tests/ui/union/union-borrow-move-parent-sibling.stderr +++ b/tests/ui/union/union-borrow-move-parent-sibling.stderr @@ -31,6 +31,15 @@ LL | let a = u.x; | --- value moved here LL | let b = u.y; | ^^^ value used here after move + | +note: if `U` implemented `Clone`, you could clone the value + --> $DIR/union-borrow-move-parent-sibling.rs:43:1 + | +LL | union U { + | ^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.x; + | --- you could clone this value error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x`) --> $DIR/union-borrow-move-parent-sibling.rs:67:13 @@ -73,6 +82,15 @@ LL | let a = u.x; | --- value moved here LL | let b = u.y; | ^^^ value used here after move + | +note: if `U` implemented `Clone`, you could clone the value + --> $DIR/union-borrow-move-parent-sibling.rs:43:1 + | +LL | union U { + | ^^^^^^^ consider implementing `Clone` for this type +... +LL | let a = u.x; + | --- you could clone this value error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `u.y`) --> $DIR/union-borrow-move-parent-sibling.rs:81:13 diff --git a/tests/ui/unsafe-binders/moves.stderr b/tests/ui/unsafe-binders/moves.stderr index 0f976d9e845a3..bd48015707782 100644 --- a/tests/ui/unsafe-binders/moves.stderr +++ b/tests/ui/unsafe-binders/moves.stderr @@ -16,6 +16,15 @@ LL | let binder: unsafe<> NotCopy = wrap_binder!(base); | ---- value moved here LL | drop(base); | ^^^^ value used here after move + | +note: if `NotCopyInner` implemented `Clone`, you could clone the value + --> $DIR/moves.rs:8:1 + | +LL | struct NotCopyInner; + | ^^^^^^^^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | let binder: unsafe<> NotCopy = wrap_binder!(base); + | ---- you could clone this value error[E0382]: use of moved value: `binder` --> $DIR/moves.rs:24:14 diff --git a/tests/ui/use/use-after-move-implicity-coerced-object.stderr b/tests/ui/use/use-after-move-implicity-coerced-object.stderr index 35ede21717ef8..defaeef361b49 100644 --- a/tests/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/tests/ui/use/use-after-move-implicity-coerced-object.stderr @@ -17,6 +17,14 @@ LL | fn push(&mut self, n: Box) { | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this parameter takes ownership of the value | | | in this method +note: if `Number` implemented `Clone`, you could clone the value + --> $DIR/use-after-move-implicity-coerced-object.rs:3:1 + | +LL | struct Number { + | ^^^^^^^^^^^^^ consider implementing `Clone` for this type +... +LL | l.push(n); + | - you could clone this value error: aborting due to 1 previous error