diff --git a/.mailmap b/.mailmap index 19adab647a553..61d85c105549c 100644 --- a/.mailmap +++ b/.mailmap @@ -716,6 +716,8 @@ Weihang Lo Weihang Lo Wesley Wiser whitequark +Wilfred Hughes +Wilfred Hughes Will Crichton Will Crichton William Ting diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index 4cbeaa6278049..a303aedb64305 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -34,6 +34,7 @@ use rustc_errors::{Applicability, Diag, ErrorGuaranteed}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::{self as hir, ExprKind}; use rustc_infer::infer::DefineOpaqueTypes; +use rustc_infer::traits::ObligationCauseCode; use rustc_macros::{TypeFoldable, TypeVisitable}; use rustc_middle::mir::Mutability; use rustc_middle::ty::adjustment::AllowTwoPhase; @@ -46,6 +47,7 @@ use rustc_middle::{bug, span_bug}; use rustc_session::lint; use rustc_span::{DUMMY_SP, Span, sym}; use rustc_trait_selection::infer::InferCtxtExt; +use rustc_trait_selection::traits::{self, ObligationCtxt, TraitEngine}; use tracing::{debug, instrument}; use super::FnCtxt; @@ -799,7 +801,16 @@ impl<'a, 'tcx> CastCheck<'tcx> { pub(crate) fn check(mut self, fcx: &FnCtxt<'a, 'tcx>) { let expr_span = self.expr_span_for_type_resolution(fcx); self.expr_ty = fcx.structurally_resolve_type(expr_span, self.expr_ty); - self.cast_ty = fcx.structurally_resolve_type(self.cast_span, self.cast_ty); + self.cast_ty = fcx.resolve_vars_with_obligations(self.cast_ty); + if self.cast_ty.is_ty_var() { + self.cast_ty = if let Some(guar) = self.try_report_ambiguous_binop_for_infer_cast(fcx) { + let err = Ty::new_error(fcx.tcx, guar); + fcx.demand_suptype(self.cast_span, err, self.cast_ty); + err + } else { + fcx.type_must_be_known_at_this_point(self.cast_span, self.cast_ty) + }; + } debug!("check_cast({}, {:?} as {:?})", self.expr.hir_id, self.expr_ty, self.cast_ty); @@ -839,6 +850,64 @@ impl<'a, 'tcx> CastCheck<'tcx> { }; } } + + /// Prefer a pending operator ambiguity over a generic `as _` inference failure. + #[cold] + fn try_report_ambiguous_binop_for_infer_cast( + &self, + fcx: &FnCtxt<'a, 'tcx>, + ) -> Option { + let errors: Vec<_> = fcx + .fulfillment_cx + .borrow() + .pending_obligations() + .into_iter() + .filter_map(|mut obligation| { + let predicate = fcx.resolve_vars_if_possible(obligation.predicate); + if !matches!( + predicate.kind().skip_binder(), + ty::PredicateKind::Clause(ty::ClauseKind::Trait(_)) + ) { + return None; + } + let cast_span = self.cast_span; + + let ObligationCauseCode::BinOp { lhs_hir_id, rhs_hir_id, rhs_span, .. } = + obligation.cause.code() + else { + return None; + }; + let lhs_ty = fcx.resolve_vars_if_possible(fcx.node_ty(*lhs_hir_id)); + let rhs_ty = fcx.resolve_vars_if_possible(fcx.node_ty(*rhs_hir_id)); + + if (fcx.tcx.hir_span(*lhs_hir_id).contains(cast_span) + && lhs_ty.contains(self.cast_ty)) + || (rhs_span.contains(cast_span) && rhs_ty.contains(self.cast_ty)) + { + obligation.cause.span = cast_span; + obligation.predicate = predicate; + + let ocx = ObligationCtxt::new_with_diagnostics(&fcx.infcx); + ocx.register_obligation(obligation); + ocx.evaluate_obligations_error_on_ambiguity().into_iter().find(|error| { + matches!( + error.code, + traits::FulfillmentErrorCode::Ambiguity { overflow: None } + ) + }) + } else { + None + } + }) + .collect(); + + if errors.is_empty() { + None + } else { + Some(fcx.err_ctxt().report_fulfillment_errors(errors.into())) + } + } + /// Checks a cast, and report an error if one exists. In some cases, this /// can return Ok and create type errors in the fcx rather than returning /// directly. coercion-cast is handled in check instead of here. diff --git a/compiler/rustc_macros/src/serialize.rs b/compiler/rustc_macros/src/serialize.rs index 5ae6fb241c98d..801c12e776770 100644 --- a/compiler/rustc_macros/src/serialize.rs +++ b/compiler/rustc_macros/src/serialize.rs @@ -190,31 +190,39 @@ fn encodable_body( let encode_body = match s.variants() { [] => { - quote! { - match *self {} - } + quote! {} } - [_] => { - let encode_inner = s.each_variant(|vi| { - vi.bindings() - .iter() - .map(|binding| { - let bind_ident = &binding.binding; - let result = quote! { - ::rustc_serialize::Encodable::<#encoder_ty>::encode( - #bind_ident, - __encoder, - ); - }; - result - }) - .collect::() - }); + // Unit-like types don't need to encode anything. + // This covers fieldless structs and enums with zero or one fieldless variant. + [vi] if vi.bindings().is_empty() => { + quote! {} + } + [vi] => { + let pat = vi.pat(); + let body = vi + .bindings() + .iter() + .map(|binding| { + let bind_ident = &binding.binding; + let result = quote! { + ::rustc_serialize::Encodable::<#encoder_ty>::encode( + #bind_ident, + __encoder, + ); + }; + result + }) + .collect::(); + quote! { - match *self { #encode_inner } + let #pat = *self; + #body } } _ => { + // This code generates two separate match statements on purpose, because + // LLVM can optimize the first one into direct discriminant read. + // See: https://github.com/rust-lang/rust/pull/108440 let disc = { let mut variant_idx = 0usize; let encode_inner = s.each_variant(|_| { @@ -241,29 +249,30 @@ fn encodable_body( } }; - let mut variant_idx = 0usize; - let encode_inner = s.each_variant(|vi| { - let encode_fields: TokenStream = vi - .bindings() - .iter() - .map(|binding| { - let bind_ident = &binding.binding; - let result = quote! { - ::rustc_serialize::Encodable::<#encoder_ty>::encode( - #bind_ident, - __encoder, - ); - }; - result - }) - .collect(); - variant_idx += 1; - encode_fields - }); - quote! { - #disc - match *self { - #encode_inner + if s.variants().iter().all(|v| v.bindings().is_empty()) { + // Avoid generating second match statement if all variants are fieldless + disc + } else { + let encode_inner = s.each_variant(|vi| -> TokenStream { + vi.bindings() + .iter() + .map(|binding| { + let bind_ident = &binding.binding; + let result = quote! { + ::rustc_serialize::Encodable::<#encoder_ty>::encode( + #bind_ident, + __encoder, + ); + }; + result + }) + .collect() + }); + quote! { + #disc + match *self { + #encode_inner + } } } } diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 880095236b415..25c15fbe8bf04 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -449,7 +449,7 @@ impl CStore { pub fn report_session_incompatibilities(&self, tcx: TyCtxt<'_>, krate: &Crate) { self.report_incompatible_target_modifiers(tcx); - self.report_incompatible_partial_mitigations(tcx, krate); + self.report_incompatible_partial_mitigations(tcx); self.report_incompatible_async_drop_feature(tcx, krate); } @@ -473,7 +473,7 @@ impl CStore { } } - pub fn report_incompatible_partial_mitigations(&self, tcx: TyCtxt<'_>, krate: &Crate) { + pub fn report_incompatible_partial_mitigations(&self, tcx: TyCtxt<'_>) { let my_mitigations = tcx.sess.gather_enabled_denied_partial_mitigations(); let mut my_mitigations: BTreeMap<_, _> = my_mitigations.iter().map(|mitigation| (mitigation.kind, mitigation)).collect(); @@ -500,7 +500,6 @@ impl CStore { *errors += 1; tcx.dcx().emit_err(diagnostics::MitigationLessStrictInDependency { - span: krate.spans.inner_span.shrink_to_lo(), mitigation_name: my_mitigation.kind.to_string(), mitigation_level: my_mitigation.level.level_str().to_string(), extern_crate: data.name(), diff --git a/compiler/rustc_metadata/src/diagnostics.rs b/compiler/rustc_metadata/src/diagnostics.rs index 16af9baac448f..b98a0ce25af37 100644 --- a/compiler/rustc_metadata/src/diagnostics.rs +++ b/compiler/rustc_metadata/src/diagnostics.rs @@ -664,8 +664,6 @@ pub(crate) struct UnusedCrateDependency { "it is possible to disable `-Z allow-partial-mitigations={$mitigation_name}` via `-Z deny-partial-mitigations={$mitigation_name}`" )] pub(crate) struct MitigationLessStrictInDependency { - #[primary_span] - pub span: Span, pub mitigation_name: String, pub mitigation_level: String, pub extern_crate: Symbol, diff --git a/compiler/rustc_target/src/callconv/bpf.rs b/compiler/rustc_target/src/callconv/bpf.rs index 3624f406704e9..d3c936727723e 100644 --- a/compiler/rustc_target/src/callconv/bpf.rs +++ b/compiler/rustc_target/src/callconv/bpf.rs @@ -1,11 +1,33 @@ // see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/BPF/BPFCallingConv.td -use rustc_abi::TyAbiInterface; +use rustc_abi::{Reg, RegKind, Size, TyAbiInterface}; -use crate::callconv::{ArgAbi, FnAbi}; +use crate::callconv::{ArgAbi, CastTarget, FnAbi, Uniform}; + +fn classify_aggregate_type(arg: &mut ArgAbi<'_, Ty>) { + let size = arg.layout.size; + + match size.bits() { + 0 => return, + 1..=64 => { + arg.cast_to(Reg { kind: RegKind::Integer, size }); + } + 65..=128 => { + arg.cast_to(CastTarget::from(Uniform::new(Reg::i64(), Size::from_bytes(16)))); + } + _ => { + arg.make_indirect(); + } + } +} fn classify_ret(ret: &mut ArgAbi<'_, Ty>) { + if !ret.layout.is_sized() { + // Not touching this... + return; + } + if ret.layout.is_aggregate() || ret.layout.size.bits() > 64 { - ret.make_indirect(); + classify_aggregate_type(ret); } else { ret.extend_integer_width_to(32); } @@ -15,12 +37,16 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) where Ty: TyAbiInterface<'a, C> + Copy, { + if !arg.layout.is_sized() { + // Not touching this... + return; + } if arg.layout.pass_indirectly_in_non_rustic_abis(cx) { arg.make_indirect(); return; } if arg.layout.is_aggregate() || arg.layout.size.bits() > 64 { - arg.make_indirect(); + classify_aggregate_type(arg); } else { arg.extend_integer_width_to(32); } diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 1ba821c57214f..0500c1619f301 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -1099,7 +1099,8 @@ pub fn feature_to_arch_names(feature: &str) -> Vec<&'static str> { } // These arrays represent the least-constraining feature that is required for vector types up to a -// certain size to have their "proper" ABI on each architecture. +// certain size to have their "proper" ABI on each architecture. An empty feature name means +// that the given length is unconditionally available. // Note that they must be kept sorted by vector size. const X86_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI: &'static [(u64, &'static str)] = &[(128, "sse"), (256, "avx"), (512, "avx512f")]; // FIXME: might need changes for AVX10. diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 4875835695e69..e876b2d7bd312 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -1602,6 +1602,33 @@ impl f128 { pub const fn algebraic_rem(self, rhs: f128) -> f128 { intrinsics::frem_algebraic(self, rhs) } + + /// Returns `self` if the value is not NaN, otherwise returns `replacement` + /// if `self` is NaN. + /// + /// # Examples + /// + /// ``` + /// #![feature(f128)] + /// #![feature(float_nan_to)] + /// # #[cfg(target_has_reliable_f128)] { + /// + /// let n = f128::NAN; + /// let x = 2.0f128; + /// let y = f128::INFINITY; + /// + /// assert_eq!(n.nan_to(0.0f128), 0.0f128); + /// assert_eq!(x.nan_to(0.0f128), 2.0f128); + /// assert_eq!(y.nan_to(0.0f128), f128::INFINITY); + /// # } + /// ``` + #[must_use = "method returns a new float and does not mutate the original value"] + #[unstable(feature = "float_nan_to", issue = "161248")] + #[rustc_const_unstable(feature = "float_nan_to", issue = "161248")] + #[inline] + pub const fn nan_to(self, replacement: f128) -> f128 { + if self.is_nan() { replacement } else { self } + } } // Functions in this module fall into `core_float_math` diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 186945db9ae92..e649f6643fe59 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -1588,6 +1588,33 @@ impl f16 { pub const fn algebraic_rem(self, rhs: f16) -> f16 { intrinsics::frem_algebraic(self, rhs) } + + /// Returns `self` if the value is not NaN, otherwise returns `replacement` + /// if `self` is NaN. + /// + /// # Examples + /// + /// ``` + /// #![feature(f16)] + /// #![feature(float_nan_to)] + /// # #[cfg(target_has_reliable_f16)] { + /// + /// let n = f16::NAN; + /// let x = 2.0f16; + /// let y = f16::INFINITY; + /// + /// assert_eq!(n.nan_to(0.0f16), 0.0f16); + /// assert_eq!(x.nan_to(0.0f16), 2.0f16); + /// assert_eq!(y.nan_to(0.0f16), f16::INFINITY); + /// # } + /// ``` + #[must_use = "method returns a new float and does not mutate the original value"] + #[unstable(feature = "float_nan_to", issue = "161248")] + #[rustc_const_unstable(feature = "float_nan_to", issue = "161248")] + #[inline] + pub const fn nan_to(self, replacement: f16) -> f16 { + if self.is_nan() { replacement } else { self } + } } // Functions in this module fall into `core_float_math` diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index 49271ae6e01a9..971ecac73d6a6 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -1783,6 +1783,30 @@ impl f32 { pub const fn algebraic_rem(self, rhs: f32) -> f32 { intrinsics::frem_algebraic(self, rhs) } + + /// Returns `self` if the value is not NaN, otherwise returns `replacement` + /// if `self` is NaN. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_nan_to)] + /// + /// let n = f32::NAN; + /// let x = 2.0f32; + /// let y = f32::INFINITY; + /// + /// assert_eq!(n.nan_to(0.0f32), 0.0f32); + /// assert_eq!(x.nan_to(0.0f32), 2.0f32); + /// assert_eq!(y.nan_to(0.0f32), f32::INFINITY); + /// ``` + #[must_use = "method returns a new float and does not mutate the original value"] + #[unstable(feature = "float_nan_to", issue = "161248")] + #[rustc_const_unstable(feature = "float_nan_to", issue = "161248")] + #[inline] + pub const fn nan_to(self, replacement: f32) -> f32 { + if self.is_nan() { replacement } else { self } + } } /// Experimental implementations of floating point functions in `core`. diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index 77369b723511f..724bfd2a08f6e 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1763,6 +1763,30 @@ impl f64 { pub const fn algebraic_rem(self, rhs: f64) -> f64 { intrinsics::frem_algebraic(self, rhs) } + + /// Returns `self` if the value is not NaN, otherwise returns `replacement` + /// if `self` is NaN. + /// + /// # Examples + /// + /// ``` + /// #![feature(float_nan_to)] + /// + /// let n = f64::NAN; + /// let x = 2.0f64; + /// let y = f64::INFINITY; + /// + /// assert_eq!(n.nan_to(0.0f64), 0.0f64); + /// assert_eq!(x.nan_to(0.0f64), 2.0f64); + /// assert_eq!(y.nan_to(0.0f64), f64::INFINITY); + /// ``` + #[must_use = "method returns a new float and does not mutate the original value"] + #[unstable(feature = "float_nan_to", issue = "161248")] + #[rustc_const_unstable(feature = "float_nan_to", issue = "161248")] + #[inline] + pub const fn nan_to(self, replacement: f64) -> f64 { + if self.is_nan() { replacement } else { self } + } } #[unstable(feature = "core_float_math", issue = "137578")] diff --git a/library/std/src/sys/io/error/unix.rs b/library/std/src/sys/io/error/unix.rs index 5c51c5705a7aa..12acde7311e4c 100644 --- a/library/std/src/sys/io/error/unix.rs +++ b/library/std/src/sys/io/error/unix.rs @@ -157,7 +157,6 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind { libc::ENOENT => NotFound, libc::ENOMEM => OutOfMemory, libc::ENOSPC => StorageFull, - libc::ENOSYS => Unsupported, libc::EMLINK => TooManyLinks, libc::ENAMETOOLONG => InvalidFilename, libc::ENETDOWN => NetworkDown, @@ -175,11 +174,16 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind { libc::EXDEV => CrossesDevices, libc::EINPROGRESS => InProgress, libc::EMFILE | libc::ENFILE => TooManyOpenFiles, - libc::EOPNOTSUPP => Unsupported, libc::EIO => InputOutputError, libc::EACCES | libc::EPERM => PermissionDenied, + libc::ENOSYS => Unsupported, + // EOPNOTSUPP and ENOTSUP can have the same value on some systems, + // but different values on others (e.g. Apple), so we can't use a + // match clause + x if x == libc::EOPNOTSUPP || x == libc::ENOTSUP => Unsupported, + // These two constants can have the same value on some systems, // but different values on others, so we can't use a match // clause diff --git a/tests/codegen-llvm/bpf-abi-indirect-return.rs b/tests/codegen-llvm/bpf-abi-indirect-return.rs deleted file mode 100644 index a0406742e2210..0000000000000 --- a/tests/codegen-llvm/bpf-abi-indirect-return.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Checks that results larger than one register are returned indirectly -//@ add-minicore -//@ needs-llvm-components: bpf -//@ compile-flags: --target bpfel-unknown-none - -#![crate_type = "lib"] -#![feature(no_core)] -#![no_core] - -extern crate minicore; - -#[no_mangle] -fn outer(a: u64) -> u64 { - inner_big(a).b -} - -struct Big { - a: [u16; 32], - b: u64, -} - -// CHECK-LABEL: define {{.*}} @_R{{.*}}inner_big( -// CHECK-SAME: ptr{{[^,]*}}, -// CHECK-SAME: i64{{[^)]*}} -#[inline(never)] -fn inner_big(a: u64) -> Big { - Big { a: [a as u16; 32], b: 42 } -} diff --git a/tests/codegen-llvm/bpf-abi/indirect-return.rs b/tests/codegen-llvm/bpf-abi/indirect-return.rs new file mode 100644 index 0000000000000..c285bd9431c58 --- /dev/null +++ b/tests/codegen-llvm/bpf-abi/indirect-return.rs @@ -0,0 +1,33 @@ +// Checks that results larger than one register are returned indirectly +//@ add-minicore +//@ revisions: bpfel bpfeb +//@[bpfel] compile-flags: --target=bpfel-unknown-none +//@[bpfeb] compile-flags: --target=bpfeb-unknown-none +//@ needs-llvm-components: bpf +//@ compile-flags: -Copt-level=3 +#![crate_type = "lib"] +#![feature(no_core)] +#![no_core] + +extern crate minicore; + +struct Big { + a: [u16; 32], + b: u64, +} + +// CHECK-LABEL: define{{.*}} @inner_big_rust( +// CHECK-SAME: ptr{{[^,]*}}, +// CHECK-SAME: i64{{[^)]*}} +#[unsafe(no_mangle)] +fn inner_big_rust(a: u64) -> Big { + Big { a: [a as u16; 32], b: 42 } +} + +// CHECK-LABEL: define{{.*}} @inner_big_c( +// CHECK-SAME: ptr{{[^,]*}}, +// CHECK-SAME: i64{{[^)]*}} +#[unsafe(no_mangle)] +extern "C" fn inner_big_c(a: u64) -> Big { + Big { a: [a as u16; 32], b: 42 } +} diff --git a/tests/codegen-llvm/bpf-abi/struct-return-regs.rs b/tests/codegen-llvm/bpf-abi/struct-return-regs.rs new file mode 100644 index 0000000000000..cc97a41d9802d --- /dev/null +++ b/tests/codegen-llvm/bpf-abi/struct-return-regs.rs @@ -0,0 +1,107 @@ +//@ add-minicore +//@ revisions: bpfel bpfeb +//@[bpfel] compile-flags: --target=bpfel-unknown-none +//@[bpfeb] compile-flags: --target=bpfeb-unknown-none +//@ needs-llvm-components: bpf +//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes +//@ min-llvm-version: 23 +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +#[repr(C)] +struct Foo0 { + a: i8, +} + +#[repr(C)] +struct Foo1 { + a: i32, +} + +#[repr(C)] +struct Foo2 { + a: i32, + b: i64, +} + +#[repr(C)] +struct Foo3 { + a: i32, + b: i32, + c: i64, +} + +impl Copy for Foo0 {} +impl Copy for Foo1 {} +impl Copy for Foo2 {} +impl Copy for Foo3 {} + +// CHECK-LABEL: define{{.*}} i8 @bar0( +// CHECK: ret i8 +#[no_mangle] +extern "C" fn bar0(a: i8) -> Foo0 { + Foo0 { a } +} + +// CHECK-LABEL: define{{.*}} i32 @bar1( +// CHECK: ret i32 +#[no_mangle] +extern "C" fn bar1(a: i32) -> Foo1 { + Foo1 { a } +} + +// CHECK-LABEL: define{{.*}} [2 x i64] @bar2( +// CHECK: ret [2 x i64] +#[no_mangle] +extern "C" fn bar2(a: i32, b: i32) -> Foo2 { + Foo2 { a, b: b as i64 } +} + +// CHECK-LABEL: define{{.*}} [2 x i64] @bar3( +// CHECK: ret [2 x i64] +#[no_mangle] +extern "C" fn bar3(a: i32, b: i32, c: i32) -> Foo3 { + Foo3 { a, b, c: c as i64 } +} + +// CHECK-LABEL: define{{.*}} i8 @check0( +// CHECK: %[[C1:.*]] = call i8 @bar0( +// CHECK: store i8 %[[C1]] +#[no_mangle] +extern "C" fn check0(a: i8) -> i8 { + let v = bar0(a); + v.a +} + +// CHECK-LABEL: define{{.*}} i32 @check1( +// CHECK: %[[C1:.*]] = call i32 @bar1( +// CHECK: store i32 %[[C1]] +#[no_mangle] +extern "C" fn check1(a: i32) -> i32 { + let v = bar1(a); + v.a +} + +// CHECK-LABEL: define{{.*}} i32 @check2( +// CHECK: %[[C2:.*]] = call [2 x i64] @bar2( +// CHECK: store [2 x i64] %[[C2]] +#[no_mangle] +extern "C" fn check2(a: i32, b: i32) -> i32 { + let v = bar2(a, b); + hint::black_box(v); + v.a +} + +// CHECK-LABEL: define{{.*}} i32 @check3( +// CHECK: %[[C3:.*]] = call [2 x i64] @bar3( +// CHECK: store [2 x i64] %[[C3]] +#[no_mangle] +extern "C" fn check3(a: i32, b: i32, c: i32) -> i32 { + let v = bar3(a, b, c); + hint::black_box(v); + v.a +} diff --git a/tests/codegen-llvm/bpf-abi/struct-return.rs b/tests/codegen-llvm/bpf-abi/struct-return.rs new file mode 100644 index 0000000000000..46871a93aacc8 --- /dev/null +++ b/tests/codegen-llvm/bpf-abi/struct-return.rs @@ -0,0 +1,95 @@ +//@ add-minicore +//@ revisions: bpfel bpfeb +//@[bpfel] compile-flags: --target=bpfel-unknown-none +//@[bpfeb] compile-flags: --target=bpfeb-unknown-none +//@ needs-llvm-components: bpf +//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes +//@ min-llvm-version: 23 +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] + +extern crate minicore; +use minicore::*; + +#[repr(C)] +struct T1 {} + +#[repr(C)] +struct T2 { + a: i32, +} +impl Copy for T2 {} + +#[repr(C)] +struct T3 { + a: i32, + b: i64, +} + +#[repr(C)] +struct T4 { + a: i64, + b: i64, + c: i64, +} + +#[repr(C)] +struct T5 { + a: i8, +} + +#[repr(C)] +union U1 { + a: i32, + b: i64, +} + +// CHECK: define{{.*}} void @foo1() +#[no_mangle] +extern "C" fn foo1() -> T1 { + T1 {} +} + +// CHECK: define{{.*}} i32 @foo2() +#[no_mangle] +extern "C" fn foo2() -> T2 { + T2 { a: 0 } +} + +// CHECK: define{{.*}} [2 x i64] @foo3() +#[no_mangle] +extern "C" fn foo3() -> T3 { + T3 { a: 0, b: 0 } +} + +// CHECK: define{{.*}} void @foo4(ptr{{.*}}sret([24 x i8]){{.*}}align 8 +#[no_mangle] +extern "C" fn foo4() -> T4 { + T4 { a: 0, b: 0, c: 0 } +} + +// CHECK: define{{.*}} i8 @foo5() +#[no_mangle] +extern "C" fn foo5() -> T5 { + T5 { a: 0 } +} + +// CHECK: define{{.*}} i64 @foou() +#[no_mangle] +extern "C" fn foou() -> U1 { + U1 { b: 0 } +} + +// CHECK-LABEL: define{{.*}} i32 @bar() +// CHECK: %[[C2:.*]] = call i32 @foo2() +// CHECK: store i32 %[[C2]] +// CHECK: %[[C3:.*]] = call [2 x i64] @foo3() +// CHECK: store [2 x i64] %[[C3]] +#[no_mangle] +extern "C" fn bar() -> i32 { + let a = foo2(); + let b = foo3(); + hint::black_box((a, b)); + a.a +} diff --git a/tests/ui-fulldeps/derive-encodable.rs b/tests/ui-fulldeps/derive-encodable.rs new file mode 100644 index 0000000000000..daf27cb17b867 --- /dev/null +++ b/tests/ui-fulldeps/derive-encodable.rs @@ -0,0 +1,43 @@ +//@ edition: 2024 +//@ check-pass +//@ compile-flags: -Zunpretty=expanded + +#![crate_type = "rlib"] +#![feature(rustc_private)] + +extern crate rustc_macros; +extern crate rustc_serialize; +extern crate rustc_span; + +use rustc_macros::Encodable; + +#[derive(Encodable)] +struct UnitStruct; + +#[derive(Encodable)] +struct EmptyStruct {} + +#[derive(Encodable)] +enum EmptyEnum {} + +#[derive(Encodable)] +enum SingleFieldlessEnum { + A, +} + +#[derive(Encodable)] +enum SingleEnum { + A(u32), +} + +#[derive(Encodable)] +enum FieldlessEnum { + A, + B, +} + +#[derive(Encodable)] +enum PartlyFieldlessEnum { + A, + B(u32), +} diff --git a/tests/ui-fulldeps/derive-encodable.stdout b/tests/ui-fulldeps/derive-encodable.stdout new file mode 100644 index 0000000000000..50700ab15f9c5 --- /dev/null +++ b/tests/ui-fulldeps/derive-encodable.stdout @@ -0,0 +1,104 @@ +#![feature(prelude_import)] +//@ edition: 2024 +//@ check-pass +//@ compile-flags: -Zunpretty=expanded + +#![crate_type = "rlib"] +#![feature(rustc_private)] +extern crate std; +#[prelude_import] +use std::prelude::rust_2024::*; + +extern crate rustc_macros; +extern crate rustc_serialize; +extern crate rustc_span; + +use rustc_macros::Encodable; + +struct UnitStruct; +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for UnitStruct { + fn encode(&self, __encoder: &mut __E) {} + } + }; + +struct EmptyStruct {} +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for EmptyStruct { + fn encode(&self, __encoder: &mut __E) {} + } + }; + +enum EmptyEnum {} +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for EmptyEnum { + fn encode(&self, __encoder: &mut __E) {} + } + }; + +enum SingleFieldlessEnum { A, } +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for SingleFieldlessEnum { + fn encode(&self, __encoder: &mut __E) {} + } + }; + +enum SingleEnum { A(u32), } +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for SingleEnum { + fn encode(&self, __encoder: &mut __E) { + let SingleEnum::A(ref __binding_0) = *self; + ::rustc_serialize::Encodable::<__E>::encode(__binding_0, + __encoder); + } + } + }; + +enum FieldlessEnum { A, B, } +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for FieldlessEnum { + fn encode(&self, __encoder: &mut __E) { + let disc = + match *self { + FieldlessEnum::A => { 0usize } + FieldlessEnum::B => { 1usize } + }; + ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8); + } + } + }; + +enum PartlyFieldlessEnum { A, B(u32), } +const _: () = + { + impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E> + for PartlyFieldlessEnum { + fn encode(&self, __encoder: &mut __E) { + let disc = + match *self { + PartlyFieldlessEnum::A => { 0usize } + PartlyFieldlessEnum::B(ref __binding_0) => { 1usize } + }; + ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8); + match *self { + PartlyFieldlessEnum::A => {} + PartlyFieldlessEnum::B(ref __binding_0) => { + ::rustc_serialize::Encodable::<__E>::encode(__binding_0, + __encoder); + } + } + } + } + }; diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.control-flow-guard-future-allow-reset-by-mitigation.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.control-flow-guard-future-allow-reset-by-mitigation.stderr index 1103e17a17f59..bdb8962a408a7 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.control-flow-guard-future-allow-reset-by-mitigation.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.control-flow-guard-future-allow-reset-by-mitigation.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `core`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `alloc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `compiler_builtins`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `unwind/libc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.rs b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.rs index 09fe013cfdd34..3d8b39145ec8d 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.rs +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.rs @@ -35,8 +35,8 @@ //@ [stack-protector-future-deny-allow-reset-by-mitigation] compile-flags: -Z unstable-options -Z deny-partial-mitigations=stack-protector -Z allow-partial-mitigations=stack-protector -Z stack-protector=all fn main() {} -//~^ ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-allow-then-deny.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-allow-then-deny.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-allow-then-deny.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-allow-then-deny.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-but-allow-control-flow-guard.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-but-allow-control-flow-guard.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-but-allow-control-flow-guard.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-but-allow-control-flow-guard.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-allow-reset-by-mitigation.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-allow-reset-by-mitigation.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-allow-reset-by-mitigation.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-allow-reset-by-mitigation.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-allow-reset-by-mitigation.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-allow-reset-by-mitigation.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-allow-reset-by-mitigation.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-allow-reset-by-mitigation.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-reset-by-mitigation.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-reset-by-mitigation.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-reset-by-mitigation.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-deny-reset-by-mitigation.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-explicit-deny.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-explicit-deny.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-explicit-deny.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future-explicit-deny.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future.stderr index 3fde64abb2f36..cb791558ad1bb 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-1-error.stack-protector-future.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-1-error.rs:37:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.both.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.both.stderr index acc9dd234c693..2d7f3f904101a 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.both.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.both.stderr @@ -1,89 +1,49 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `std`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-separately-disable-together.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-separately-disable-together.stderr index acc9dd234c693..2d7f3f904101a 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-separately-disable-together.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-separately-disable-together.stderr @@ -1,89 +1,49 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `std`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-together-disable-separately.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-together-disable-separately.stderr index acc9dd234c693..2d7f3f904101a 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-together-disable-separately.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.enable-together-disable-separately.stderr @@ -1,89 +1,49 @@ error: your program uses the crate `std`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `std`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `core`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `core`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `alloc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `alloc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `compiler_builtins`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `compiler_builtins`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `unwind/libc`, that is not compiled with `stack-protector=all` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `stack-protector=all` enabled, or use `-Z allow-partial-mitigations=stack-protector` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=stack-protector` via `-Z deny-partial-mitigations=stack-protector` error: your program uses the crate `unwind/libc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-2-errors.rs:21:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.rs b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.rs index 3424ed2a8dd9c..8562bd1660034 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.rs +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-2-errors.rs @@ -19,13 +19,13 @@ //@ [enable-together-disable-separately] compile-flags: -Z unstable-options -C control-flow-guard=on -Z stack-protector=all -Z allow-partial-mitigations=stack-protector,control-flow-guard -Z deny-partial-mitigations=control-flow-guard -Z deny-partial-mitigations=stack-protector fn main() {} -//~^ ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.control-flow-2024-explicit-deny.stderr b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.control-flow-2024-explicit-deny.stderr index 8f19f30d76569..bdb8962a408a7 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.control-flow-2024-explicit-deny.stderr +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.control-flow-2024-explicit-deny.stderr @@ -1,44 +1,24 @@ error: your program uses the crate `std`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-current-edition.rs:18:1 - | -LL | fn main() {} - | ^ | = note: recompile `std` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `core`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-current-edition.rs:18:1 - | -LL | fn main() {} - | ^ | = note: recompile `core` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `alloc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-current-edition.rs:18:1 - | -LL | fn main() {} - | ^ | = note: recompile `alloc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `compiler_builtins`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-current-edition.rs:18:1 - | -LL | fn main() {} - | ^ | = note: recompile `compiler_builtins` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` error: your program uses the crate `unwind/libc`, that is not compiled with `control-flow-guard` enabled - --> $DIR/err-allow-partial-mitigations-current-edition.rs:18:1 - | -LL | fn main() {} - | ^ | = note: recompile `unwind/libc` with `control-flow-guard` enabled, or use `-Z allow-partial-mitigations=control-flow-guard` to allow creating an artifact that has the mitigation partially enabled = help: it is possible to disable `-Z allow-partial-mitigations=control-flow-guard` via `-Z deny-partial-mitigations=control-flow-guard` diff --git a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.rs b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.rs index a9dc29290d7b4..f400319f39efe 100644 --- a/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.rs +++ b/tests/ui/allow-partial-mitigations/err-allow-partial-mitigations-current-edition.rs @@ -16,8 +16,8 @@ fn main() {} -//~^ ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with -//~| ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with +//~? ERROR that is not compiled with diff --git a/tests/ui/inference/multiple-impl-apply.rs b/tests/ui/inference/multiple-impl-apply.rs index 314fe0f2ae510..d96ee635317a7 100644 --- a/tests/ui/inference/multiple-impl-apply.rs +++ b/tests/ui/inference/multiple-impl-apply.rs @@ -46,3 +46,56 @@ fn main() { fn magic_foo(arg: Baz) -> Foo { arg.into() } + +struct Value; + +impl PartialEq for u32 { + fn eq(&self, _: &Value) -> bool { + false + } +} + +impl PartialEq for Value { + fn eq(&self, _: &u32) -> bool { + false + } +} + +// https://github.com/rust-lang/rust/issues/156004 +fn partial_eq_with_infer_cast_on_rhs() { + let n: u32 = 17; + let _ = n == 42usize as _; //~ ERROR E0283 +} + +fn partial_eq_with_infer_cast_on_lhs() { + let n: u32 = 17; + let _ = 42usize as _ == n; //~ ERROR E0283 +} + +fn unrelated_infer_cast_in_lhs() { + let n: u32 = 17; + let _ = ( + { + let _ = 42usize as _; //~ ERROR E0282 + Default::default() + } + ) == n; +} + +struct AddRhs; + +impl std::ops::Add for u32 { + type Output = (); + + fn add(self, _: AddRhs) {} +} + +impl std::ops::Add for i32 { + type Output = (); + + fn add(self, _: AddRhs) {} +} + +fn add_with_infer_cast_on_lhs() { + let _: () = 42usize as _ + AddRhs; //~ ERROR E0283 +} diff --git a/tests/ui/inference/multiple-impl-apply.stderr b/tests/ui/inference/multiple-impl-apply.stderr index 1a81955e1e88c..b45ca48e62268 100644 --- a/tests/ui/inference/multiple-impl-apply.stderr +++ b/tests/ui/inference/multiple-impl-apply.stderr @@ -18,6 +18,59 @@ help: consider giving `y` an explicit type LL | let y: /* Type */ = x.into(); | ++++++++++++ -error: aborting due to 1 previous error +error[E0283]: type annotations needed + --> $DIR/multiple-impl-apply.rs:67:29 + | +LL | let _ = n == 42usize as _; + | ^ cannot infer type + | +note: multiple `impl`s satisfying `u32: PartialEq<_>` found + --> $DIR/multiple-impl-apply.rs:52:1 + | +LL | impl PartialEq for u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: and another `impl` found in the `core` crate: `impl PartialEq for u32;` + +error[E0283]: type annotations needed + --> $DIR/multiple-impl-apply.rs:72:24 + | +LL | let _ = 42usize as _ == n; + | ^ cannot infer type + | +note: multiple `impl`s satisfying `_: PartialEq` found + --> $DIR/multiple-impl-apply.rs:58:1 + | +LL | impl PartialEq for Value { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: and another `impl` found in the `core` crate: `impl PartialEq for u32;` + +error[E0282]: type annotations needed + --> $DIR/multiple-impl-apply.rs:79:17 + | +LL | let _ = 42usize as _; + | ^ - type must be known at this point + | +help: consider giving this pattern a type + | +LL | let _: /* Type */ = 42usize as _; + | ++++++++++++ + +error[E0283]: type annotations needed + --> $DIR/multiple-impl-apply.rs:100:28 + | +LL | let _: () = 42usize as _ + AddRhs; + | ^ cannot infer type + | +note: multiple `impl`s satisfying `_: Add` found + --> $DIR/multiple-impl-apply.rs:87:1 + | +LL | impl std::ops::Add for u32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | impl std::ops::Add for i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0283`. +Some errors have detailed explanations: E0282, E0283. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/missing/missing-items/auxiliary/randmock.rs b/tests/ui/missing/missing-items/auxiliary/randmock.rs new file mode 100644 index 0000000000000..a2215bb775f07 --- /dev/null +++ b/tests/ui/missing/missing-items/auxiliary/randmock.rs @@ -0,0 +1,4 @@ +pub trait SecondTestTrait{} +pub trait TestTrait { + fn test(&self, rng: &mut R) -> T; +} diff --git a/tests/ui/missing/missing-items/missing-size-bound-issue-85643.rs b/tests/ui/missing/missing-items/missing-size-bound-issue-85643.rs new file mode 100644 index 0000000000000..d2f792867da9b --- /dev/null +++ b/tests/ui/missing/missing-items/missing-size-bound-issue-85643.rs @@ -0,0 +1,15 @@ +// Regression test for issue https://github.com/rust-lang/rust/issues/85643 +// where ?Sized bound is missing from suggestion + +//@ aux-build: randmock.rs + +extern crate randmock; + +use randmock::*; + +struct D; + +impl TestTrait<()> for D {} +//~^ ERROR not all trait items implemented, missing: `test` +//~| HELP implement the missing item: `fn test(&self, _: &mut R) where R: ?Sized, R: SecondTestTrait { todo!() }` +fn main() {} diff --git a/tests/ui/missing/missing-items/missing-size-bound-issue-85643.stderr b/tests/ui/missing/missing-items/missing-size-bound-issue-85643.stderr new file mode 100644 index 0000000000000..ee0a63eed9243 --- /dev/null +++ b/tests/ui/missing/missing-items/missing-size-bound-issue-85643.stderr @@ -0,0 +1,11 @@ +error[E0046]: not all trait items implemented, missing: `test` + --> $DIR/missing-size-bound-issue-85643.rs:12:1 + | +LL | impl TestTrait<()> for D {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ missing `test` in implementation + | + = help: implement the missing item: `fn test(&self, _: &mut R) where R: ?Sized, R: SecondTestTrait { todo!() }` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0046`.