diff --git a/compiler/rustc_abi/src/callconv.rs b/compiler/rustc_abi/src/callconv.rs index 1bab82667232b..c6f1819405f68 100644 --- a/compiler/rustc_abi/src/callconv.rs +++ b/compiler/rustc_abi/src/callconv.rs @@ -1,5 +1,5 @@ #[cfg(feature = "nightly")] -use crate::{BackendRepr, FieldsShape, Primitive, Size, TyAbiInterface, TyAndLayout, Variants}; +use crate::{BackendRepr, FieldsShape, Size, TyAbiInterface, TyAndLayout, Variants}; mod reg; @@ -73,10 +73,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { match self.backend_repr { // The primitive for this algorithm. BackendRepr::Scalar(scalar) => { - let kind = match scalar.primitive() { - Primitive::Int(..) | Primitive::Pointer(_) => RegKind::Integer, - Primitive::Float(_) => RegKind::Float, - }; + let kind = RegKind::from_primitive(scalar.primitive()); Ok(HomogeneousAggregate::Homogeneous(Reg { kind, size: self.size })) } diff --git a/compiler/rustc_abi/src/callconv/reg.rs b/compiler/rustc_abi/src/callconv/reg.rs index a408aa034e785..5c6715c43caa7 100644 --- a/compiler/rustc_abi/src/callconv/reg.rs +++ b/compiler/rustc_abi/src/callconv/reg.rs @@ -1,13 +1,19 @@ #[cfg(feature = "nightly")] use rustc_macros::StableHash; -use crate::{Align, HasDataLayout, Integer, Primitive, Size}; +use crate::{Align, Float, HasDataLayout, Integer, Primitive, Size}; +/// The "kind" of backend type, which combined with a [`Size`] forms a [`Reg`]. #[cfg_attr(feature = "nightly", derive(StableHash))] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub enum RegKind { Integer, Float, + /// The IBM extended-precision format: a pair of `f64`s, each passed in its own register. + /// This variant is needed to distinguish IEEE f128 and IBM f128 in the backends. + /// + /// Only used on PowerPC targets. + PpcF128, Vector { /// The `hint_vector_elem` is strictly for optimization purposes. E.g. it can be used by /// a codegen backend to prevent extra bitcasts that obscure a pattern. Alternatively, @@ -20,11 +26,15 @@ impl RegKind { pub fn from_primitive(primitive: Primitive) -> Self { match primitive { Primitive::Int(..) | Primitive::Pointer(_) => RegKind::Integer, - Primitive::Float(_) => RegKind::Float, + Primitive::Float(Float::PpcF128) => RegKind::PpcF128, + Primitive::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { + RegKind::Float + } } } } +/// A combination of a [`RegKind`] and a [`Size`] that represents a builtin type in the backend. #[cfg_attr(feature = "nightly", derive(StableHash))] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct Reg { @@ -79,6 +89,7 @@ impl Reg { 128 => dl.f128_align, _ => panic!("unsupported float: {self:?}"), }, + RegKind::PpcF128 => dl.f128_align, RegKind::Vector { .. } => dl.rust_vector_align(self.size), } } diff --git a/compiler/rustc_abi/src/layout/ty.rs b/compiler/rustc_abi/src/layout/ty.rs index b8928aecf0cc5..f96bfa5cd738c 100644 --- a/compiler/rustc_abi/src/layout/ty.rs +++ b/compiler/rustc_abi/src/layout/ty.rs @@ -339,9 +339,9 @@ impl<'a, Ty> TyAndLayout<'a, Ty> { let primitive = scalar.primitive(); match primitive { Primitive::Int(integer, is_signed) => Some(Numeric::Int(integer, is_signed)), - Primitive::Float(float @ (Float::F16 | Float::F32 | Float::F64 | Float::F128)) => { - Some(Numeric::Float(float)) - } + Primitive::Float( + float @ (Float::F16 | Float::F32 | Float::F64 | Float::F128 | Float::PpcF128), + ) => Some(Numeric::Float(float)), Primitive::Pointer(..) | Primitive::Float(Float::F16B) => None, } } diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 3804f4281a9bb..34adfc0606043 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1427,6 +1427,10 @@ pub enum Float { F32, F64, F128, + /// `ppcf128`. This is not a builtin type in Rust (it is exposed as a lang item), + /// but it is a builtin type in LLVM so needs to be explicitly represented + /// in the backend. + PpcF128, } impl Float { @@ -1439,6 +1443,7 @@ impl Float { F32 => Size::from_bits(32), F64 => Size::from_bits(64), F128 => Size::from_bits(128), + PpcF128 => Size::from_bits(128), } } @@ -1451,6 +1456,7 @@ impl Float { F32 => dl.f32_align, F64 => dl.f64_align, F128 => dl.f128_align, + PpcF128 => dl.f128_align, }) } @@ -1463,6 +1469,7 @@ impl Float { F32 => "f32", F64 => "f64", F128 => "f128", + PpcF128 => "ppcf128", } } } @@ -1487,7 +1494,10 @@ impl Numeric { pub fn reg_kind(self) -> RegKind { match self { Numeric::Int(_, _) => RegKind::Integer, - Numeric::Float(_) => RegKind::Float, + Numeric::Float(Float::PpcF128) => RegKind::PpcF128, + Numeric::Float(Float::F16 | Float::F16B | Float::F32 | Float::F64 | Float::F128) => { + RegKind::Float + } } } } diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 6a86e9af71826..4c7ae87556f76 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -124,6 +124,11 @@ impl StableHash for Path { self.segments.len().stable_hash(hcx, hasher); for segment in &self.segments { segment.ident.stable_hash(hcx, hasher); + if segment.args.is_some() { + // This should never happen, because Path::stable_hash is only used for attributes, + // which never have generic args. Check that to make sure, though. + panic!("Paths with generic args should not appear in incremental state"); + } } } } @@ -4072,7 +4077,7 @@ pub struct TestBinderBody { pub exists: ThinVec, pub constraints: Vec, /// These are not where clauses, but rather predicates within the body to be proven - pub predicates: Vec, + pub predicates: Vec, } #[derive(Clone, Encodable, Decodable, Debug, Walkable)] @@ -4100,6 +4105,9 @@ pub enum TestBinderConstraint { Or { items: ThinVec, }, + Ambiguity { + span: Span, + }, Lifetime { #[visitable(extra = LifetimeCtxt::Bound)] lhs: Lifetime, diff --git a/compiler/rustc_ast_lowering/src/delegation/resolution.rs b/compiler/rustc_ast_lowering/src/delegation/resolution.rs index 7678418c47e56..8e35b05d7e870 100644 --- a/compiler/rustc_ast_lowering/src/delegation/resolution.rs +++ b/compiler/rustc_ast_lowering/src/delegation/resolution.rs @@ -4,7 +4,6 @@ use ast::visit::Visitor; use hir::def::DefKind; use rustc_ast::{self as ast, AssocItemKind, Delegation, DelegationSource, Item, ItemKind, NodeId}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; -use rustc_data_structures::steal::Steal; use rustc_hir as hir; use rustc_middle::middle::resolve::{ self as mid_res, AstOwner, DelegationInherentFnKind, TypeRelativeDelegationRes, @@ -53,9 +52,10 @@ pub(crate) fn resolve_type_relative_delegations( // Also record resolutions for cases when signature is resolved but call path is not. mid_res::DelegationResolution::Partial | mid_res::DelegationResolution::PartialCall(_) => { - let Some(r_and_owner) = ast_index.get(def_id).map(Steal::borrow) else { - unreachable!("ast index must contain delegations"); - }; + let r_and_owner = ast_index[def_id] + .as_ref() + .expect("ast index must contain delegations") + .borrow(); let (r, owner) = &*r_and_owner; diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 9698ab0aedb83..9cea3519cf94e 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -2003,7 +2003,6 @@ impl<'hir> LoweringContext<'_, 'hir> { let predicates = self.arena.alloc_from_iter( body.predicates .iter() - .flat_map(|w| &w.predicates) .map(|predicate| self.lower_where_predicate(predicate, &[], &mut dedup_map)), ); hir::TestBinderBody { foralls, exists, constraints, predicates } @@ -2083,6 +2082,9 @@ impl<'hir> LoweringContext<'_, 'hir> { items.iter().map(|item| self.lower_test_binder_constraint(item)), ), }, + TestBinderConstraint::Ambiguity { span } => { + hir::TestBinderConstraint::Ambiguity { span: self.lower_span(*span) } + } TestBinderConstraint::Lifetime { lhs, rhs } => { let lhs = self.lower_lifetime(lhs, LifetimeSource::Other, lhs.ident.into()); let rhs = self.lower_lifetime(rhs, LifetimeSource::OutlivesBound, rhs.ident.into()); diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index b6d1017665ec6..a99db03007b51 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -587,7 +587,7 @@ enum TryBlockScope { fn index_ast<'tcx>( tcx: TyCtxt<'tcx>, (): (), -) -> &'tcx IndexSlice>, AstOwner)>> { +) -> &'tcx IndexSlice>, AstOwner)>>> { // Queries that borrow `resolver_for_lowering`. tcx.ensure_done().output_filenames(()); tcx.ensure_done().early_lint_checks(()); @@ -610,20 +610,19 @@ fn index_ast<'tcx>( let index = indexer.index; let resolver = Arc::new(resolver); return tcx.arena.alloc_index_slice_from_iter::( - index.into_iter().map(|owner| Steal::new((Arc::clone(&resolver), owner))), + index.into_iter().map(|owner| owner.map(|o| Steal::new((Arc::clone(&resolver), o)))), ); struct Indexer<'s, 'hir> { owners: &'s NodeMap>, - index: IndexVec, + index: IndexVec>, next_node_id: NodeId, } impl Indexer<'_, '_> { fn insert(&mut self, id: NodeId, node: AstOwner) { let def_id = self.owners[&id].def_id; - self.index.ensure_contains_elem(def_id, || AstOwner::NonOwner); - self.index[def_id] = node; + self.index.insert(def_id, node); } fn make_dummy( @@ -705,7 +704,7 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> { tcx.ensure_done().resolve_type_relative_delegations(()); let ast_index = tcx.index_ast(()); - let resolver_and_node = ast_index.get(def_id).map(Steal::steal); + let resolver_and_node = ast_index.get(def_id); let fallback_to_ancestor = || { // The item did not exist in the AST, it was created while lowering another item. @@ -732,10 +731,13 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> { }) }; - let Some((resolver, node)) = resolver_and_node else { + let Some(Some(r_and_node)) = resolver_and_node else { // `ast_index` does not contain all definitions, only up-to the highest // `LocalDefId` which has a non-trivial `AstOwner`. Gracefully handle // other definitions, in particular those nested inside this highest definition. + // OR + // The item existed in the AST, but is not a HIR owner. + // Fetch the correct information from its parent. return fallback_to_ancestor(); }; @@ -750,6 +752,8 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> { hir::MaybeOwner::Owner(lctx.curr_owner.into_owner_info(tcx, item)) } + let (resolver, node) = r_and_node.steal(); + let item = match &node { // The item existed in the AST. AstOwner::Crate(c) => with_lctx(tcx, &*resolver, CRATE_NODE_ID, |lctx| { @@ -770,9 +774,6 @@ fn lower_to_hir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::MaybeOwner<'_> { AstOwner::ForeignItem(item) => with_lctx(tcx, &*resolver, item.id, |lctx| { hir::OwnerNode::ForeignItem(lctx.lower_foreign_item(item)) }), - // The item existed in the AST, but is not a HIR owner. - // Fetch the correct information from its parent. - AstOwner::NonOwner => fallback_to_ancestor(), }; tcx.sess.time("drop_ast", || mem::drop(node)); diff --git a/compiler/rustc_attr_ir/src/lang_items.rs b/compiler/rustc_attr_ir/src/lang_items.rs index 60890f7799290..d715a6d3af8c5 100644 --- a/compiler/rustc_attr_ir/src/lang_items.rs +++ b/compiler/rustc_attr_ir/src/lang_items.rs @@ -237,6 +237,7 @@ language_item_table! { VaList, sym::va_list, va_list, Target::Struct, GenericRequirement::None; Complex, sym::complex, complex, Target::Struct, GenericRequirement::Exact(1); + PpcF128, sym::ppcf128, ppcf128, Target::Struct, GenericRequirement::None; Deref, sym::deref, deref_trait, Target::Trait, GenericRequirement::Exact(0); DerefMut, sym::deref_mut, deref_mut_trait, Target::Trait, GenericRequirement::Exact(0); diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index 30bd2f28af53f..94a71c65ce261 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -39,6 +39,7 @@ pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type { Float::F32 => types::F32, Float::F64 => types::F64, Float::F128 => types::F128, + Float::PpcF128 => bug!("cranelift does not support powerpc"), }, // FIXME(erikdesjardins): handle non-default addrspace ptr sizes Primitive::Pointer(_) => pointer_ty(tcx), diff --git a/compiler/rustc_codegen_gcc/src/abi.rs b/compiler/rustc_codegen_gcc/src/abi.rs index 5b88cebb4f174..b9d77c63cc08e 100644 --- a/compiler/rustc_codegen_gcc/src/abi.rs +++ b/compiler/rustc_codegen_gcc/src/abi.rs @@ -90,6 +90,7 @@ impl GccType for Reg { 64 => cx.type_f64(), _ => bug!("unsupported float: {:?}", self), }, + RegKind::PpcF128 => cx.type_ppcf128(), RegKind::Vector { hint_vector_elem: _ } => { cx.type_vector(cx.type_i8(), self.size.bytes()) } diff --git a/compiler/rustc_codegen_gcc/src/type_.rs b/compiler/rustc_codegen_gcc/src/type_.rs index 05f712f1064c7..70ae6d004ebe5 100644 --- a/compiler/rustc_codegen_gcc/src/type_.rs +++ b/compiler/rustc_codegen_gcc/src/type_.rs @@ -267,6 +267,12 @@ impl<'gcc, 'tcx> BaseTypeCodegenMethods for CodegenCx<'gcc, 'tcx> { bug!("unsupported float width 128") } + fn type_ppcf128(&self) -> Type<'gcc> { + // FIXME(ppcf128): The GCC gcc_jit_types enum (which CType is based on) does not + // have __ibm128. It does have long double but it may not correspond to ppc f128. + bug!("unsupported ppcf128 type") + } + fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> { self.context.new_function_pointer_type(None, return_type, params, false) } diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 19e6a3314f20a..4cee59c0da1c8 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -147,6 +147,7 @@ impl LlvmType for Reg { 128 => cx.type_f128(), _ => bug!("unsupported float: {:?}", self), }, + RegKind::PpcF128 => cx.type_ppcf128(), RegKind::Vector { hint_vector_elem } => { // NOTE: it is valid to ignore the element type hint (and always pick i8). // But providing a more accurate type means fewer casts in LLVM IR, @@ -165,6 +166,7 @@ impl LlvmType for Reg { Float::F32 => cx.type_f32(), Float::F64 => cx.type_f64(), Float::F128 => cx.type_f128(), + Float::PpcF128 => bug!("ppcf128 is not a valid vector element type"), }, Primitive::Pointer(_) => cx.type_ptr(), }; diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index b7c930502978e..928d57065d173 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -2187,9 +2187,8 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { llfn: &'ll Value, fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, ) -> Option> { - if self.sess().pointer_authentication_functions().is_none() { - return None; - } + let schema = self.sess().pointer_authentication_functions()?; + // Pointer authentication support is currently limited to extern "C" calls; filter out other // ABIs. if fn_abi?.conv != CanonAbi::C { @@ -2207,11 +2206,12 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { // bundles. // Once this is resolved, we should analyze each call and skip direct calls. See the // discussion in the rust-lang issue: - let key: u32 = 0; - let discriminator: u64 = 0; Some(llvm::OperandBundleBox::new( "ptrauth", - &[self.const_u32(key), self.const_u64(discriminator)], + &[ + self.const_u32(schema.key as u32), + self.const_u64(schema.constant_discriminator as u64), + ], )) } diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index ec58c3cb6ad7a..6513cc0542ea5 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -212,7 +212,7 @@ fn check_and_apply_linkage<'ll, 'tcx>( let fn_sig = sig.with(*header); let fn_abi = cx.fn_abi_of_fn_ptr(fn_sig, ty::List::empty()); // Decide if the initializer needs to be signed - if cx.sess().pointer_authentication() + if cx.sess().pointer_authentication_functions().is_some() && matches!(fn_sig.abi(), ExternAbi::C { .. } | ExternAbi::System { .. }) { should_sign = true; @@ -249,13 +249,16 @@ fn check_and_apply_linkage<'ll, 'tcx>( // Sign the function pointer that is used to initialize the global let initializer = if should_sign { - let key: u32 = 0; - let discriminator: u64 = 0; + let schema = cx + .tcx + .sess + .pointer_authentication_functions() + .expect("pointer authentication functions must be available when signing"); const_ptr_auth( cx.const_bitcast(g1, llty), - key, - discriminator, + schema.key as u32, + schema.constant_discriminator as u64, None, /* address_diversity */ ) } else { diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index da0460b2a9290..3bdce957a5e65 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -350,6 +350,10 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { Primitive::Float(Float::F128) => { // Supported on some targets, especially where long double is IEEE f128. } + Primitive::Float(Float::PpcF128) => { + // FIXME(ppcf128) we should support this. + bug!("the va_arg intrinsic does not currently support `ppcf128`") + } } emit_va_arg(self, args[0], result_layout) diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index f576f29a17cca..d20f43c3c2707 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -946,6 +946,7 @@ unsafe extern "C" { // Operations on non-IEEE real types pub(crate) fn LLVMBFloatTypeInContext(C: &Context) -> &Type; + pub(crate) fn LLVMPPCFP128TypeInContext(C: &Context) -> &Type; // Operations on function types pub(crate) fn LLVMFunctionType<'a>( diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index ff1b5851db0f9..f03eb3d4a36fa 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -230,6 +230,10 @@ impl<'ll, CX: Borrow>> BaseTypeCodegenMethods for GenericCx<'ll, CX> { unsafe { llvm::LLVMFP128TypeInContext(self.llcx()) } } + fn type_ppcf128(&self) -> &'ll Type { + unsafe { llvm::LLVMPPCFP128TypeInContext(self.llcx()) } + } + fn type_func(&self, args: &[&'ll Type], ret: &'ll Type) -> &'ll Type { unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, FALSE) } } diff --git a/compiler/rustc_codegen_llvm/src/va_arg.rs b/compiler/rustc_codegen_llvm/src/va_arg.rs index 8408e2eefb13e..0617e6b3d98ef 100644 --- a/compiler/rustc_codegen_llvm/src/va_arg.rs +++ b/compiler/rustc_codegen_llvm/src/va_arg.rs @@ -96,8 +96,7 @@ fn get_param_type_alignment<'ll, 'tcx>( }, Primitive::Float(float) => match float { Float::F16 | Float::F16B | Float::F32 => unreachable!(), - Float::F64 => { /* fall through */ } - Float::F128 => return Align::from_bytes(16).unwrap(), + Float::F64 | Float::F128 | Float::PpcF128 => { /* fall through */ } }, Primitive::Pointer(_) => { /* fall through */ } }, @@ -471,6 +470,9 @@ fn emit_s390x_va_arg<'ll, 'tcx>( Primitive::Float(Float::F16B) => { bug!("`f16b` use in varadics unsupported on s390x") } + Primitive::Float(Float::PpcF128) => { + bug!("`ppcf128` use in varadics unsupported on s390x") + } }, _ => false, diff --git a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs index 5433b9da6f2b6..5baefd23ad3b4 100644 --- a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs +++ b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs @@ -490,6 +490,7 @@ fn wasm_type<'tcx>(signature: &mut String, arg_abi: &ArgAbi<'_, Ty<'tcx>>, ptr_t ..=8 => "f64", _ => ptr_type, }, + RegKind::PpcF128 => bug!("not a valid wasm type"), RegKind::Vector { .. } => "v128", }; @@ -513,6 +514,7 @@ fn wasm_primitive(primitive: Primitive, ptr_type: &'static str) -> &'static str Float::F16 | Float::F32 => "f32", Float::F64 => "f64", Float::F128 => "i64, i64", + Float::PpcF128 => bug!("`ppcf128` unsupported on wasm"), }, Primitive::Pointer(_) => ptr_type, } diff --git a/compiler/rustc_codegen_ssa/src/traits/type_.rs b/compiler/rustc_codegen_ssa/src/traits/type_.rs index 986481e7f132f..c9b5cb7142978 100644 --- a/compiler/rustc_codegen_ssa/src/traits/type_.rs +++ b/compiler/rustc_codegen_ssa/src/traits/type_.rs @@ -22,6 +22,7 @@ pub trait BaseTypeCodegenMethods: BackendTypes { fn type_f32(&self) -> Self::Type; fn type_f64(&self) -> Self::Type; fn type_f128(&self) -> Self::Type; + fn type_ppcf128(&self) -> Self::Type; fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type; fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::FunctionSignature; @@ -72,6 +73,7 @@ pub trait DerivedTypeCodegenMethods<'tcx>: F32 => self.type_f32(), F64 => self.type_f64(), F128 => self.type_f128(), + PpcF128 => self.type_ppcf128(), } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 4f4ed83be06a3..ceb7f38c2a416 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -4556,6 +4556,7 @@ pub struct TestBinderExists<'hir> { pub enum TestBinderConstraint<'hir> { And { items: &'hir [TestBinderConstraint<'hir>] }, Or { items: &'hir [TestBinderConstraint<'hir>] }, + Ambiguity { span: Span }, Lifetime { lhs: &'hir Lifetime, rhs: &'hir Lifetime }, PlaceholderOutlives { lhs: &'hir Ty<'hir>, rhs: &'hir Lifetime }, AliasOutlives { bound_type_constraint: &'hir TestBinderBoundTypeConstraint<'hir> }, diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index ad96fe492e6e7..b404d1708b85b 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -1644,6 +1644,7 @@ pub fn walk_test_binder_constraint<'v, V: Visitor<'v>>( TestBinderConstraint::Or { items } => { walk_list!(visitor, visit_test_binder_constraint, *items) } + TestBinderConstraint::Ambiguity { span: _ } => {} TestBinderConstraint::Lifetime { lhs, rhs } => { try_visit!(visitor.visit_lifetime(lhs)); try_visit!(visitor.visit_lifetime(rhs)); diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index dc4b6a6fd319c..0af884207ddd6 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -2421,8 +2421,19 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> { #[instrument(level = "debug", skip(self))] fn check_test_binder_forall(&self, forall: TestBinderForall<'tcx>) { + let prev_u = self.infcx.universe(); self.infcx.enter_forall(forall.binder, |body| { - let u = self.infcx.universe(); + let u = if prev_u == self.infcx.universe() { + // `enter_forall` has some special cases to avoid creating universes + // in some cases for perf reasons. Not creating the universe unconditionally + // breaks calling `eagerly_handle_placeholders` later on in this function. + // + // See `test_infra_empty_forall.rs`. + self.infcx.create_next_universe() + } else { + self.infcx.universe() + }; + let mut builder = TransitiveRelationBuilder::default(); for &(r1, r2) in &body.region_outlives { builder.add(r1, r2); diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 1cd1fc356ca7d..51a45eb53aa27 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -448,6 +448,9 @@ impl<'tcx> ItemCtxt<'tcx> { .map(|item| self.lower_test_binder_constraint(item)) .reduce(SolverRegionConstraint::build_or) .unwrap_or(SolverRegionConstraint::new_false()), + rustc_hir::TestBinderConstraint::Ambiguity { span } => { + SolverRegionConstraint::new_ambig(*span) + } hir::TestBinderConstraint::Lifetime { lhs, rhs } => { let span = lhs.ident.span.to(rhs.ident.span); let lhs = self.lowerer().lower_lifetime(lhs, RegionInferReason::RegionPredicate); diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index a423b6bdca5b2..d2e6c4bbe2466 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -43,10 +43,10 @@ rustc_arena::declare_arena! { rustc_middle::middle::resolve::ResolverAstLowering<'tcx> >, index_ast: - rustc_data_structures::steal::Steal<( + Option>, rustc_middle::middle::resolve::AstOwner - )>, + )>>, crate_alone: rustc_data_structures::steal::Steal, crate_for_resolver: rustc_data_structures::steal::Steal<(rustc_ast::Crate, rustc_ast::AttrVec)>, resolutions: rustc_middle::middle::resolve::ResolverGlobalCtxt, diff --git a/compiler/rustc_middle/src/middle/resolve.rs b/compiler/rustc_middle/src/middle/resolve.rs index bafb45469a56e..013edbf24739a 100644 --- a/compiler/rustc_middle/src/middle/resolve.rs +++ b/compiler/rustc_middle/src/middle/resolve.rs @@ -332,8 +332,6 @@ pub type DocLinkResMap = FxIndexMap<(Symbol, Namespace), Option>>; /// is as good a place as any for it. #[derive(Debug)] pub enum AstOwner { - /// This definition does not correspond to a HIR owner. - NonOwner, Crate(Box), Item(Box), TraitItem(Box), diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index d9d618519446d..d0429df43d1dd 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -206,13 +206,11 @@ rustc_queries! { desc { "getting the resolver for lowering" } } - query index_ast(_: ()) -> &'tcx IndexSlice>, - AstOwner, - )>> { + // There is only a single `ResolverAstLowering` for all owners. + // We want to drop it once the whole HIR has been lowered. + // We rely on reference counting to know when all definitions have been stolen. + // None if the `LocalDefId` is not an owner. + query index_ast(_: ()) -> &'tcx IndexSlice>, AstOwner)>>> { eval_always no_hash desc { "getting the AST for lowering" } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 8806bf992fc0e..4ee2e5c7e3fdd 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -146,6 +146,11 @@ impl abi::Float { F32 => tcx.types.f32, F64 => tcx.types.f64, F128 => tcx.types.f128, + PpcF128 => Ty::new_adt( + tcx, + tcx.adt_def(tcx.require_lang_item(LangItem::PpcF128, DUMMY_SP)), + ty::List::empty(), + ), } } diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index b5fa022a527e5..e1b1f6f9ff68c 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1950,6 +1950,8 @@ fn op_to_prop_const<'tcx>( // Transmuting a constant is just an offset in the allocation. If the alignment of the // allocation is not enough, fallback to copying into a properly aligned value. && alloc.inner().align >= op.layout.align.abi + // If this is a packed field the offset must also be sufficiently aligned. + && offset.bytes().is_multiple_of(op.layout.align.abi.bytes()) { return Some(ConstValue::Indirect { alloc_id, offset }); } diff --git a/compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs b/compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs index 75c7513758cd0..ea19d36f5d0cf 100644 --- a/compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs +++ b/compiler/rustc_next_trait_solver/src/canonical/canonicalizer.rs @@ -13,12 +13,17 @@ use thin_vec::ThinVec; use crate::delegate::SolverDelegate; /// Does this have infer/placeholder/param, free regions or ReErased? +// We're explicitly checking for fresh types and consts to trigger an +// assert if they ever leak into the trait solver. They should never +// exist with the new solver. const NEEDS_CANONICAL: TypeFlags = TypeFlags::from_bits( TypeFlags::HAS_INFER.bits() | TypeFlags::HAS_PLACEHOLDER.bits() | TypeFlags::HAS_PARAM.bits() | TypeFlags::HAS_FREE_REGIONS.bits() - | TypeFlags::HAS_RE_ERASED.bits(), + | TypeFlags::HAS_RE_ERASED.bits() + | TypeFlags::HAS_TY_FRESH.bits() + | TypeFlags::HAS_CT_FRESH.bits(), ) .unwrap(); diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 5d2aa1bed5b6e..8dc679c3e62ca 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -1,6 +1,6 @@ use rustc_ast::{ self as ast, AttrVec, DUMMY_NODE_ID, GenericBounds, GenericParam, GenericParamKind, TyKind, - WhereClause, token, + WhereClause, WherePredicate, token, }; use rustc_errors::{Applicability, Diag, PResult}; use rustc_span::{Ident, Span, kw, sym}; @@ -411,15 +411,15 @@ impl<'a> Parser<'a> { &mut self, struct_: Option<(Ident, Span)>, ) -> PResult<'a, (WhereClause, Option>)> { - let mut where_clause = WhereClause { - has_where_token: false, - predicates: ThinVec::new(), - span: self.prev_token.span.shrink_to_hi(), - }; - let mut tuple_struct_body = None; - if !self.eat_keyword(exp!(Where)) { - return Ok((where_clause, None)); + return Ok(( + WhereClause { + has_where_token: false, + predicates: ThinVec::new(), + span: self.prev_token.span.shrink_to_hi(), + }, + None, + )); } if self.eat_noexpect(&token::Colon) { @@ -435,7 +435,6 @@ impl<'a> Parser<'a> { .emit(); } - where_clause.has_where_token = true; let where_lo = self.prev_token.span; // We are considering adding generics to the `where` keyword as an alternative higher-rank @@ -446,6 +445,24 @@ impl<'a> Parser<'a> { self.dcx().emit_err(diagnostics::WhereOnGenerics { span: generics.span }); } + let (predicates, tuple_struct_body) = + self.parse_where_clause_predicates(struct_, where_lo)?; + let where_clause = WhereClause { + has_where_token: true, + predicates, + span: where_lo.to(self.prev_token.span), + }; + Ok((where_clause, tuple_struct_body)) + } + + pub(super) fn parse_where_clause_predicates( + &mut self, + struct_: Option<(Ident, Span)>, + where_lo: Span, + ) -> PResult<'a, (ThinVec, Option>)> { + let mut predicates = ThinVec::new(); + let mut tuple_struct_body = None; + loop { let where_sp = where_lo.to(self.prev_token.span); let attrs = self.parse_outer_attributes()?; @@ -498,7 +515,7 @@ impl<'a> Parser<'a> { Ok((predicate, Trailing::No, UsePreAttrPos::No)) })?; match predicate { - Some(predicate) => where_clause.predicates.push(predicate), + Some(predicate) => predicates.push(predicate), None => break, } @@ -516,8 +533,7 @@ impl<'a> Parser<'a> { } } - where_clause.span = where_lo.to(self.prev_token.span); - Ok((where_clause, tuple_struct_body)) + Ok((predicates, tuple_struct_body)) } fn parse_ty_where_predicate_kind_or_recover_tuple_struct_body( diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 9fb16bc3fbf27..6d3d79bbe2b5c 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -2718,11 +2718,12 @@ impl<'a> Parser<'a> { let mut constraints = Vec::new(); let mut predicates = Vec::new(); self.parse_delim_comma_seq(exp!(OpenBrace), exp!(CloseBrace), |this| { - if this.check_keyword(exp!(Where)) { - predicates.push(this.parse_where_clause()?); - return Ok(()); - } match this.token.ident() { + Some((Ident { name: sym::predicates, .. }, IdentKind::Normal)) => { + let span = this.token.span; + this.bump(); + predicates.extend(this.parse_where_clause_predicates(None, span)?.0); + } Some((Ident { name: sym::forall, .. }, IdentKind::Normal)) => { foralls.push(this.parse_test_binder_forall()?) } @@ -2791,6 +2792,11 @@ impl<'a> Parser<'a> { .0; Ok(TestBinderConstraint::Or { items }) } + Some((Ident { name: sym::ambiguity, .. }, IdentKind::Normal)) => { + let span = self.token.span; + self.bump(); + Ok(TestBinderConstraint::Ambiguity { span }) + } _ if self.check_keyword(exp!(For)) => { let bound_type_constraint = self.parse_test_binder_bound_type_constraint()?; Ok(TestBinderConstraint::AliasOutlives { bound_type_constraint }) diff --git a/compiler/rustc_public/src/abi.rs b/compiler/rustc_public/src/abi.rs index 72387fce19797..0d698b1677535 100644 --- a/compiler/rustc_public/src/abi.rs +++ b/compiler/rustc_public/src/abi.rs @@ -512,6 +512,7 @@ pub enum FloatLength { F32, F64, F128, + PpcF128, } impl IntegerLength { @@ -533,6 +534,7 @@ impl FloatLength { FloatLength::F32 => 32, FloatLength::F64 => 64, FloatLength::F128 => 128, + FloatLength::PpcF128 => 128, } } } diff --git a/compiler/rustc_public/src/unstable/convert/stable/abi.rs b/compiler/rustc_public/src/unstable/convert/stable/abi.rs index 1ac0b706ed091..277d71305cfc6 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/abi.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/abi.rs @@ -244,6 +244,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Reg { kind: match self.kind { rustc_abi::RegKind::Integer => RegKind::Integer, rustc_abi::RegKind::Float => RegKind::Float, + rustc_abi::RegKind::PpcF128 => RegKind::Float, rustc_abi::RegKind::Vector { .. } => RegKind::Vector, }, size: Size::from_bits(self.size.bits_usize()), @@ -486,6 +487,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::Float { rustc_abi::Float::F32 => FloatLength::F32, rustc_abi::Float::F64 => FloatLength::F64, rustc_abi::Float::F128 => FloatLength::F128, + rustc_abi::Float::PpcF128 => FloatLength::PpcF128, } } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index fa59c1c54ee89..b36e13b66ba78 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -427,6 +427,7 @@ symbols! { altivec, alu32, always, + ambiguity, amdgpu, amdgpu_dispatch_ptr, analysis, @@ -1633,6 +1634,7 @@ symbols! { powif32, powif64, powif128, + ppcf128, pre_dash_lto: "pre-lto", precise_capturing, precise_capturing_in_traits, diff --git a/compiler/rustc_target/src/callconv/aarch64.rs b/compiler/rustc_target/src/callconv/aarch64.rs index 09187836ee65a..9e78de4b229b9 100644 --- a/compiler/rustc_target/src/callconv/aarch64.rs +++ b/compiler/rustc_target/src/callconv/aarch64.rs @@ -32,6 +32,7 @@ where let valid_unit = match unit.kind { RegKind::Integer => false, + RegKind::PpcF128 => unreachable!(), // The softfloat ABI treats floats like integers, so they // do not get homogeneous aggregate treatment. RegKind::Float => cx.target_spec().rustc_abi != Some(RustcAbi::Softfloat), diff --git a/compiler/rustc_target/src/callconv/arm.rs b/compiler/rustc_target/src/callconv/arm.rs index 615bd4f540068..f226dcdcd6cfa 100644 --- a/compiler/rustc_target/src/callconv/arm.rs +++ b/compiler/rustc_target/src/callconv/arm.rs @@ -26,6 +26,7 @@ where let valid_unit = match unit.kind { RegKind::Integer => false, RegKind::Float => true, + RegKind::PpcF128 => unreachable!(), RegKind::Vector { .. } => unit.size.bits() == 64 || unit.size.bits() == 128, }; diff --git a/compiler/rustc_target/src/callconv/mips64.rs b/compiler/rustc_target/src/callconv/mips64.rs index 72c02f6dc04ca..e7cecb754a769 100644 --- a/compiler/rustc_target/src/callconv/mips64.rs +++ b/compiler/rustc_target/src/callconv/mips64.rs @@ -32,10 +32,11 @@ where match float { // C does not have the f16 type Float::F16 => None, - Float::F16B => unreachable!("`f16b` unsupported on mips64"), Float::F32 => Some(Reg::f32()), Float::F64 => Some(Reg::f64()), Float::F128 => Some(Reg::f128()), + Float::F16B => unreachable!("`f16b` unsupported on mips64"), + Float::PpcF128 => unreachable!("`ppcf128` unsupported on mips64"), } } _ => None, @@ -125,10 +126,7 @@ where // However, this implementation is consistent with GCC, which means we // are compatible with the de-facto ABI on the platform. if let BackendRepr::Scalar(scalar) = arg.layout.backend_repr { - let kind = match scalar.primitive() { - Primitive::Int(_, _) | Primitive::Pointer(_) => RegKind::Integer, - Primitive::Float(_) => RegKind::Float, - }; + let kind = RegKind::from_primitive(scalar.primitive()); arg.cast_to_and_pad_i32(CastTarget::from(Reg { kind, size }), pad_i32); } } else if arg.layout.pass_indirectly_in_non_rustic_abis(cx) { @@ -144,6 +142,7 @@ where match component { Numeric::Float(Float::F16B) => unreachable!("Complex is not C-compatible"), Numeric::Float(Float::F16) => unreachable!("not supported on mips64"), + Numeric::Float(Float::PpcF128) => unreachable!("not supported on mips64"), Numeric::Float(Float::F32 | Float::F64) => { // Only pass a Complex/Complex in FPRs when two argument slots are free. if curr_offset.bytes() / slot.bytes() + 2 <= NUM_ARG_SLOTS { diff --git a/compiler/rustc_target/src/callconv/powerpc64.rs b/compiler/rustc_target/src/callconv/powerpc64.rs index ca79a52d2874f..7bf54fcda0b1f 100644 --- a/compiler/rustc_target/src/callconv/powerpc64.rs +++ b/compiler/rustc_target/src/callconv/powerpc64.rs @@ -60,18 +60,27 @@ where C: HasDataLayout, { arg.layout.homogeneous_aggregate(cx).ok().and_then(|ha| ha.unit()).and_then(|unit| { - // ELFv1 and AIX only passes one-member aggregates transparently. - // ELFv2 passes up to eight uniquely addressable members. - if ((abi == ELFv1 || abi == AIX) - && (arg.layout.size > unit.size || is_or_contains_union(cx, arg.layout))) - || arg.layout.size > unit.size.checked_mul(8, cx).unwrap() - { - return None; + match abi { + ELFv1 | AIX => { + // Pass only one-member aggregates transparently. + if arg.layout.size > unit.size || is_or_contains_union(cx, arg.layout) { + return None; + } + } + ELFv2 => { + // A `ppcf128` occupies two floating-point registers, so only four of them fit. + let max_members = if unit.kind == RegKind::PpcF128 { 4 } else { 8 }; + + // Pass up to max_members uniquely addressable members. + if arg.layout.size > unit.size.checked_mul(max_members, cx).unwrap() { + return None; + } + } } let valid_unit = match unit.kind { RegKind::Integer => false, - RegKind::Float => true, + RegKind::Float | RegKind::PpcF128 => true, RegKind::Vector { .. } => unit.size.bits() == 128, }; diff --git a/compiler/rustc_target/src/callconv/sparc64.rs b/compiler/rustc_target/src/callconv/sparc64.rs index abef388ef2e12..22b388cf54101 100644 --- a/compiler/rustc_target/src/callconv/sparc64.rs +++ b/compiler/rustc_target/src/callconv/sparc64.rs @@ -59,6 +59,7 @@ fn classify<'a, Ty, C>( // Match LLVM by passing `f16` in integer registers. } Float::F16B => unreachable!("`f16b` unsupported on sparc64"), + Float::PpcF128 => unreachable!("`ppcf128` unsupported on sparc64"), } } else { /* pass unaligned floats in integer registers */ diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 8d8e501391c43..4ecfcde6cc364 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -826,6 +826,13 @@ fn layout_of_uncached<'tcx>( layout.backend_repr = BackendRepr::Scalar(bfloat); } + if tcx.is_lang_item(def.did(), LangItem::PpcF128) { + let ppcf128 = scalar_unit(Primitive::Float(abi::Float::PpcF128)); + assert_eq!(layout.size, abi::Float::PpcF128.size()); + layout.align = abi::Float::PpcF128.align(cx); + layout.backend_repr = BackendRepr::Scalar(ppcf128); + } + tcx.mk_layout(layout) } diff --git a/compiler/rustc_type_ir/src/region_constraint.rs b/compiler/rustc_type_ir/src/region_constraint.rs index e1b1d157ff85f..be05ed2cd4d81 100644 --- a/compiler/rustc_type_ir/src/region_constraint.rs +++ b/compiler/rustc_type_ir/src/region_constraint.rs @@ -536,6 +536,8 @@ pub fn eagerly_handle_placeholders_in_universe, u: UniverseIndex, ) -> RegionConstraint { + assert!(u > UniverseIndex::ROOT, "eagerly handle placeholders called for root universe"); + let assumptions = infcx.get_placeholder_assumptions(u); // 1. rewrite type outlives constraints involving things from `u` into either region constraints diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs index 2b7fb159130d9..0c5daffaf05d9 100644 --- a/library/stdarch/crates/core_arch/src/lib.rs +++ b/library/stdarch/crates/core_arch/src/lib.rs @@ -39,7 +39,8 @@ maybe_uninit_as_bytes, movrs_target_feature, clflushopt_target_feature, - min_adt_const_params + min_adt_const_params, + lang_items, )] #![cfg_attr( test, diff --git a/library/stdarch/crates/core_arch/src/powerpc/mod.rs b/library/stdarch/crates/core_arch/src/powerpc/mod.rs index 9bb1bf22434dc..e98a738e65ff4 100644 --- a/library/stdarch/crates/core_arch/src/powerpc/mod.rs +++ b/library/stdarch/crates/core_arch/src/powerpc/mod.rs @@ -2,6 +2,47 @@ pub(crate) mod macros; +/// The IBM extended-precision (double-double) floating-point type. +// FIXME(ppcf128) improve the docs. +#[lang = "ppcf128"] +#[doc(alias = "__ibm128")] +#[doc(alias = "doubledouble")] +#[doc(alias = "f64f64")] +#[unstable(feature = "powerpc_ppcf128", issue = "163323")] +#[allow(non_camel_case_types)] +#[doc(cfg(any(target_arch = "powerpc", target_arch = "powerpc64")))] +#[derive(Clone, Copy)] +pub struct ppcf128(u128); + +#[unstable(feature = "powerpc_ppcf128", issue = "163323")] +impl crate::fmt::Debug for ppcf128 { + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { + let (hi, lo) = self.to_components(); + write!(f, "ppcf128({hi:?}, {lo:?})") + } +} + +impl ppcf128 { + /// Returns the memory representation of this floating point number as a byte array in + /// native byte order. + #[unstable(feature = "powerpc_ppcf128", issue = "163323")] + #[inline] + pub const fn to_ne_bytes(self) -> [u8; 16] { + // SAFETY: every bit pattern of a `ppcf128` is a valid `[u8; 16]`. + unsafe { crate::mem::transmute::(self) } + } + + /// Returns the large and small component of this floating point number. + #[unstable(feature = "powerpc_ppcf128", issue = "163323")] + #[rustc_const_unstable(feature = "powerpc_ppcf128", issue = "163323")] + #[inline] + pub const fn to_components(self) -> (f64, f64) { + // SAFETY: every bit pattern of a `ppcf128` is a valid `[f64; 2]`. + let [large, small] = unsafe { crate::mem::transmute::(self) }; + (large, small) + } +} + mod altivec; #[unstable(feature = "stdarch_powerpc", issue = "111145")] pub use self::altivec::*; diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 4f42a46e56a25..b3a6817b5d467 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -355,12 +355,13 @@ fn make_win_llvm_dist(plat_root: &Path, target: TargetSelection, builder: &Build "libmingwex.a", "libmsvcrt.a", // Windows import libs, remove them once std transitions to raw-dylib + "libdbghelp.a", "libkernel32.a", - "libuser32.a", "libntdll.a", + "libsynchronization.a", + "libuser32.a", "libuserenv.a", "libws2_32.a", - "libdbghelp.a", ]; //Find mingw artifacts we want to bundle diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index f8b4ebb5841c7..7adb17d051aa0 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -1120,10 +1120,9 @@ impl<'a> Builder<'a> { Subcommand::Run { .. } => (Kind::Run, &paths[..]), Subcommand::Clean { .. } => (Kind::Clean, &paths[..]), Subcommand::Format { .. } => (Kind::Format, &[][..]), - Subcommand::Setup { profile: ref path } => ( - Kind::Setup, - path.as_ref().map_or([].as_slice(), |path| std::slice::from_ref(path)), - ), + Subcommand::Setup { profile: ref path } => { + (Kind::Setup, path.as_ref().map_or([].as_slice(), std::slice::from_ref)) + } Subcommand::Vendor { .. } => (Kind::Vendor, &paths[..]), Subcommand::Perf { .. } => (Kind::Perf, &paths[..]), }; diff --git a/src/tools/nix-dev-shell/x/default.nix b/src/tools/nix-dev-shell/x/default.nix index 915158080e421..db42d57249ede 100644 --- a/src/tools/nix-dev-shell/x/default.nix +++ b/src/tools/nix-dev-shell/x/default.nix @@ -29,13 +29,12 @@ stdenv.mkDerivation (self: { dontUnpack = true; nativeBuildInputs = [ - rustc makeBinaryWrapper ]; env.PYTHON = python3.interpreter; buildPhase = '' - rustc -Copt-level=3 --crate-name x $src --out-dir $unwrapped/bin + ${rustc}/bin/rustc -Copt-level=3 --crate-name x $src --out-dir $unwrapped/bin ''; installPhase = diff --git a/src/tools/rustc-perf b/src/tools/rustc-perf index 94df17b4a0fba..208d929efe770 160000 --- a/src/tools/rustc-perf +++ b/src/tools/rustc-perf @@ -1 +1 @@ -Subproject commit 94df17b4a0fbafae5e534b6a754a6a6ee7d51708 +Subproject commit 208d929efe770996eb02cd3d2712623ea48b7646 diff --git a/tests/assembly-llvm/ppcf128.rs b/tests/assembly-llvm/ppcf128.rs new file mode 100644 index 0000000000000..6823b86f09f7b --- /dev/null +++ b/tests/assembly-llvm/ppcf128.rs @@ -0,0 +1,275 @@ +//@ add-minicore +//@ assembly-output: emit-asm +// +//@ revisions: POWERPC POWERPC64LE POWERPC64 AIX +//@ [POWERPC] compile-flags: --target powerpc-unknown-linux-gnu +//@ [POWERPC64LE] compile-flags: --target powerpc64le-unknown-linux-gnu +//@ [POWERPC64] compile-flags: --target powerpc64-unknown-linux-gnu +//@ [AIX] compile-flags: --target powerpc64-ibm-aix +//@ compile-flags: -Copt-level=3 --crate-type=lib +//@ needs-llvm-components: powerpc + +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +#[cfg(target_arch = "powerpc")] +use minicore::arch::powerpc::ppcf128; +#[cfg(target_arch = "powerpc64")] +use minicore::arch::powerpc64::ppcf128; +use minicore::*; + +// CHECK-LABEL: identity +// +// POWERPC: .Lfunc_begin{{[0-9]+}}: +// POWERPC-NEXT: .cfi_startproc +// POWERPC-NEXT: stwu 1, -48(1) +// POWERPC-NEXT: .cfi_def_cfa_offset 48 +// POWERPC-NEXT: stfd 1, 24(1) +// POWERPC-NEXT: lwz 3, 28(1) +// POWERPC-NEXT: stfd 2, 16(1) +// POWERPC-NEXT: stw 3, 44(1) +// POWERPC-NEXT: lwz 3, 24(1) +// POWERPC-NEXT: stw 3, 40(1) +// POWERPC-NEXT: lwz 3, 20(1) +// POWERPC-NEXT: lfd 1, 40(1) +// POWERPC-NEXT: stw 3, 36(1) +// POWERPC-NEXT: lwz 3, 16(1) +// POWERPC-NEXT: stw 3, 32(1) +// POWERPC-NEXT: lfd 2, 32(1) +// POWERPC-NEXT: addi 1, 1, 48 +// POWERPC-NEXT: blr +// +// POWERPC64: .Lfunc_begin{{[0-9]+}}: +// POWERPC64-NEXT: .cfi_startproc +// POWERPC64-NEXT: blr +// +// POWERPC64LE: .Lfunc_begin{{[0-9]+}}: +// POWERPC64LE-NEXT: .cfi_startproc +// POWERPC64LE-NEXT: blr +// +// AIX: .csect .identity[PR],5 +// AIX-NEXT: blr +#[unsafe(no_mangle)] +pub extern "C" fn identity(x: ppcf128) -> ppcf128 { + x +} + +/// On elfv1 and aix single-float structs are passed as scalar arguments. +#[repr(C)] +struct Hfa1 { + a: ppcf128, +} + +/// On elfv2 homogenous aggregates of up to 4 elements are passed as scalars. +#[repr(C)] +struct Hfa2 { + a: ppcf128, + b: ppcf128, +} + +#[repr(C)] +struct Hfa4 { + a: ppcf128, + b: ppcf128, + c: ppcf128, + d: ppcf128, +} + +// CHECK-LABEL: hfa1 +// +// POWERPC: .Lfunc_begin{{[0-9]+}}: +// POWERPC-NEXT: .cfi_startproc +// POWERPC-NEXT: stwu 1, -32(1) +// POWERPC-NEXT: .cfi_def_cfa_offset 32 +// POWERPC-NEXT: lwz 4, 4(3) +// POWERPC-NEXT: stw 4, 20(1) +// POWERPC-NEXT: lwz 4, 0(3) +// POWERPC-NEXT: stw 4, 16(1) +// POWERPC-NEXT: lwz 4, 12(3) +// POWERPC-NEXT: lfd 1, 16(1) +// POWERPC-NEXT: stw 4, 28(1) +// POWERPC-NEXT: lwz 3, 8(3) +// POWERPC-NEXT: stw 3, 24(1) +// POWERPC-NEXT: lfd 2, 24(1) +// POWERPC-NEXT: addi 1, 1, 32 +// POWERPC-NEXT: blr +// +// POWERPC64: .Lfunc_begin{{[0-9]+}}: +// POWERPC64-NEXT: .cfi_startproc +// POWERPC64-NEXT: blr +// +// POWERPC64LE: .Lfunc_begin{{[0-9]+}}: +// POWERPC64LE-NEXT: .cfi_startproc +// POWERPC64LE-NEXT: blr +// +// AIX: .csect .hfa1[PR],5 +// AIX-NEXT: std 3, -16(1) +// AIX-NEXT: std 4, -8(1) +// AIX-NEXT: lfd 1, -16(1) +// AIX-NEXT: lfd 2, -8(1) +// AIX-NEXT: std 3, 48(1) +// AIX-NEXT: std 4, 56(1) +// AIX-NEXT: blr +#[unsafe(no_mangle)] +pub extern "C" fn hfa1(hfa: Hfa1) -> ppcf128 { + hfa.a +} + +// CHECK-LABEL: hfa2 +// +// POWERPC: .Lfunc_begin{{[0-9]+}}: +// POWERPC-NEXT: .cfi_startproc +// POWERPC-NEXT: stwu 1, -32(1) +// POWERPC-NEXT: .cfi_def_cfa_offset 32 +// POWERPC-NEXT: lwz 4, 20(3) +// POWERPC-NEXT: stw 4, 20(1) +// POWERPC-NEXT: lwz 4, 16(3) +// POWERPC-NEXT: stw 4, 16(1) +// POWERPC-NEXT: lwz 4, 28(3) +// POWERPC-NEXT: lfd 1, 16(1) +// POWERPC-NEXT: stw 4, 28(1) +// POWERPC-NEXT: lwz 3, 24(3) +// POWERPC-NEXT: stw 3, 24(1) +// POWERPC-NEXT: lfd 2, 24(1) +// POWERPC-NEXT: addi 1, 1, 32 +// POWERPC-NEXT: blr +// +// POWERPC64: .Lfunc_begin{{[0-9]+}}: +// POWERPC64-NEXT: .cfi_startproc +// POWERPC64-NEXT: std 5, -16(1) +// POWERPC64-NEXT: std 6, -8(1) +// POWERPC64-NEXT: lfd 1, -16(1) +// POWERPC64-NEXT: lfd 2, -8(1) +// POWERPC64-NEXT: blr +// +// POWERPC64LE: .Lfunc_begin{{[0-9]+}}: +// POWERPC64LE-NEXT: .cfi_startproc +// POWERPC64LE-NEXT: fmr 2, 4 +// POWERPC64LE-NEXT: fmr 1, 3 +// POWERPC64LE-NEXT: blr +// +// AIX: .csect .hfa2[PR],5 +// AIX-NEXT: std 5, -16(1) +// AIX-NEXT: std 6, -8(1) +// AIX-NEXT: lfd 1, -16(1) +// AIX-NEXT: lfd 2, -8(1) +// AIX-NEXT: std 6, 72(1) +// AIX-NEXT: std 5, 64(1) +// AIX-NEXT: std 3, 48(1) +// AIX-NEXT: std 4, 56(1) +// AIX-NEXT: blr +#[unsafe(no_mangle)] +pub extern "C" fn hfa2(value: Hfa2) -> ppcf128 { + value.b +} + +// CHECK-LABEL: hfa4 +// +// POWERPC: .Lfunc_begin{{[0-9]+}}: +// POWERPC-NEXT: .cfi_startproc +// POWERPC-NEXT: stwu 1, -32(1) +// POWERPC-NEXT: .cfi_def_cfa_offset 32 +// POWERPC-NEXT: lwz 4, 52(3) +// POWERPC-NEXT: stw 4, 20(1) +// POWERPC-NEXT: lwz 4, 48(3) +// POWERPC-NEXT: stw 4, 16(1) +// POWERPC-NEXT: lwz 4, 60(3) +// POWERPC-NEXT: lfd 1, 16(1) +// POWERPC-NEXT: stw 4, 28(1) +// POWERPC-NEXT: lwz 3, 56(3) +// POWERPC-NEXT: stw 3, 24(1) +// POWERPC-NEXT: lfd 2, 24(1) +// POWERPC-NEXT: addi 1, 1, 32 +// POWERPC-NEXT: blr +// +// POWERPC64: .Lfunc_begin{{[0-9]+}}: +// POWERPC64-NEXT: .cfi_startproc +// POWERPC64-NEXT: std 9, -16(1) +// POWERPC64-NEXT: std 10, -8(1) +// POWERPC64-NEXT: lfd 1, -16(1) +// POWERPC64-NEXT: lfd 2, -8(1) +// POWERPC64-NEXT: blr +// +// POWERPC64LE: .Lfunc_begin{{[0-9]+}}: +// POWERPC64LE-NEXT: .cfi_startproc +// POWERPC64LE-NEXT: fmr 2, 8 +// POWERPC64LE-NEXT: fmr 1, 7 +// POWERPC64LE-NEXT: blr +// +// AIX: .csect .hfa4[PR],5 +// AIX-NEXT: std 9, -16(1) +// AIX-NEXT: std 10, -8(1) +// AIX-NEXT: lfd 1, -16(1) +// AIX-NEXT: lfd 2, -8(1) +// AIX-NEXT: std 10, 104(1) +// AIX-NEXT: std 9, 96(1) +// AIX-NEXT: std 3, 48(1) +// AIX-NEXT: std 4, 56(1) +// AIX-NEXT: std 5, 64(1) +// AIX-NEXT: std 6, 72(1) +// AIX-NEXT: std 7, 80(1) +// AIX-NEXT: std 8, 88(1) +// AIX-NEXT: blr +#[unsafe(no_mangle)] +pub extern "C" fn hfa4(value: Hfa4) -> ppcf128 { + value.d +} + +#[repr(C)] +struct NonHfa5 { + a: ppcf128, + b: ppcf128, + c: ppcf128, + d: ppcf128, + e: ppcf128, +} + +// CHECK-LABEL: non_hfa5 +// +// POWERPC: .Lfunc_begin{{[0-9]+}}: +// POWERPC-NEXT: .cfi_startproc +// POWERPC-NEXT: stwu 1, -32(1) +// POWERPC-NEXT: .cfi_def_cfa_offset 32 +// POWERPC-NEXT: lwz 4, 68(3) +// POWERPC-NEXT: stw 4, 20(1) +// POWERPC-NEXT: lwz 4, 64(3) +// POWERPC-NEXT: stw 4, 16(1) +// POWERPC-NEXT: lwz 4, 76(3) +// POWERPC-NEXT: lfd 1, 16(1) +// POWERPC-NEXT: stw 4, 28(1) +// POWERPC-NEXT: lwz 3, 72(3) +// POWERPC-NEXT: stw 3, 24(1) +// POWERPC-NEXT: lfd 2, 24(1) +// POWERPC-NEXT: addi 1, 1, 32 +// POWERPC-NEXT: blr +// +// POWERPC64: .Lfunc_begin{{[0-9]+}}: +// POWERPC64-NEXT: .cfi_startproc +// POWERPC64-NEXT: lfd 1, 112(1) +// POWERPC64-NEXT: lfd 2, 120(1) +// POWERPC64-NEXT: blr +// +// POWERPC64LE: .Lfunc_begin{{[0-9]+}}: +// POWERPC64LE-NEXT: .cfi_startproc +// POWERPC64LE-NEXT: lfd 1, 96(1) +// POWERPC64LE-NEXT: lfd 2, 104(1) +// POWERPC64LE-NEXT: blr +// +// AIX: .csect .non_hfa5[PR],5 +// AIX-NEXT: lfd 1, 112(1) +// AIX-NEXT: lfd 2, 120(1) +// AIX-NEXT: std 3, 48(1) +// AIX-NEXT: std 4, 56(1) +// AIX-NEXT: std 5, 64(1) +// AIX-NEXT: std 6, 72(1) +// AIX-NEXT: std 7, 80(1) +// AIX-NEXT: std 8, 88(1) +// AIX-NEXT: std 9, 96(1) +// AIX-NEXT: std 10, 104(1) +// AIX-NEXT: blr +#[unsafe(no_mangle)] +pub extern "C" fn non_hfa5(value: NonHfa5) -> ppcf128 { + value.e +} diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 2262c293af64a..e7e924f9ebc08 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -115,6 +115,24 @@ impl Copy for *const T {} impl Copy for *mut T {} impl Copy for [T; N] {} +pub mod arch { + #[cfg(target_arch = "powerpc")] + pub mod powerpc { + #[lang = "ppcf128"] + pub struct ppcf128(u128); + + impl crate::Copy for ppcf128 {} + } + + #[cfg(any(target_arch = "powerpc64"))] + pub mod powerpc64 { + #[lang = "ppcf128"] + pub struct ppcf128(u128); + + impl crate::Copy for ppcf128 {} + } +} + #[lang = "phantom_data"] pub struct PhantomData; impl Copy for PhantomData {} diff --git a/tests/codegen-llvm/powerpc-abi/ppcf128.rs b/tests/codegen-llvm/powerpc-abi/ppcf128.rs new file mode 100644 index 0000000000000..fe7a38f82352a --- /dev/null +++ b/tests/codegen-llvm/powerpc-abi/ppcf128.rs @@ -0,0 +1,92 @@ +//@ add-minicore +// +//@ revisions: POWERPC POWERPC64LE POWERPC64 AIX +//@ [POWERPC] compile-flags: --target powerpc-unknown-linux-gnu +//@ [POWERPC64LE] compile-flags: --target powerpc64le-unknown-linux-gnu +//@ [POWERPC64] compile-flags: --target powerpc64-unknown-linux-gnu +//@ [AIX] compile-flags: --target powerpc64-ibm-aix +//@ compile-flags: -Copt-level=3 --crate-type=lib +//@ needs-llvm-components: powerpc + +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +#[cfg(target_arch = "powerpc")] +use minicore::arch::powerpc::ppcf128; +#[cfg(target_arch = "powerpc64")] +use minicore::arch::powerpc64::ppcf128; + +/// On elfv1 and aix single-float structs are passed as scalar arguments. +#[repr(C)] +struct Hfa1 { + a: ppcf128, +} + +/// On elfv2 homogenous aggregates of up to 4 elements are passed as scalars. +#[repr(C)] +struct Hfa2 { + a: ppcf128, + b: ppcf128, +} + +#[repr(C)] +struct Hfa4 { + a: ppcf128, + b: ppcf128, + c: ppcf128, + d: ppcf128, +} + +#[repr(C)] +struct NonHfa5 { + a: ppcf128, + b: ppcf128, + c: ppcf128, + d: ppcf128, + e: ppcf128, +} + +// CHECK-LABEL: ppc_fp128 @scalar_second(ppc_fp128 noundef %_a, ppc_fp128 noundef returned %b) +#[unsafe(no_mangle)] +extern "C" fn scalar_second(_a: ppcf128, b: ppcf128) -> ppcf128 { + // CHECK: ret ppc_fp128 %b + b +} + +// POWERPC64-LABEL: void @hfa1(ptr {{.*}}sret([16 x i8]) {{.*}}, ppc_fp128 %0) +// POWERPC64LE-LABEL: ppc_fp128 @hfa1(ppc_fp128 returned %0) +// AIX-LABEL: void @hfa1(ptr {{.*}}sret([16 x i8]) {{.*}}, ptr {{.*}}byval([16 x i8]) {{.*}}) +// POWER-LABEL: void @hfa1(ptr {{.*}}sret([16 x i8]) {{.*}}, ptr {{.*}}byval([16 x i8]) {{.*}}) +#[unsafe(no_mangle)] +extern "C" fn hfa1(x: Hfa1) -> Hfa1 { + x +} + +// POWERPC64-LABEL: ppc_fp128 @hfa2([2 x i128] %0) +// POWERPC64LE-LABEL: ppc_fp128 @hfa2([2 x ppc_fp128] %0) +// AIX-LABEL: ppc_fp128 @hfa2(ptr {{.*}}byval([32 x i8]) +// POWER-LABEL: ppc_fp128 @hfa2(ptr {{.*}}byval([32 x i8]) +#[unsafe(no_mangle)] +extern "C" fn hfa2(x: Hfa2) -> ppcf128 { + x.b +} + +// POWERPC64-LABEL: ppc_fp128 @hfa4([4 x i128] %0) +// POWERPC64LE-LABEL: ppc_fp128 @hfa4([4 x ppc_fp128] %0) +// AIX-LABEL: ppc_fp128 @hfa4(ptr {{.*}}byval([64 x i8]) +// POWER-LABEL: ppc_fp128 @hfa4(ptr {{.*}}byval([64 x i8]) +#[unsafe(no_mangle)] +extern "C" fn hfa4(x: Hfa4) -> ppcf128 { + x.d +} + +// POWERPC64-LABEL: ppc_fp128 @non_hfa5([5 x i128] %0) +// POWERPC64LE-LABEL: ppc_fp128 @non_hfa5([5 x i128] %0) +// AIX-LABEL: ppc_fp128 @non_hfa5(ptr {{.*}}byval([80 x i8]) +// POWERPC-LABEL: ppc_fp128 @non_hfa5(ptr {{.*}}dereferenceable(80) +#[unsafe(no_mangle)] +extern "C" fn non_hfa5(x: NonHfa5) -> ppcf128 { + x.c +} diff --git a/tests/coverage/attr/impl.cov-map b/tests/coverage/attr/impl.cov-map index 0562c291e6c17..b1dea8fb3da45 100644 --- a/tests/coverage/attr/impl.cov-map +++ b/tests/coverage/attr/impl.cov-map @@ -1,30 +1,30 @@ Function name: ::off_on (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 0f, 05, 00, 10, 00, 00, 12, 00, 13] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 0e, 05, 00, 10, 00, 00, 12, 00, 13] Number of files: 1 - file 0 => $DIR/impl.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 15, 5) to (start + 0, 16) +- Code(Zero) at (prev + 14, 5) to (start + 0, 16) - Code(Zero) at (prev + 0, 18) to (start + 0, 19) Highest counter ID seen: (none) Function name: ::on_inherit (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 17, 05, 00, 14, 00, 00, 16, 00, 17] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 16, 05, 00, 14, 00, 00, 16, 00, 17] Number of files: 1 - file 0 => $DIR/impl.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 23, 5) to (start + 0, 20) +- Code(Zero) at (prev + 22, 5) to (start + 0, 20) - Code(Zero) at (prev + 0, 22) to (start + 0, 23) Highest counter ID seen: (none) Function name: ::on_on (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 1a, 05, 00, 0f, 00, 00, 11, 00, 12] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 19, 05, 00, 0f, 00, 00, 11, 00, 12] Number of files: 1 - file 0 => $DIR/impl.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 26, 5) to (start + 0, 15) +- Code(Zero) at (prev + 25, 5) to (start + 0, 15) - Code(Zero) at (prev + 0, 17) to (start + 0, 18) Highest counter ID seen: (none) diff --git a/tests/coverage/attr/impl.coverage b/tests/coverage/attr/impl.coverage index 670c1c36a96d6..560429fb5fe5d 100644 --- a/tests/coverage/attr/impl.coverage +++ b/tests/coverage/attr/impl.coverage @@ -1,6 +1,5 @@ LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 - LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, LL| |// and is inherited by any enclosed functions. diff --git a/tests/coverage/attr/impl.rs b/tests/coverage/attr/impl.rs index c720a4cd6b206..d4d784a3502b9 100644 --- a/tests/coverage/attr/impl.rs +++ b/tests/coverage/attr/impl.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.nesting // Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, // and is inherited by any enclosed functions. diff --git a/tests/coverage/attr/module.cov-map b/tests/coverage/attr/module.cov-map index 88f4915bfe8f7..7464ad022d4c2 100644 --- a/tests/coverage/attr/module.cov-map +++ b/tests/coverage/attr/module.cov-map @@ -1,30 +1,30 @@ Function name: module::off::on (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 0d, 05, 00, 0c, 00, 00, 0e, 00, 0f] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 0c, 05, 00, 0c, 00, 00, 0e, 00, 0f] Number of files: 1 - file 0 => $DIR/module.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 13, 5) to (start + 0, 12) +- Code(Zero) at (prev + 12, 5) to (start + 0, 12) - Code(Zero) at (prev + 0, 14) to (start + 0, 15) Highest counter ID seen: (none) Function name: module::on::inherit (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 15, 05, 00, 11, 00, 00, 13, 00, 14] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 14, 05, 00, 11, 00, 00, 13, 00, 14] Number of files: 1 - file 0 => $DIR/module.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 21, 5) to (start + 0, 17) +- Code(Zero) at (prev + 20, 5) to (start + 0, 17) - Code(Zero) at (prev + 0, 19) to (start + 0, 20) Highest counter ID seen: (none) Function name: module::on::on (unused) -Raw bytes (14): 0x[01, 01, 00, 02, 00, 18, 05, 00, 0c, 00, 00, 0e, 00, 0f] +Raw bytes (14): 0x[01, 01, 00, 02, 00, 17, 05, 00, 0c, 00, 00, 0e, 00, 0f] Number of files: 1 - file 0 => $DIR/module.rs Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Zero) at (prev + 24, 5) to (start + 0, 12) +- Code(Zero) at (prev + 23, 5) to (start + 0, 12) - Code(Zero) at (prev + 0, 14) to (start + 0, 15) Highest counter ID seen: (none) diff --git a/tests/coverage/attr/module.coverage b/tests/coverage/attr/module.coverage index bba021b9b4766..c1b9f0e35c0b1 100644 --- a/tests/coverage/attr/module.coverage +++ b/tests/coverage/attr/module.coverage @@ -1,6 +1,5 @@ LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 - LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Checks that `#[coverage(..)]` can be applied to modules, and is inherited LL| |// by any enclosed functions. diff --git a/tests/coverage/attr/module.rs b/tests/coverage/attr/module.rs index 1d17ac7d503e4..4bfb1e7729b7d 100644 --- a/tests/coverage/attr/module.rs +++ b/tests/coverage/attr/module.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.nesting // Checks that `#[coverage(..)]` can be applied to modules, and is inherited // by any enclosed functions. diff --git a/tests/coverage/attr/nested.cov-map b/tests/coverage/attr/nested.cov-map index ae8af35e507de..7afa65a1f3be5 100644 --- a/tests/coverage/attr/nested.cov-map +++ b/tests/coverage/attr/nested.cov-map @@ -1,21 +1,21 @@ Function name: nested::closure_expr -Raw bytes (19): 0x[01, 01, 00, 03, 01, 40, 01, 00, 12, 01, 0b, 05, 00, 0f, 01, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 3f, 01, 00, 12, 01, 0b, 05, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/nested.rs Number of expressions: 0 Number of file 0 mappings: 3 -- Code(Counter(0)) at (prev + 64, 1) to (start + 0, 18) +- Code(Counter(0)) at (prev + 63, 1) to (start + 0, 18) - Code(Counter(0)) at (prev + 11, 5) to (start + 0, 15) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: nested::closure_tail -Raw bytes (19): 0x[01, 01, 00, 03, 01, 4f, 01, 00, 12, 01, 11, 05, 00, 0f, 01, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 4e, 01, 00, 12, 01, 11, 05, 00, 0f, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/nested.rs Number of expressions: 0 Number of file 0 mappings: 3 -- Code(Counter(0)) at (prev + 79, 1) to (start + 0, 18) +- Code(Counter(0)) at (prev + 78, 1) to (start + 0, 18) - Code(Counter(0)) at (prev + 17, 5) to (start + 0, 15) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 diff --git a/tests/coverage/attr/nested.coverage b/tests/coverage/attr/nested.coverage index a0bf05a423534..1c5fbcb671e15 100644 --- a/tests/coverage/attr/nested.coverage +++ b/tests/coverage/attr/nested.coverage @@ -1,6 +1,5 @@ LL| |#![feature(coverage_attribute, stmt_expr_attributes)] LL| |//@ edition: 2021 - LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Demonstrates the interaction between #[coverage(off)] and various kinds of LL| |// nested function. diff --git a/tests/coverage/attr/nested.rs b/tests/coverage/attr/nested.rs index 042fcc5319aee..8213e29b6fcd9 100644 --- a/tests/coverage/attr/nested.rs +++ b/tests/coverage/attr/nested.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute, stmt_expr_attributes)] //@ edition: 2021 -//@ reference: attributes.coverage.nesting // Demonstrates the interaction between #[coverage(off)] and various kinds of // nested function. diff --git a/tests/coverage/attr/off-on-sandwich.cov-map b/tests/coverage/attr/off-on-sandwich.cov-map index ef31c56fcaa2f..61daef8d15452 100644 --- a/tests/coverage/attr/off-on-sandwich.cov-map +++ b/tests/coverage/attr/off-on-sandwich.cov-map @@ -1,34 +1,34 @@ Function name: off_on_sandwich::dense_a::dense_b -Raw bytes (24): 0x[01, 01, 00, 04, 01, 10, 05, 00, 11, 01, 01, 09, 00, 12, 01, 01, 09, 00, 12, 01, 05, 05, 00, 06] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 05, 00, 11, 01, 01, 09, 00, 12, 01, 01, 09, 00, 12, 01, 05, 05, 00, 06] Number of files: 1 - file 0 => $DIR/off-on-sandwich.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 16, 5) to (start + 0, 17) +- Code(Counter(0)) at (prev + 15, 5) to (start + 0, 17) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 18) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 18) - Code(Counter(0)) at (prev + 5, 5) to (start + 0, 6) Highest counter ID seen: c0 Function name: off_on_sandwich::sparse_a::sparse_b::sparse_c -Raw bytes (24): 0x[01, 01, 00, 04, 01, 22, 09, 00, 16, 01, 01, 0d, 00, 17, 01, 01, 0d, 00, 17, 01, 09, 09, 00, 0a] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 21, 09, 00, 16, 01, 01, 0d, 00, 17, 01, 01, 0d, 00, 17, 01, 09, 09, 00, 0a] Number of files: 1 - file 0 => $DIR/off-on-sandwich.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 34, 9) to (start + 0, 22) +- Code(Counter(0)) at (prev + 33, 9) to (start + 0, 22) - Code(Counter(0)) at (prev + 1, 13) to (start + 0, 23) - Code(Counter(0)) at (prev + 1, 13) to (start + 0, 23) - Code(Counter(0)) at (prev + 9, 9) to (start + 0, 10) Highest counter ID seen: c0 Function name: off_on_sandwich::sparse_a::sparse_b::sparse_c::sparse_d -Raw bytes (24): 0x[01, 01, 00, 04, 01, 25, 0d, 00, 1a, 01, 01, 11, 00, 1b, 01, 01, 11, 00, 1b, 01, 05, 0d, 00, 0e] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 24, 0d, 00, 1a, 01, 01, 11, 00, 1b, 01, 01, 11, 00, 1b, 01, 05, 0d, 00, 0e] Number of files: 1 - file 0 => $DIR/off-on-sandwich.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 37, 13) to (start + 0, 26) +- Code(Counter(0)) at (prev + 36, 13) to (start + 0, 26) - Code(Counter(0)) at (prev + 1, 17) to (start + 0, 27) - Code(Counter(0)) at (prev + 1, 17) to (start + 0, 27) - Code(Counter(0)) at (prev + 5, 13) to (start + 0, 14) diff --git a/tests/coverage/attr/off-on-sandwich.coverage b/tests/coverage/attr/off-on-sandwich.coverage index 4fbc388490306..675697906ee76 100644 --- a/tests/coverage/attr/off-on-sandwich.coverage +++ b/tests/coverage/attr/off-on-sandwich.coverage @@ -1,6 +1,5 @@ LL| |#![feature(coverage_attribute)] LL| |//@ edition: 2021 - LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` LL| |// in nested functions. diff --git a/tests/coverage/attr/off-on-sandwich.rs b/tests/coverage/attr/off-on-sandwich.rs index 3d914c99b625e..261634e00296a 100644 --- a/tests/coverage/attr/off-on-sandwich.rs +++ b/tests/coverage/attr/off-on-sandwich.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.nesting // Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` // in nested functions. diff --git a/tests/coverage/attr/trait-impl-inherit.cov-map b/tests/coverage/attr/trait-impl-inherit.cov-map index bf10083dd2909..14c65777b170b 100644 --- a/tests/coverage/attr/trait-impl-inherit.cov-map +++ b/tests/coverage/attr/trait-impl-inherit.cov-map @@ -1,10 +1,10 @@ Function name: ::f -Raw bytes (24): 0x[01, 01, 00, 04, 01, 11, 05, 00, 10, 01, 01, 09, 00, 11, 01, 00, 12, 00, 1a, 01, 01, 05, 00, 06] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 10, 05, 00, 10, 01, 01, 09, 00, 11, 01, 00, 12, 00, 1a, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => $DIR/trait-impl-inherit.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 17, 5) to (start + 0, 16) +- Code(Counter(0)) at (prev + 16, 5) to (start + 0, 16) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 17) - Code(Counter(0)) at (prev + 0, 18) to (start + 0, 26) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) diff --git a/tests/coverage/attr/trait-impl-inherit.coverage b/tests/coverage/attr/trait-impl-inherit.coverage index b92d82aefbc8c..a1431ce98340a 100644 --- a/tests/coverage/attr/trait-impl-inherit.coverage +++ b/tests/coverage/attr/trait-impl-inherit.coverage @@ -2,7 +2,6 @@ LL| |// Checks that `#[coverage(..)]` in a trait method is not inherited in an LL| |// implementation. LL| |//@ edition: 2021 - LL| |//@ reference: attributes.coverage.trait-impl-inherit LL| | LL| |trait T { LL| | #[coverage(off)] diff --git a/tests/coverage/attr/trait-impl-inherit.rs b/tests/coverage/attr/trait-impl-inherit.rs index 951fecce90a18..a36f9d0fcbc3d 100644 --- a/tests/coverage/attr/trait-impl-inherit.rs +++ b/tests/coverage/attr/trait-impl-inherit.rs @@ -2,7 +2,6 @@ // Checks that `#[coverage(..)]` in a trait method is not inherited in an // implementation. //@ edition: 2021 -//@ reference: attributes.coverage.trait-impl-inherit trait T { #[coverage(off)] diff --git a/tests/coverage/iffy/no_cov_crate.cov-map b/tests/coverage/iffy/no_cov_crate.cov-map index e447cac4d8da9..235da4a05bba3 100644 --- a/tests/coverage/iffy/no_cov_crate.cov-map +++ b/tests/coverage/iffy/no_cov_crate.cov-map @@ -1,46 +1,46 @@ Function name: no_cov_crate::add_coverage_1 -Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 01, 00, 14, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 22, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 14, 01, 00, 14, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 22, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 22, 1) to (start + 0, 20) +- Code(Counter(0)) at (prev + 20, 1) to (start + 0, 20) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 13) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 34) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: no_cov_crate::add_coverage_2 -Raw bytes (24): 0x[01, 01, 00, 04, 01, 1a, 01, 00, 14, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 22, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 18, 01, 00, 14, 01, 01, 05, 00, 0d, 01, 00, 0e, 00, 22, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 26, 1) to (start + 0, 20) +- Code(Counter(0)) at (prev + 24, 1) to (start + 0, 20) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 13) - Code(Counter(0)) at (prev + 0, 14) to (start + 0, 34) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: no_cov_crate::add_coverage_not_called (unused) -Raw bytes (24): 0x[01, 01, 00, 04, 00, 1f, 01, 00, 1d, 00, 01, 05, 00, 0d, 00, 00, 0e, 00, 26, 00, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 00, 1d, 01, 00, 1d, 00, 01, 05, 00, 0d, 00, 00, 0e, 00, 26, 00, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 4 -- Code(Zero) at (prev + 31, 1) to (start + 0, 29) +- Code(Zero) at (prev + 29, 1) to (start + 0, 29) - Code(Zero) at (prev + 1, 5) to (start + 0, 13) - Code(Zero) at (prev + 0, 14) to (start + 0, 38) - Code(Zero) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: (none) Function name: no_cov_crate::main -Raw bytes (54): 0x[01, 01, 00, 0a, 01, 4f, 01, 00, 0a, 01, 01, 13, 00, 2e, 01, 02, 05, 00, 1c, 01, 01, 05, 00, 1c, 01, 01, 05, 00, 15, 01, 01, 05, 00, 15, 01, 02, 05, 00, 2b, 01, 01, 05, 00, 1f, 01, 01, 05, 00, 2c, 01, 01, 01, 00, 02] +Raw bytes (54): 0x[01, 01, 00, 0a, 01, 4d, 01, 00, 0a, 01, 01, 13, 00, 2e, 01, 02, 05, 00, 1c, 01, 01, 05, 00, 1c, 01, 01, 05, 00, 15, 01, 01, 05, 00, 15, 01, 02, 05, 00, 2b, 01, 01, 05, 00, 1f, 01, 01, 05, 00, 2c, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 10 -- Code(Counter(0)) at (prev + 79, 1) to (start + 0, 10) +- Code(Counter(0)) at (prev + 77, 1) to (start + 0, 10) - Code(Counter(0)) at (prev + 1, 19) to (start + 0, 46) - Code(Counter(0)) at (prev + 2, 5) to (start + 0, 28) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 28) @@ -53,12 +53,12 @@ Number of file 0 mappings: 10 Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer -Raw bytes (29): 0x[01, 01, 00, 05, 01, 33, 05, 00, 20, 01, 01, 09, 00, 11, 01, 00, 12, 00, 26, 01, 01, 09, 00, 23, 01, 0a, 05, 00, 06] +Raw bytes (29): 0x[01, 01, 00, 05, 01, 31, 05, 00, 20, 01, 01, 09, 00, 11, 01, 00, 12, 00, 26, 01, 01, 09, 00, 23, 01, 0a, 05, 00, 06] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 5 -- Code(Counter(0)) at (prev + 51, 5) to (start + 0, 32) +- Code(Counter(0)) at (prev + 49, 5) to (start + 0, 32) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 17) - Code(Counter(0)) at (prev + 0, 18) to (start + 0, 38) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 35) @@ -66,12 +66,12 @@ Number of file 0 mappings: 5 Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer_both_covered -Raw bytes (29): 0x[01, 01, 00, 05, 01, 41, 05, 00, 2d, 01, 01, 09, 00, 11, 01, 00, 12, 00, 26, 01, 01, 09, 00, 17, 01, 09, 05, 00, 06] +Raw bytes (29): 0x[01, 01, 00, 05, 01, 3f, 05, 00, 2d, 01, 01, 09, 00, 11, 01, 00, 12, 00, 26, 01, 01, 09, 00, 17, 01, 09, 05, 00, 06] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 0 Number of file 0 mappings: 5 -- Code(Counter(0)) at (prev + 65, 5) to (start + 0, 45) +- Code(Counter(0)) at (prev + 63, 5) to (start + 0, 45) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 17) - Code(Counter(0)) at (prev + 0, 18) to (start + 0, 38) - Code(Counter(0)) at (prev + 1, 9) to (start + 0, 23) @@ -79,13 +79,13 @@ Number of file 0 mappings: 5 Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer_both_covered::inner -Raw bytes (41): 0x[01, 01, 01, 01, 05, 07, 01, 45, 09, 00, 20, 01, 01, 10, 00, 17, 05, 01, 11, 00, 19, 05, 00, 1a, 00, 2e, 02, 02, 11, 00, 19, 02, 00, 1a, 00, 32, 01, 02, 09, 00, 0a] +Raw bytes (41): 0x[01, 01, 01, 01, 05, 07, 01, 43, 09, 00, 20, 01, 01, 10, 00, 17, 05, 01, 11, 00, 19, 05, 00, 1a, 00, 2e, 02, 02, 11, 00, 19, 02, 00, 1a, 00, 32, 01, 02, 09, 00, 0a] Number of files: 1 - file 0 => $DIR/no_cov_crate.rs Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 7 -- Code(Counter(0)) at (prev + 69, 9) to (start + 0, 32) +- Code(Counter(0)) at (prev + 67, 9) to (start + 0, 32) - Code(Counter(0)) at (prev + 1, 16) to (start + 0, 23) - Code(Counter(1)) at (prev + 1, 17) to (start + 0, 25) - Code(Counter(1)) at (prev + 0, 26) to (start + 0, 46) diff --git a/tests/coverage/iffy/no_cov_crate.coverage b/tests/coverage/iffy/no_cov_crate.coverage index 70143c0629a35..ff945ca5f6187 100644 --- a/tests/coverage/iffy/no_cov_crate.coverage +++ b/tests/coverage/iffy/no_cov_crate.coverage @@ -1,7 +1,5 @@ LL| |#![feature(coverage_attribute)] LL| |// Enables `coverage(off)` on the entire crate - LL| |//@ reference: attributes.coverage.intro - LL| |//@ reference: attributes.coverage.nesting LL| | LL| |#[coverage(off)] LL| |fn do_not_add_coverage_1() { diff --git a/tests/coverage/iffy/no_cov_crate.rs b/tests/coverage/iffy/no_cov_crate.rs index 72fd6317a1707..88b80b9d41037 100644 --- a/tests/coverage/iffy/no_cov_crate.rs +++ b/tests/coverage/iffy/no_cov_crate.rs @@ -1,7 +1,5 @@ #![feature(coverage_attribute)] // Enables `coverage(off)` on the entire crate -//@ reference: attributes.coverage.intro -//@ reference: attributes.coverage.nesting #[coverage(off)] fn do_not_add_coverage_1() { diff --git a/tests/mir-opt/gvn_non_scalar_field_of_packed.non_scalar_field_of_packed.GVN.diff b/tests/mir-opt/gvn_non_scalar_field_of_packed.non_scalar_field_of_packed.GVN.diff new file mode 100644 index 0000000000000..aff552d2a6020 --- /dev/null +++ b/tests/mir-opt/gvn_non_scalar_field_of_packed.non_scalar_field_of_packed.GVN.diff @@ -0,0 +1,19 @@ +- // MIR for `non_scalar_field_of_packed` before GVN ++ // MIR for `non_scalar_field_of_packed` after GVN + + fn non_scalar_field_of_packed() -> (u32, u32) { + let mut _0: (u32, u32); + let mut _1: Outer; + + bb0: { + StorageLive(_1); + _1 = const C; +- _0 = copy ((_1.1: Packed).1: (u32, u32)); ++ _0 = const ConstValue(Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: (u32, u32)); + StorageDead(_1); + return; + } + } ++ ++ ALLOC0 (size: 8, align: 4) { .. } + diff --git a/tests/mir-opt/gvn_non_scalar_field_of_packed.rs b/tests/mir-opt/gvn_non_scalar_field_of_packed.rs new file mode 100644 index 0000000000000..52773f93e834e --- /dev/null +++ b/tests/mir-opt/gvn_non_scalar_field_of_packed.rs @@ -0,0 +1,28 @@ +//@ test-mir-pass: GVN +//@ compile-flags: -Zdump-mir-exclude-alloc-bytes -Zverbose-internals + +// This is a regression test for https://github.com/rust-lang/rust/issues/163782 + +#![crate_type = "lib"] + +#[repr(C, packed)] +#[derive(Clone, Copy)] +pub struct Packed { + pub a: u8, + pub b: (u32, u32), +} + +#[derive(Clone, Copy)] +pub struct Outer { + pub x: u32, + pub p: Packed, +} + +const C: Outer = Outer { x: 7, p: Packed { a: 1, b: (2, 3) } }; + +// EMIT_MIR gvn_non_scalar_field_of_packed.non_scalar_field_of_packed.GVN.diff +pub fn non_scalar_field_of_packed() -> (u32, u32) { + // CHECK-LABEL: fn non_scalar_field_of_packed( + // CHECK: _0 = const ConstValue(Indirect { alloc_id: {{.*}}, offset: Size(0 bytes) }: (u32, u32)); + C.p.b +} diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr b/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr new file mode 100644 index 0000000000000..2881d01ba23dc --- /dev/null +++ b/tests/ui/abi/invalid-self-parameter-type-56806.next.stderr @@ -0,0 +1,18 @@ +error[E0391]: cycle detected when checking if trait `Trait` is dyn-compatible + --> $DIR/invalid-self-parameter-type-56806.rs:11:1 + | +LL | pub trait Trait { + | ^^^^^^^^^^^^^^^ + | + = note: ...which requires determining dyn-compatibility of trait `Trait`... + = note: ...which again requires checking if trait `Trait` is dyn-compatible, completing the cycle +note: cycle used when checking that `Trait::dyn_instead_of_self` is well-formed + --> $DIR/invalid-self-parameter-type-56806.rs:12:5 + | +LL | fn dyn_instead_of_self(self: Box); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.stderr b/tests/ui/abi/invalid-self-parameter-type-56806.old.stderr similarity index 91% rename from tests/ui/abi/invalid-self-parameter-type-56806.stderr rename to tests/ui/abi/invalid-self-parameter-type-56806.old.stderr index ac249b8f10880..a034de9c3bcb3 100644 --- a/tests/ui/abi/invalid-self-parameter-type-56806.stderr +++ b/tests/ui/abi/invalid-self-parameter-type-56806.old.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `Box<(dyn Trait + 'static)>` - --> $DIR/invalid-self-parameter-type-56806.rs:3:34 + --> $DIR/invalid-self-parameter-type-56806.rs:12:34 | LL | fn dyn_instead_of_self(self: Box); | ^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/invalid-self-parameter-type-56806.rs b/tests/ui/abi/invalid-self-parameter-type-56806.rs index 60229df300577..ac25489f59b32 100644 --- a/tests/ui/abi/invalid-self-parameter-type-56806.rs +++ b/tests/ui/abi/invalid-self-parameter-type-56806.rs @@ -1,7 +1,17 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + // https://github.com/rust-lang/rust/issues/56806 +// +// This results in a query cycle with the new solver. Let's not +// bother with this when stabilizing the new solver. For more context, +// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998 + pub trait Trait { fn dyn_instead_of_self(self: Box); - //~^ ERROR invalid `self` parameter type + //[old]~^ ERROR: invalid `self` parameter type + //[next]~^^^ ERROR: cycle detected when checking if trait `Trait` is dyn-compatible } pub fn main() {} diff --git a/tests/ui/asm/invalid-const-operand.rs b/tests/ui/asm/invalid-const-operand.rs index 083d4f4e18480..a496687011320 100644 --- a/tests/ui/asm/invalid-const-operand.rs +++ b/tests/ui/asm/invalid-const-operand.rs @@ -2,7 +2,7 @@ //@ needs-asm-support //@ ignore-nvptx64 //@ ignore-spirv -//@ reference: asm.operand-type.supported-operands.const +//@ reference: asm.operand-type.supported-operands-const #![feature(asm_const_ptr)] diff --git a/tests/ui/asm/invalid-sym-operand.rs b/tests/ui/asm/invalid-sym-operand.rs index 48df1918daf0f..4340a5c0a86e4 100644 --- a/tests/ui/asm/invalid-sym-operand.rs +++ b/tests/ui/asm/invalid-sym-operand.rs @@ -1,7 +1,7 @@ //@ needs-asm-support //@ ignore-nvptx64 //@ ignore-spirv -//@ reference: asm.operand-type.supported-operands.sym +//@ reference: asm.operand-type.supported-operands-sym use std::arch::{asm, global_asm}; diff --git a/tests/ui/asm/label-operand.rs b/tests/ui/asm/label-operand.rs index f1be5d7d85609..9f5f6e08b22be 100644 --- a/tests/ui/asm/label-operand.rs +++ b/tests/ui/asm/label-operand.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ reference: asm.operand-type.supported-operands.label +//@ reference: asm.operand-type.supported-operands-label //@ revisions: aarch64 arm arm64ec riscv32 riscv64 x86 x86_64 //@ needs-asm-support //@[aarch64] only-aarch64 diff --git a/tests/ui/asm/non-const.rs b/tests/ui/asm/non-const.rs index 2ee4b9c1d70af..f574a8742eea8 100644 --- a/tests/ui/asm/non-const.rs +++ b/tests/ui/asm/non-const.rs @@ -1,5 +1,5 @@ //@ needs-asm-support -//@ reference: asm.operand-type.supported-operands.const +//@ reference: asm.operand-type.supported-operands-const use std::arch::global_asm; diff --git a/tests/ui/asm/noreturn.rs b/tests/ui/asm/noreturn.rs index 59794275d02bd..b93e7f8c12454 100644 --- a/tests/ui/asm/noreturn.rs +++ b/tests/ui/asm/noreturn.rs @@ -1,6 +1,6 @@ //@ needs-asm-support //@ check-pass -//@ reference: asm.options.supported-options.noreturn +//@ reference: asm.options.supported-options-noreturn #![crate_type = "rlib"] diff --git a/tests/ui/asm/tainting-on-error.rs b/tests/ui/asm/tainting-on-error.rs index aa9f33de3753c..30ddde36a651e 100644 --- a/tests/ui/asm/tainting-on-error.rs +++ b/tests/ui/asm/tainting-on-error.rs @@ -1,5 +1,5 @@ //@ needs-asm-support -//@ reference: asm.operand-type.supported-operands.sym +//@ reference: asm.operand-type.supported-operands-sym use std::arch::asm; diff --git a/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs b/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs index 042deefcbb6e5..6e57c780658da 100644 --- a/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs +++ b/tests/ui/assumptions_on_binders/test-infra-fails-properly.rs @@ -74,4 +74,36 @@ core::test_binder_constraints! { } } +core::test_binder_constraints! { + impl { + forall<'a> where 'a: 'static { + } expect { + ambiguity + //~^ ERROR forall expect clause failed + } + } +} + +core::test_binder_constraints! { + impl { + forall<'a> where 'a: 'static { + //~^ ERROR forall expect clause failed + //~| ERROR unable to satisfy constraints involving placeholders due to unknown implied bounds + ambiguity + } expect { + } + } +} + +core::test_binder_constraints! { + impl { + forall<'a> where 'a: 'static { + //~^ ERROR unable to satisfy constraints involving placeholders due to unknown implied bounds + ambiguity + } expect { + ambiguity + } + } +} + fn main() {} diff --git a/tests/ui/assumptions_on_binders/test-infra-fails-properly.stderr b/tests/ui/assumptions_on_binders/test-infra-fails-properly.stderr index ab025b0e0b9d6..2236a5d95ca89 100644 --- a/tests/ui/assumptions_on_binders/test-infra-fails-properly.stderr +++ b/tests/ui/assumptions_on_binders/test-infra-fails-properly.stderr @@ -78,6 +78,57 @@ error: bound type test binder constraint must be alias (it's a AliasTyOutlivesVi LL | for<> T: 'a | ^ -error: aborting due to 9 previous errors +error: forall expect clause failed + --> $DIR/test-infra-fails-properly.rs:81:13 + | +LL | ambiguity + | ^^^^^^^^^ + | + = note: expected: And( + [ + Ambiguity( + $DIR/test-infra-fails-properly.rs:81:13: 81:22 (#0), + ), + ], + ) + = note: actual: And( + [], + ) + +error: forall expect clause failed + --> $DIR/test-infra-fails-properly.rs:89:9 + | +LL | forall<'a> where 'a: 'static { + | ^^^^^^ + | +note: constraint from here + --> $DIR/test-infra-fails-properly.rs:89:9 + | +LL | forall<'a> where 'a: 'static { + | ^^^^^^ + = note: expected: And( + [], + ) + = note: actual: And( + [ + Ambiguity( + $DIR/test-infra-fails-properly.rs:89:9: 89:15 (#0), + ), + ], + ) + +error: unable to satisfy constraints involving placeholders due to unknown implied bounds + --> $DIR/test-infra-fails-properly.rs:89:9 + | +LL | forall<'a> where 'a: 'static { + | ^^^^^^ + +error: unable to satisfy constraints involving placeholders due to unknown implied bounds + --> $DIR/test-infra-fails-properly.rs:100:9 + | +LL | forall<'a> where 'a: 'static { + | ^^^^^^ + +error: aborting due to 13 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/assumptions_on_binders/test-infra-works.rs b/tests/ui/assumptions_on_binders/test-infra-works.rs index b36e16a545bb3..f7d2a01d936b6 100644 --- a/tests/ui/assumptions_on_binders/test-infra-works.rs +++ b/tests/ui/assumptions_on_binders/test-infra-works.rs @@ -67,11 +67,11 @@ core::test_binder_constraints! { // `impl` should fail because the constraints asserted in `expect` should fail to prove true. Might // be https://github.com/rust-lang/project-assumptions-on-binders/issues/26 // -// `where` syntax goes through the full clause destructuring and register_obligation pipeline +// `predicates` syntax goes through the full clause destructuring and register_obligation pipeline core::test_binder_constraints! { impl { forall<'a> { - where T::Assoc: 'a + predicates T::Assoc: 'a } expect { or { for<'b> T::Assoc: 'b, diff --git a/tests/ui/assumptions_on_binders/test_infra_empty_forall.rs b/tests/ui/assumptions_on_binders/test_infra_empty_forall.rs new file mode 100644 index 0000000000000..1e97bf49f14f3 --- /dev/null +++ b/tests/ui/assumptions_on_binders/test_infra_empty_forall.rs @@ -0,0 +1,19 @@ +//@ check-pass +//@ compile-flags: -Zassumptions-on-binders -Znext-solver=globally + +#![feature(test_binder_constraints, non_lifetime_binders)] +#![expect(incomplete_features)] + +core::test_binder_constraints! { + impl<'a: 'b, 'b> { + // This forall still gets eagerly handled by the testing DSL even though its bound vars + // are unused. If we as a performance optimization don't create a new universe for this + // forall then we'll wind up ICEing when trying to eagerly handle placeholders mistakenly + // in the root universe + forall<'c> { + 'a: 'b + } + } +} + +fn main() {} diff --git a/tests/ui/async-await/inference_var_self_argument.next.stderr b/tests/ui/async-await/inference_var_self_argument.next.stderr new file mode 100644 index 0000000000000..1d321b9f34fde --- /dev/null +++ b/tests/ui/async-await/inference_var_self_argument.next.stderr @@ -0,0 +1,18 @@ +error[E0391]: cycle detected when checking if trait `Foo` is dyn-compatible + --> $DIR/inference_var_self_argument.rs:13:1 + | +LL | trait Foo { + | ^^^^^^^^^ + | + = note: ...which requires determining dyn-compatibility of trait `Foo`... + = note: ...which again requires checking if trait `Foo` is dyn-compatible, completing the cycle +note: cycle used when checking that `Foo::foo` is well-formed + --> $DIR/inference_var_self_argument.rs:15:5 + | +LL | async fn foo(self: &dyn Foo) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.old.stderr similarity index 88% rename from tests/ui/async-await/inference_var_self_argument.stderr rename to tests/ui/async-await/inference_var_self_argument.old.stderr index c4240a095e685..9460138d450a1 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.old.stderr @@ -1,5 +1,5 @@ error[E0307]: invalid `self` parameter type: `&dyn Foo` - --> $DIR/inference_var_self_argument.rs:5:24 + --> $DIR/inference_var_self_argument.rs:15:24 | LL | async fn foo(self: &dyn Foo) { | ^^^^^^^^ @@ -8,17 +8,18 @@ LL | async fn foo(self: &dyn Foo) { = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/inference_var_self_argument.rs:5:33 + --> $DIR/inference_var_self_argument.rs:15:33 | LL | async fn foo(self: &dyn Foo) { | ^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/inference_var_self_argument.rs:5:14 + --> $DIR/inference_var_self_argument.rs:15:14 | LL | trait Foo { | --- this trait is not dyn compatible... +LL | LL | async fn foo(self: &dyn Foo) { | ^^^ ...because method `foo` is `async` = help: consider moving `foo` to another trait diff --git a/tests/ui/async-await/inference_var_self_argument.rs b/tests/ui/async-await/inference_var_self_argument.rs index d03f2b5c50bff..b07303476c4a4 100644 --- a/tests/ui/async-await/inference_var_self_argument.rs +++ b/tests/ui/async-await/inference_var_self_argument.rs @@ -1,10 +1,20 @@ -//! This is a regression test for an ICE. +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ edition: 2021 +// This is a regression test for an ICE. +// +// This results in a query cycle with the new solver. Let's not +// bother with this when stabilizing the new solver. For more context, +// see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/dyn.20compatibility.20check.20in.20object.20candidate.20causes.20cycle/with/627370998 + + trait Foo { + //[next]~^ ERROR: cycle detected when checking if trait `Foo` is dyn-compatible async fn foo(self: &dyn Foo) { - //~^ ERROR: `Foo` is not dyn compatible - //~| ERROR invalid `self` parameter type: `&dyn Foo` + //[old]~^ ERROR: `Foo` is not dyn compatible + //[old]~| ERROR: invalid `self` parameter type: `&dyn Foo` todo!() } } diff --git a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs index 3f9246f68fcd3..bd819e42a49da 100644 --- a/tests/ui/borrowck/alias-liveness/escaping-bounds.rs +++ b/tests/ui/borrowck/alias-liveness/escaping-bounds.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // Ensure that we don't ICE when an alias that has escaping bound vars is @@ -16,7 +19,7 @@ fn foo<'a, 'b, T: Foo>(_: ::Assoc<'a, 'b>) {} fn test<'b, T: Foo>() { let y: MentionsLifetimeAndType<'_, for<'a> fn(::Assoc<'a, 'b>)> = - MentionsLifetimeAndType(&(), foo); + MentionsLifetimeAndType(&(), foo::); } fn main() {} diff --git a/tests/ui/cfg/cfg-false-use-item.rs b/tests/ui/cfg/cfg-false-use-item.rs index d907e17a0c11d..35b40e3e6a0db 100644 --- a/tests/ui/cfg/cfg-false-use-item.rs +++ b/tests/ui/cfg/cfg-false-use-item.rs @@ -1,8 +1,8 @@ //! Test that use items with cfg(false) are properly filtered out //@ run-pass -//@ reference: cfg.predicate.literal //@ reference: cfg.attr.effect +//@ reference: cfg.predicate-literal pub fn main() { // Make sure that this view item is filtered out because otherwise it would diff --git a/tests/ui/cfg/cfgs-on-items.rs b/tests/ui/cfg/cfgs-on-items.rs index 56f87350fea2c..2a4e16bf75142 100644 --- a/tests/ui/cfg/cfgs-on-items.rs +++ b/tests/ui/cfg/cfgs-on-items.rs @@ -1,8 +1,8 @@ //@ run-pass //@ compile-flags: --cfg fooA --cfg fooB --check-cfg=cfg(fooA,fooB,fooC,bar) -//@ reference: cfg.predicate.all -//@ reference: cfg.predicate.any -//@ reference: cfg.predicate.not +//@ reference: cfg.predicate-all +//@ reference: cfg.predicate-any +//@ reference: cfg.predicate-not // fooA AND !bar #[cfg(all(fooA, not(bar)))] diff --git a/tests/ui/cfg/true-false.rs b/tests/ui/cfg/true-false.rs index b8e0e8968c83e..24f5c35cb90fa 100644 --- a/tests/ui/cfg/true-false.rs +++ b/tests/ui/cfg/true-false.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ reference: cfg.predicate.literal +//@ reference: cfg.predicate-literal #![feature(link_cfg)] diff --git a/tests/ui/const-generics/argument_order.rs b/tests/ui/const-generics/argument_order.rs index f8980c9b54d75..20be10c77cac2 100644 --- a/tests/ui/const-generics/argument_order.rs +++ b/tests/ui/const-generics/argument_order.rs @@ -1,4 +1,4 @@ -//@ reference: items.generics.syntax.decl-order +//@ reference: items.generics.decl-order struct Good { arr: [u8; { N }], diff --git a/tests/ui/const-generics/generic_arg_infer/paren_infer.rs b/tests/ui/const-generics/generic_arg_infer/paren_infer.rs index 869683b705669..1f6158b0559bc 100644 --- a/tests/ui/const-generics/generic_arg_infer/paren_infer.rs +++ b/tests/ui/const-generics/generic_arg_infer/paren_infer.rs @@ -1,5 +1,6 @@ //@ check-pass -//@ reference: items.generics.const.inferred +//@ reference: expr.array.length-restriction +//@ reference: paths.expr.complex-const-params struct Foo; diff --git a/tests/ui/coverage-attr/allowed-positions.rs b/tests/ui/coverage-attr/allowed-positions.rs index cfbc7f5e6c0c7..8168b46a87375 100644 --- a/tests/ui/coverage-attr/allowed-positions.rs +++ b/tests/ui/coverage-attr/allowed-positions.rs @@ -1,6 +1,5 @@ //! Tests where the `#[coverage(..)]` attribute can and cannot be used. -//@ reference: attributes.coverage.allowed-positions #![feature(coverage_attribute)] #![feature(extern_types)] diff --git a/tests/ui/coverage-attr/allowed-positions.stderr b/tests/ui/coverage-attr/allowed-positions.stderr index e3e1e67bf7375..3e585d26e3e40 100644 --- a/tests/ui/coverage-attr/allowed-positions.stderr +++ b/tests/ui/coverage-attr/allowed-positions.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental - --> $DIR/allowed-positions.rs:106:25 + --> $DIR/allowed-positions.rs:105:25 | LL | let _closure_expr = #[coverage(off)] || (); | ^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | let _closure_expr = #[coverage(off)] || (); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: the `coverage` attribute cannot be used on type aliases - --> $DIR/allowed-positions.rs:14:3 + --> $DIR/allowed-positions.rs:13:3 | LL | #[coverage(off)] | ^^^^^^^^ @@ -17,7 +17,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on traits - --> $DIR/allowed-positions.rs:17:3 + --> $DIR/allowed-positions.rs:16:3 | LL | #[coverage(off)] | ^^^^^^^^ @@ -25,7 +25,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on associated consts - --> $DIR/allowed-positions.rs:19:7 + --> $DIR/allowed-positions.rs:18:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -33,7 +33,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on associated types - --> $DIR/allowed-positions.rs:22:7 + --> $DIR/allowed-positions.rs:21:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -41,7 +41,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on required trait methods - --> $DIR/allowed-positions.rs:25:7 + --> $DIR/allowed-positions.rs:24:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -49,7 +49,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions with a body, impl blocks, and modules error: the `coverage` attribute cannot be used on required trait methods - --> $DIR/allowed-positions.rs:31:7 + --> $DIR/allowed-positions.rs:30:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -57,7 +57,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions with a body, impl blocks, and modules error: the `coverage` attribute cannot be used on associated types - --> $DIR/allowed-positions.rs:39:7 + --> $DIR/allowed-positions.rs:38:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -65,7 +65,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on associated types - --> $DIR/allowed-positions.rs:56:7 + --> $DIR/allowed-positions.rs:55:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -73,7 +73,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on structs - --> $DIR/allowed-positions.rs:61:3 + --> $DIR/allowed-positions.rs:60:3 | LL | #[coverage(off)] | ^^^^^^^^ @@ -81,7 +81,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on struct fields - --> $DIR/allowed-positions.rs:63:7 + --> $DIR/allowed-positions.rs:62:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -89,7 +89,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on foreign statics - --> $DIR/allowed-positions.rs:76:7 + --> $DIR/allowed-positions.rs:75:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -97,7 +97,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on foreign types - --> $DIR/allowed-positions.rs:79:7 + --> $DIR/allowed-positions.rs:78:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -105,7 +105,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on foreign functions - --> $DIR/allowed-positions.rs:82:7 + --> $DIR/allowed-positions.rs:81:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -113,7 +113,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions with a body, impl blocks, and modules error: the `coverage` attribute cannot be used on statements - --> $DIR/allowed-positions.rs:88:7 + --> $DIR/allowed-positions.rs:87:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -121,7 +121,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on statements - --> $DIR/allowed-positions.rs:94:7 + --> $DIR/allowed-positions.rs:93:7 | LL | #[coverage(off)] | ^^^^^^^^ @@ -129,7 +129,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on match arms - --> $DIR/allowed-positions.rs:110:11 + --> $DIR/allowed-positions.rs:109:11 | LL | #[coverage(off)] | ^^^^^^^^ @@ -137,7 +137,7 @@ LL | #[coverage(off)] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error: the `coverage` attribute cannot be used on expressions - --> $DIR/allowed-positions.rs:114:7 + --> $DIR/allowed-positions.rs:113:7 | LL | #[coverage(off)] | ^^^^^^^^ diff --git a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr index f3b5cbf22282f..71f832c319773 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `coverage` attribute input - --> $DIR/bad-attr-ice.rs:11:3 + --> $DIR/bad-attr-ice.rs:10:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list diff --git a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr index 4b0330fee8ca3..be429beb1824d 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr @@ -1,5 +1,5 @@ error[E0658]: the `coverage` attribute is an experimental feature - --> $DIR/bad-attr-ice.rs:11:3 + --> $DIR/bad-attr-ice.rs:10:3 | LL | #[coverage] | ^^^^^^^^ @@ -9,7 +9,7 @@ LL | #[coverage] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0539]: malformed `coverage` attribute input - --> $DIR/bad-attr-ice.rs:11:3 + --> $DIR/bad-attr-ice.rs:10:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list diff --git a/tests/ui/coverage-attr/bad-attr-ice.rs b/tests/ui/coverage-attr/bad-attr-ice.rs index 2626f47037dbd..3c1d3424f3d9f 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.rs +++ b/tests/ui/coverage-attr/bad-attr-ice.rs @@ -2,7 +2,6 @@ //@ revisions: feat nofeat //@ compile-flags: -Cinstrument-coverage //@ needs-profiler-runtime -//@ reference: attributes.coverage.syntax // Malformed `coverage` attributes should not cause an ICE when built // with `-Cinstrument-coverage`. diff --git a/tests/ui/coverage-attr/bad-syntax.rs b/tests/ui/coverage-attr/bad-syntax.rs index ef7b41db3440e..ea29fd6ae63a3 100644 --- a/tests/ui/coverage-attr/bad-syntax.rs +++ b/tests/ui/coverage-attr/bad-syntax.rs @@ -1,7 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.syntax -//@ reference: attributes.coverage.duplicates // Tests the error messages produced (or not produced) by various unusual // uses of the `#[coverage(..)]` attribute. diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr index ee082951d101b..8269228444262 100644 --- a/tests/ui/coverage-attr/bad-syntax.stderr +++ b/tests/ui/coverage-attr/bad-syntax.stderr @@ -1,29 +1,29 @@ error: multiple `coverage` attributes - --> $DIR/bad-syntax.rs:10:1 + --> $DIR/bad-syntax.rs:8:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/bad-syntax.rs:9:1 + --> $DIR/bad-syntax.rs:7:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ error: multiple `coverage` attributes - --> $DIR/bad-syntax.rs:14:1 + --> $DIR/bad-syntax.rs:12:1 | LL | #[coverage(on)] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/bad-syntax.rs:13:1 + --> $DIR/bad-syntax.rs:11:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ error[E0539]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:17:3 + --> $DIR/bad-syntax.rs:15:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -36,7 +36,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:20:3 + --> $DIR/bad-syntax.rs:18:3 | LL | #[coverage = true] | ^^^^^^^^^------ @@ -53,7 +53,7 @@ LL + #[coverage(on)] | error[E0805]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:23:3 + --> $DIR/bad-syntax.rs:21:3 | LL | #[coverage()] | ^^^^^^^^-- @@ -68,7 +68,7 @@ LL | #[coverage(on)] | ++ error[E0805]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:26:3 + --> $DIR/bad-syntax.rs:24:3 | LL | #[coverage(off, off)] | ^^^^^^^^---------- @@ -85,7 +85,7 @@ LL + #[coverage(on)] | error[E0805]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:29:3 + --> $DIR/bad-syntax.rs:27:3 | LL | #[coverage(off, on)] | ^^^^^^^^--------- @@ -102,7 +102,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:32:3 + --> $DIR/bad-syntax.rs:30:3 | LL | #[coverage(bogus)] | ^^^^^^^^^-----^ @@ -119,7 +119,7 @@ LL + #[coverage(on)] | error[E0805]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:35:3 + --> $DIR/bad-syntax.rs:33:3 | LL | #[coverage(bogus, off)] | ^^^^^^^^------------ @@ -136,7 +136,7 @@ LL + #[coverage(on)] | error[E0805]: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:38:3 + --> $DIR/bad-syntax.rs:36:3 | LL | #[coverage(off, bogus)] | ^^^^^^^^------------ @@ -153,7 +153,7 @@ LL + #[coverage(on)] | error: expected identifier, found `,` - --> $DIR/bad-syntax.rs:44:12 + --> $DIR/bad-syntax.rs:42:12 | LL | #[coverage(,off)] | ^ expected identifier diff --git a/tests/ui/coverage-attr/name-value.rs b/tests/ui/coverage-attr/name-value.rs index 6e81ab8961672..e2d133f762ac1 100644 --- a/tests/ui/coverage-attr/name-value.rs +++ b/tests/ui/coverage-attr/name-value.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.syntax // Demonstrates the diagnostics produced when using the syntax // `#[coverage = "off"]`, which should not be allowed. diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr index 7eff78dd80d26..e5cdcf83e0a48 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:12:3 + --> $DIR/name-value.rs:11:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -16,7 +16,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:17:8 + --> $DIR/name-value.rs:16:8 | LL | #![coverage = "off"] | ^^^^^^^^^------- @@ -33,7 +33,7 @@ LL + #![coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:21:3 + --> $DIR/name-value.rs:20:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -50,7 +50,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on structs - --> $DIR/name-value.rs:21:3 + --> $DIR/name-value.rs:20:3 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -58,7 +58,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:26:3 + --> $DIR/name-value.rs:25:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -75,7 +75,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:29:7 + --> $DIR/name-value.rs:28:7 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -92,7 +92,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on associated consts - --> $DIR/name-value.rs:29:7 + --> $DIR/name-value.rs:28:7 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -100,7 +100,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:35:3 + --> $DIR/name-value.rs:34:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -117,7 +117,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on traits - --> $DIR/name-value.rs:35:3 + --> $DIR/name-value.rs:34:3 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -125,7 +125,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:39:7 + --> $DIR/name-value.rs:38:7 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -142,7 +142,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on associated consts - --> $DIR/name-value.rs:39:7 + --> $DIR/name-value.rs:38:7 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -150,7 +150,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:44:7 + --> $DIR/name-value.rs:43:7 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -167,7 +167,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on associated types - --> $DIR/name-value.rs:44:7 + --> $DIR/name-value.rs:43:7 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -175,7 +175,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:50:3 + --> $DIR/name-value.rs:49:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -192,7 +192,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:53:7 + --> $DIR/name-value.rs:52:7 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -209,7 +209,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on associated consts - --> $DIR/name-value.rs:53:7 + --> $DIR/name-value.rs:52:7 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -217,7 +217,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:58:7 + --> $DIR/name-value.rs:57:7 | LL | #[coverage = "off"] | ^^^^^^^^^------- @@ -234,7 +234,7 @@ LL + #[coverage(on)] | error: the `coverage` attribute cannot be used on associated types - --> $DIR/name-value.rs:58:7 + --> $DIR/name-value.rs:57:7 | LL | #[coverage = "off"] | ^^^^^^^^ @@ -242,7 +242,7 @@ LL | #[coverage = "off"] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/name-value.rs:64:3 + --> $DIR/name-value.rs:63:3 | LL | #[coverage = "off"] | ^^^^^^^^^------- diff --git a/tests/ui/coverage-attr/subword.rs b/tests/ui/coverage-attr/subword.rs index 84a5132ac4ac3..16582240b6908 100644 --- a/tests/ui/coverage-attr/subword.rs +++ b/tests/ui/coverage-attr/subword.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.syntax // Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare // words, not part of a more complicated substructure. diff --git a/tests/ui/coverage-attr/subword.stderr b/tests/ui/coverage-attr/subword.stderr index 401c1cec958e4..e03c38398b298 100644 --- a/tests/ui/coverage-attr/subword.stderr +++ b/tests/ui/coverage-attr/subword.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `coverage` attribute input - --> $DIR/subword.rs:8:3 + --> $DIR/subword.rs:7:3 | LL | #[coverage(yes(milord))] | ^^^^^^^^^-----------^ @@ -16,7 +16,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/subword.rs:11:3 + --> $DIR/subword.rs:10:3 | LL | #[coverage(no(milord))] | ^^^^^^^^^----------^ @@ -33,7 +33,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/subword.rs:14:3 + --> $DIR/subword.rs:13:3 | LL | #[coverage(yes = "milord")] | ^^^^^^^^^--------------^ @@ -50,7 +50,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/subword.rs:17:3 + --> $DIR/subword.rs:16:3 | LL | #[coverage(no = "milord")] | ^^^^^^^^^-------------^ diff --git a/tests/ui/coverage-attr/word-only.rs b/tests/ui/coverage-attr/word-only.rs index e47279f74ca9b..2cdd5f9da7137 100644 --- a/tests/ui/coverage-attr/word-only.rs +++ b/tests/ui/coverage-attr/word-only.rs @@ -1,6 +1,5 @@ #![feature(coverage_attribute)] //@ edition: 2021 -//@ reference: attributes.coverage.syntax // Demonstrates the diagnostics produced when using the syntax `#[coverage]`, // which should not be allowed. diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index 4946cefc51fc2..fdf8506ae30a0 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:12:3 + --> $DIR/word-only.rs:11:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -12,7 +12,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:17:8 + --> $DIR/word-only.rs:16:8 | LL | #![coverage] | ^^^^^^^^ expected this to be a list @@ -25,7 +25,7 @@ LL | #![coverage(on)] | ++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:21:3 + --> $DIR/word-only.rs:20:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -38,7 +38,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on structs - --> $DIR/word-only.rs:21:3 + --> $DIR/word-only.rs:20:3 | LL | #[coverage] | ^^^^^^^^ @@ -46,7 +46,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:26:3 + --> $DIR/word-only.rs:25:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -59,7 +59,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:29:7 + --> $DIR/word-only.rs:28:7 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -72,7 +72,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on associated consts - --> $DIR/word-only.rs:29:7 + --> $DIR/word-only.rs:28:7 | LL | #[coverage] | ^^^^^^^^ @@ -80,7 +80,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:35:3 + --> $DIR/word-only.rs:34:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -93,7 +93,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on traits - --> $DIR/word-only.rs:35:3 + --> $DIR/word-only.rs:34:3 | LL | #[coverage] | ^^^^^^^^ @@ -101,7 +101,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:39:7 + --> $DIR/word-only.rs:38:7 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -114,7 +114,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on associated consts - --> $DIR/word-only.rs:39:7 + --> $DIR/word-only.rs:38:7 | LL | #[coverage] | ^^^^^^^^ @@ -122,7 +122,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:44:7 + --> $DIR/word-only.rs:43:7 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -135,7 +135,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on associated types - --> $DIR/word-only.rs:44:7 + --> $DIR/word-only.rs:43:7 | LL | #[coverage] | ^^^^^^^^ @@ -143,7 +143,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:50:3 + --> $DIR/word-only.rs:49:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -156,7 +156,7 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:53:7 + --> $DIR/word-only.rs:52:7 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -169,7 +169,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on associated consts - --> $DIR/word-only.rs:53:7 + --> $DIR/word-only.rs:52:7 | LL | #[coverage] | ^^^^^^^^ @@ -177,7 +177,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:58:7 + --> $DIR/word-only.rs:57:7 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -190,7 +190,7 @@ LL | #[coverage(on)] | ++++ error: the `coverage` attribute cannot be used on associated types - --> $DIR/word-only.rs:58:7 + --> $DIR/word-only.rs:57:7 | LL | #[coverage] | ^^^^^^^^ @@ -198,7 +198,7 @@ LL | #[coverage] = help: the `coverage` attribute can be applied to crates, functions, impl blocks, and modules error[E0539]: malformed `coverage` attribute input - --> $DIR/word-only.rs:64:3 + --> $DIR/word-only.rs:63:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list diff --git a/tests/ui/delegation/fn-header.next.stderr b/tests/ui/delegation/fn-header.next.stderr new file mode 100644 index 0000000000000..adca7d80a9b1d --- /dev/null +++ b/tests/ui/delegation/fn-header.next.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/fn-header.rs:23:17 + | +LL | reuse to_reuse::async_fn; + | ^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/delegation/fn-header.rs b/tests/ui/delegation/fn-header.rs index 16e3c10136ce0..8aae776e295ff 100644 --- a/tests/ui/delegation/fn-header.rs +++ b/tests/ui/delegation/fn-header.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#304 +//@[old] check-pass //@ edition:2018 //@ aux-crate:fn_header_aux=fn-header-aux.rs //@ ignore-backends: gcc diff --git a/tests/ui/delegation/impl-trait.next.stderr b/tests/ui/delegation/impl-trait.next.stderr new file mode 100644 index 0000000000000..84e1e8ec4453a --- /dev/null +++ b/tests/ui/delegation/impl-trait.next.stderr @@ -0,0 +1,19 @@ +error[E0282]: type annotations needed + --> $DIR/impl-trait.rs:13:17 + | +LL | reuse to_reuse::foo; + | ^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error[E0282]: type annotations needed + --> $DIR/impl-trait.rs:23:21 + | +LL | reuse to_reuse::foo; + | ^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/delegation/impl-trait.rs b/tests/ui/delegation/impl-trait.rs index cb86a048a18e9..3b0d1a0383549 100644 --- a/tests/ui/delegation/impl-trait.rs +++ b/tests/ui/delegation/impl-trait.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#304 +//@[old] check-pass #![feature(fn_delegation)] diff --git a/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr b/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr new file mode 100644 index 0000000000000..d00ac00232591 --- /dev/null +++ b/tests/ui/impl-trait/member-constraints/incomplete-constraint.next.stderr @@ -0,0 +1,26 @@ +error: concrete type differs from previous defining opaque type use + --> $DIR/incomplete-constraint.rs:15:5 + | +LL | new_defining_use(rpit1::<'a, 'b>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&'b ()`, got `&'static ()` + | +note: previous use here + --> $DIR/incomplete-constraint.rs:14:1 + | +LL | fn rpit1<'a, 'b: 'b>(x: &'b ()) -> impl Sized + use<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: concrete type differs from previous defining opaque type use + --> $DIR/incomplete-constraint.rs:21:5 + | +LL | new_defining_use(rpit2::<'a>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Inv<'a, 'static>`, got `Inv<'a, 'a>` + | +note: previous use here + --> $DIR/incomplete-constraint.rs:20:1 + | +LL | fn rpit2<'a>(_: ()) -> impl Sized + use<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs index 4c085cc1eedf8..e619a07e1f435 100644 --- a/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs +++ b/tests/ui/impl-trait/member-constraints/incomplete-constraint.rs @@ -1,5 +1,8 @@ -//@ check-pass -// FIXME(-Znext-solver): enable this test +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#227 +//@[old] check-pass // These functions currently do not normalize the opaque type but will do // so in the future. At this point we've got a new use of the opaque with fully diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr b/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr new file mode 100644 index 0000000000000..1459453b6d8f6 --- /dev/null +++ b/tests/ui/impl-trait/recursive-impl-trait-type-direct.next.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/recursive-impl-trait-type-direct.rs:13:14 + | +LL | fn test() -> impl Sized { + | ^^^^^^^^^^ cannot infer type + | + = note: cannot infer type of hidden type of opaque + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs b/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs index 1d82f89d7a1a3..6234c1c71b946 100644 --- a/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs +++ b/tests/ui/impl-trait/recursive-impl-trait-type-direct.rs @@ -1,8 +1,17 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[old] check-pass #![allow(unconditional_recursion)] +// The new solver does not allow unconstrained opaque types and unlike +// the old solver, does not fall back to `()` here. +// +// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/144. + fn test() -> impl Sized { + //[next]~^ ERROR: type annotations needed test() } diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr new file mode 100644 index 0000000000000..5e1bae55aee06 --- /dev/null +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.next.stderr @@ -0,0 +1,18 @@ +error: item does not constrain `Foo::{opaque#0}` + --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:11:4 + | +LL | fn foo() -> Foo { + | ^^^ + | + = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]` +note: this opaque type is supposed to be constrained + --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs:8:16 + | +LL | pub type Foo = impl PartialEq<(Foo, i32)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0275]: overflow evaluating the requirement `Foo == _` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs index 662c7ee2ecf0b..85f53be6b1bca 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle-2.rs @@ -1,6 +1,9 @@ #![feature(type_alias_impl_trait)] - -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#143 +//@[old] check-pass pub type Foo = impl PartialEq<(Foo, i32)>; diff --git a/tests/ui/implied-bounds/gluon_salsa.next.stderr b/tests/ui/implied-bounds/gluon_salsa.next.stderr new file mode 100644 index 0000000000000..dfeb8456ea067 --- /dev/null +++ b/tests/ui/implied-bounds/gluon_salsa.next.stderr @@ -0,0 +1,13 @@ +error[E0309]: the associated type `>::SendDb` may not live long enough + --> $DIR/gluon_salsa.rs:46:26 + | +LL | pub fn get_async<'a>(&'a mut self) { + | -- ^^^^^^^^^^^^ ...so that the type `QueryTable<'me, Q, >::SendDb>` will meet its required lifetime bounds + | | + | the associated type `>::SendDb` must be valid for the lifetime `'a` as defined here... + | + = help: consider adding an explicit lifetime bound `>::SendDb: 'a`... + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/implied-bounds/gluon_salsa.rs b/tests/ui/implied-bounds/gluon_salsa.rs index cc6352c4a32e9..338b6fe5fb5c8 100644 --- a/tests/ui/implied-bounds/gluon_salsa.rs +++ b/tests/ui/implied-bounds/gluon_salsa.rs @@ -1,6 +1,20 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[old] check-pass + // Related to Bevy regression #115559, found in // a crater run on #118553. +// +// Normalizing when computing implied bounds and normalizing the +// signature when checking that it is well-formed happen separately. +// +// In the old solver both use the projection_cache so the resulting type +// has the same unconstrained infer var. +// +// The new solver does not have any per-infcx caches, so the unconstrained +// variables differ, causing lexical region error to fail to prove the relevant +// type outlives. pub trait QueryBase { type Db; @@ -30,6 +44,7 @@ where // to work we may have to structurally resolve regions as the actually used vars may // otherwise be semantically equal but structurally different. pub fn get_async<'a>(&'a mut self) { + //[next]~^ ERROR: the associated type `>::SendDb` may not live long enough panic!(); } } diff --git a/tests/ui/layout/aggregate-lang/struct-align.rs b/tests/ui/layout/aggregate-lang/struct-align.rs index f3b88a6d85d3e..0864bdc6bfce0 100644 --- a/tests/ui/layout/aggregate-lang/struct-align.rs +++ b/tests/ui/layout/aggregate-lang/struct-align.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-size-align //@ edition: 2018 #[repr(align(64))] diff --git a/tests/ui/layout/aggregate-lang/struct-offsets.rs b/tests/ui/layout/aggregate-lang/struct-offsets.rs index ca199bdfeb104..894ac67db2d4c 100644 --- a/tests/ui/layout/aggregate-lang/struct-offsets.rs +++ b/tests/ui/layout/aggregate-lang/struct-offsets.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-offsets //@ edition: 2018 #[repr(align(64))] diff --git a/tests/ui/layout/aggregate-lang/struct-size.rs b/tests/ui/layout/aggregate-lang/struct-size.rs index f9fb605c32486..43430b85e1bf0 100644 --- a/tests/ui/layout/aggregate-lang/struct-size.rs +++ b/tests/ui/layout/aggregate-lang/struct-size.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-size-align //@ edition: 2018 #[allow(dead_code)] diff --git a/tests/ui/layout/aggregate-lang/union-align.rs b/tests/ui/layout/aggregate-lang/union-align.rs index 03825f1df2137..fd0b33e5f9018 100644 --- a/tests/ui/layout/aggregate-lang/union-align.rs +++ b/tests/ui/layout/aggregate-lang/union-align.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-size-align //@ edition: 2018 #[repr(align(64))] diff --git a/tests/ui/layout/aggregate-lang/union-offsets.rs b/tests/ui/layout/aggregate-lang/union-offsets.rs index 29ab0a9ce5490..b9b6b8e357dd8 100644 --- a/tests/ui/layout/aggregate-lang/union-offsets.rs +++ b/tests/ui/layout/aggregate-lang/union-offsets.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-offsets //@ edition: 2018 #[repr(align(64))] diff --git a/tests/ui/layout/aggregate-lang/union-size.rs b/tests/ui/layout/aggregate-lang/union-size.rs index 6d1b51b172db1..4189846571bf6 100644 --- a/tests/ui/layout/aggregate-lang/union-size.rs +++ b/tests/ui/layout/aggregate-lang/union-size.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ reference: layout.aggregate.struct-size-align //@ edition: 2018 #[allow(dead_code)] diff --git a/tests/ui/lifetimes/temporary-lifetime-extension-tuple-ctor.rs b/tests/ui/lifetimes/temporary-lifetime-extension-tuple-ctor.rs index 7de786dff3b77..2427c75f3e00e 100644 --- a/tests/ui/lifetimes/temporary-lifetime-extension-tuple-ctor.rs +++ b/tests/ui/lifetimes/temporary-lifetime-extension-tuple-ctor.rs @@ -1,4 +1,4 @@ -//@ reference: destructors.scope.lifetime-extension.exprs +//@ reference: destructors.scope.lifetime-extension.exprs.extending fn temp() -> String { String::from("Hello") diff --git a/tests/ui/macros/macro-shadowing.rs b/tests/ui/macros/macro-shadowing.rs index 87ed7c8d8fb09..b5d74f09df978 100644 --- a/tests/ui/macros/macro-shadowing.rs +++ b/tests/ui/macros/macro-shadowing.rs @@ -1,5 +1,4 @@ //@ aux-build:two_macros.rs -//@ reference: macro.decl.scope.textual.shadow //@ reference: names.resolution.expansion.macros.ambiguity.more-expanded-vs-outer #![allow(unused_macros)] diff --git a/tests/ui/macros/macro-shadowing.stderr b/tests/ui/macros/macro-shadowing.stderr index 96992aee649a4..2b4de7aacba3f 100644 --- a/tests/ui/macros/macro-shadowing.stderr +++ b/tests/ui/macros/macro-shadowing.stderr @@ -1,5 +1,5 @@ error: `macro_two` is already in scope - --> $DIR/macro-shadowing.rs:14:5 + --> $DIR/macro-shadowing.rs:13:5 | LL | macro_rules! m1 { () => { ... @@ -12,7 +12,7 @@ LL | m1!(); = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560) error[E0659]: `foo` is ambiguous - --> $DIR/macro-shadowing.rs:19:1 + --> $DIR/macro-shadowing.rs:18:1 | LL | macro_rules! m1 { () => { ... @@ -21,7 +21,7 @@ LL | foo!(); | = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution note: `foo` could refer to the macro defined here - --> $DIR/macro-shadowing.rs:12:5 + --> $DIR/macro-shadowing.rs:11:5 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | macro_rules! foo { () => {} } LL | m1!(); | ----- in this macro invocation note: `foo` could also refer to the macro defined here - --> $DIR/macro-shadowing.rs:7:1 + --> $DIR/macro-shadowing.rs:6:1 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.next.stderr similarity index 85% rename from tests/ui/pattern/usefulness/impl-trait.stderr rename to tests/ui/pattern/usefulness/impl-trait.next.stderr index 6efa783cf63cb..58ce14171693f 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.next.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/impl-trait.rs:16:13 + --> $DIR/impl-trait.rs:19:13 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/impl-trait.rs:4:9 + --> $DIR/impl-trait.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/impl-trait.rs:31:13 + --> $DIR/impl-trait.rs:34:13 | LL | _ => {} | ^------ @@ -26,7 +26,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:45:13 + --> $DIR/impl-trait.rs:48:13 | LL | Some(_) => {} | ^^^^^^^------ @@ -37,7 +37,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:49:13 + --> $DIR/impl-trait.rs:52:13 | LL | None => {} | ---- matches all the relevant values @@ -45,7 +45,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:59:13 + --> $DIR/impl-trait.rs:62:13 | LL | Some(_) => {} | ^^^^^^^------ @@ -56,7 +56,7 @@ LL | Some(_) => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:63:13 + --> $DIR/impl-trait.rs:66:13 | LL | None => {} | ---- matches all the relevant values @@ -64,7 +64,7 @@ LL | _ => {} | ^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:76:9 + --> $DIR/impl-trait.rs:79:9 | LL | _ => {} | ^------ @@ -75,7 +75,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:86:9 + --> $DIR/impl-trait.rs:89:9 | LL | _ => {} | - matches any value @@ -83,7 +83,7 @@ LL | Some((a, b)) => {} | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:95:13 + --> $DIR/impl-trait.rs:98:13 | LL | _ => {} | ^------ @@ -94,7 +94,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:107:9 + --> $DIR/impl-trait.rs:110:9 | LL | Some((a, b)) => {} | ------------ matches all the relevant values @@ -102,15 +102,7 @@ LL | Some((mut x, mut y)) => { | ^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/impl-trait.rs:127:13 - | -LL | _ => {} - | - matches any value -LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this - -error: unreachable pattern - --> $DIR/impl-trait.rs:142:13 + --> $DIR/impl-trait.rs:149:13 | LL | _ => {} | ^------ @@ -121,7 +113,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/impl-trait.rs:156:13 + --> $DIR/impl-trait.rs:163:13 | LL | _ => {} | ^------ @@ -132,7 +124,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty - --> $DIR/impl-trait.rs:22:11 + --> $DIR/impl-trait.rs:25:11 | LL | match return_never_rpit(x) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -146,7 +138,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `T` is non-empty - --> $DIR/impl-trait.rs:37:11 + --> $DIR/impl-trait.rs:40:11 | LL | match return_never_tait(x) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -159,6 +151,6 @@ LL + _ => todo!(), LL ~ } | -error: aborting due to 15 previous errors +error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/impl-trait.old.stderr b/tests/ui/pattern/usefulness/impl-trait.old.stderr new file mode 100644 index 0000000000000..58ce14171693f --- /dev/null +++ b/tests/ui/pattern/usefulness/impl-trait.old.stderr @@ -0,0 +1,156 @@ +error: unreachable pattern + --> $DIR/impl-trait.rs:19:13 + | +LL | _ => {} + | ^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types +note: the lint level is defined here + --> $DIR/impl-trait.rs:7:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/impl-trait.rs:34:13 + | +LL | _ => {} + | ^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:48:13 + | +LL | Some(_) => {} + | ^^^^^^^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:52:13 + | +LL | None => {} + | ---- matches all the relevant values +LL | _ => {} + | ^ no value can reach this + +error: unreachable pattern + --> $DIR/impl-trait.rs:62:13 + | +LL | Some(_) => {} + | ^^^^^^^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:66:13 + | +LL | None => {} + | ---- matches all the relevant values +LL | _ => {} + | ^ no value can reach this + +error: unreachable pattern + --> $DIR/impl-trait.rs:79:9 + | +LL | _ => {} + | ^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:89:9 + | +LL | _ => {} + | - matches any value +LL | Some((a, b)) => {} + | ^^^^^^^^^^^^ no value can reach this + +error: unreachable pattern + --> $DIR/impl-trait.rs:98:13 + | +LL | _ => {} + | ^------ + | | + | matches no values because `Void` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:110:9 + | +LL | Some((a, b)) => {} + | ------------ matches all the relevant values +LL | Some((mut x, mut y)) => { + | ^^^^^^^^^^^^^^^^^^^^ no value can reach this + +error: unreachable pattern + --> $DIR/impl-trait.rs:149:13 + | +LL | _ => {} + | ^------ + | | + | matches no values because `SecretelyVoid` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error: unreachable pattern + --> $DIR/impl-trait.rs:163:13 + | +LL | _ => {} + | ^------ + | | + | matches no values because `SecretelyDoubleVoid` is uninhabited + | help: remove the match arm + | + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty + --> $DIR/impl-trait.rs:25:11 + | +LL | match return_never_rpit(x) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the matched value is of type `impl Copy` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown + | +LL ~ match return_never_rpit(x) { +LL + _ => todo!(), +LL ~ } + | + +error[E0004]: non-exhaustive patterns: type `T` is non-empty + --> $DIR/impl-trait.rs:40:11 + | +LL | match return_never_tait(x) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the matched value is of type `T` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown + | +LL ~ match return_never_tait(x) { +LL + _ => todo!(), +LL ~ } + | + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/impl-trait.rs b/tests/ui/pattern/usefulness/impl-trait.rs index f04633ebef2f6..9cb6b704597a9 100644 --- a/tests/ui/pattern/usefulness/impl-trait.rs +++ b/tests/ui/pattern/usefulness/impl-trait.rs @@ -1,3 +1,6 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver #![feature(type_alias_impl_trait)] #![feature(non_exhaustive_omitted_patterns_lint)] #![feature(exhaustive_patterns)] @@ -112,6 +115,9 @@ fn infer_in_match(x: Option) { } } +// FIXME(trait-system-refactor-initiative#293): This currently causes an ICE. +// It should not. +/* type W = impl Copy; #[derive(Copy, Clone)] struct Rec<'a> { @@ -124,12 +130,13 @@ fn recursive_opaque() -> W { match recursive_opaque() { // Check for the ol' ICE when the type is recursively opaque. _ => {} - Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} //~ ERROR unreachable + Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} } } let w: Option<&'static W> = None; Rec { n: 0, w } } +*/ type X = impl Copy; struct SecretelyVoid(X); diff --git a/tests/ui/proc-macro/modules-in-input.rs b/tests/ui/proc-macro/modules-in-input.rs index 50b4dc9e40f44..5f14d96b3b51e 100644 --- a/tests/ui/proc-macro/modules-in-input.rs +++ b/tests/ui/proc-macro/modules-in-input.rs @@ -1,6 +1,6 @@ //@ check-pass //@ proc-macro: expect-modules.rs -//@ reference: macro.invocation.attr.mod +//@ reference: macro.proc.attribute.outline-mod // Verifies how module items are represented in proc macro input. diff --git a/tests/ui/transmutability/alignment/align-pass.next.stderr b/tests/ui/transmutability/alignment/align-pass.next.stderr new file mode 100644 index 0000000000000..2095e97cc3915 --- /dev/null +++ b/tests/ui/transmutability/alignment/align-pass.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&[u16; 0]` cannot be safely transmuted into `&[u8; 0]` + --> $DIR/align-pass.rs:25:56 + | +LL | assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>(); + | ^^^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static [u16; 0], Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static [u8; 0]` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/align-pass.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static [u16; 0], &'static [u8; 0]>(); +LL + assert::is_maybe_transmutable::<&'static [u16; 0], [u8; 0]>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/alignment/align-pass.rs b/tests/ui/transmutability/alignment/align-pass.rs index feecf5edaa1ac..fa40c3a3ade43 100644 --- a/tests/ui/transmutability/alignment/align-pass.rs +++ b/tests/ui/transmutability/alignment/align-pass.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr b/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr new file mode 100644 index 0000000000000..4c469fd2222e3 --- /dev/null +++ b/tests/ui/transmutability/references/accept_assume_lifetime_extension.next.stderr @@ -0,0 +1,138 @@ +error[E0277]: `&u8` cannot be safely transmuted into `&u8` + --> $DIR/accept_assume_lifetime_extension.rs:24:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&u8` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `&&u8` cannot be safely transmuted into `&&u8` + --> $DIR/accept_assume_lifetime_extension.rs:32:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<&&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&&u8` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `(&u8,)` cannot be safely transmuted into `(&u8,)` + --> $DIR/accept_assume_lifetime_extension.rs:40:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8,), std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `(&u8,)` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `(&u8, u8)` cannot be safely transmuted into `(&u8, u8)` + --> $DIR/accept_assume_lifetime_extension.rs:44:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `std::mem::TransmuteFrom<(&u8, u8), std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `(&u8, u8)` +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `r#struct::Struct<'_>` cannot be safely transmuted into `r#struct::Struct<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:54:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `r#struct::Struct<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:51:5 + | +LL | struct Struct<'a>(&'a u8); + | ^^^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `Single<'_>` cannot be safely transmuted into `Single<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:66:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `Single<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:61:5 + | +LL | enum Single<'a> { + | ^^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `Multi<'_>` cannot be safely transmuted into `Multi<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:76:18 + | +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ unsatisfied trait bound + | +help: the nightly-only, unstable trait `std::mem::TransmuteFrom, std::mem::Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `Multi<'_>` + --> $DIR/accept_assume_lifetime_extension.rs:69:5 + | +LL | enum Multi<'a> { + | ^^^^^^^^^^^^^^ +note: required by a bound in `transmute` + --> $DIR/accept_assume_lifetime_extension.rs:15:10 + | +LL | unsafe fn transmute(src: Src) -> Dst +LL | where +LL | Dst: TransmuteFrom, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error[E0277]: `&u8` cannot be safely transmuted into `&u8` + --> $DIR/accept_assume_lifetime_extension.rs:84:18 + | +LL | unsafe { extend_hrtb(src) } + | ^^^^^^^^^^^^---^ + | | | + | | `&u8` doesn't satisfy the trait bound + | unsatisfied trait bound + | + = help: the nightly-only, unstable trait `for<'b> std::mem::TransmuteFrom<&u8, std::mem::Assume { alignment: false, lifetimes: true, safety: false, validity: false }>` is not implemented for `&'b u8` +note: required by a bound in `extend_hrtb` + --> $DIR/accept_assume_lifetime_extension.rs:89:25 + | +LL | unsafe fn extend_hrtb<'a>(src: &'a u8) -> &'static u8 +LL | where +LL | for<'b> &'b u8: TransmuteFrom<&'a u8, { Assume::LIFETIMES }>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extend_hrtb` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs index edad02fc96d22..86feb3c40eb7d 100644 --- a/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs +++ b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass //! Accept lifetime extensions with `Assume::LIFETIMES`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr new file mode 100644 index 0000000000000..32156298a1f6f --- /dev/null +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.next.stderr @@ -0,0 +1,24 @@ +error[E0277]: `&A` cannot be safely transmuted into `&B` + --> $DIR/recursive-wrapper-types-bit-compatible.rs:27:49 + | +LL | assert::is_maybe_transmutable::<&'static A, &'static B>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static A, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static B` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types-bit-compatible.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs index 8e2da3518a961..f1bb503549968 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr b/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr new file mode 100644 index 0000000000000..8ea346d7c08b5 --- /dev/null +++ b/tests/ui/transmutability/references/recursive-wrapper-types.next.stderr @@ -0,0 +1,45 @@ +error[E0277]: `&A` cannot be safely transmuted into `&B` + --> $DIR/recursive-wrapper-types.rs:27:49 + | +LL | assert::is_maybe_transmutable::<&'static A, &'static B>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static A, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static B` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `&B` cannot be safely transmuted into `&A` + --> $DIR/recursive-wrapper-types.rs:28:49 + | +LL | assert::is_maybe_transmutable::<&'static B, &'static A>(); + | ^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static B, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static A` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/recursive-wrapper-types.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.rs b/tests/ui/transmutability/references/recursive-wrapper-types.rs index 53dedeb6388f5..7ff458aa2512b 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/u8-to-unit.next.stderr b/tests/ui/transmutability/references/u8-to-unit.next.stderr new file mode 100644 index 0000000000000..0897833202826 --- /dev/null +++ b/tests/ui/transmutability/references/u8-to-unit.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&u8` cannot be safely transmuted into `&Unit` + --> $DIR/u8-to-unit.rs:26:50 + | +LL | assert::is_maybe_transmutable::<&'static u8, &'static Unit>(); + | ^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static u8, Assume { alignment: false, lifetimes: true, safety: true, validity: false }>` is not implemented for `&'static Unit` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/u8-to-unit.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static u8, &'static Unit>(); +LL + assert::is_maybe_transmutable::<&'static u8, Unit>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/u8-to-unit.rs b/tests/ui/transmutability/references/u8-to-unit.rs index 98deb6457cb07..df124cafda3d6 100644 --- a/tests/ui/transmutability/references/u8-to-unit.rs +++ b/tests/ui/transmutability/references/u8-to-unit.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/references/unit-to-itself.next.stderr b/tests/ui/transmutability/references/unit-to-itself.next.stderr new file mode 100644 index 0000000000000..4a15b3b3d5c30 --- /dev/null +++ b/tests/ui/transmutability/references/unit-to-itself.next.stderr @@ -0,0 +1,29 @@ +error[E0277]: `&Unit` cannot be safely transmuted into `&Unit` + --> $DIR/unit-to-itself.rs:26:52 + | +LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); + | ^^^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&'static Unit, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>` is not implemented for `&'static Unit` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/unit-to-itself.rs:13:14 + | +LL | pub fn is_maybe_transmutable() +LL | where +LL | Dst: TransmuteFrom + | |__________^ required by this bound in `is_maybe_transmutable` +help: consider removing the leading `&`-reference + | +LL - assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); +LL + assert::is_maybe_transmutable::<&'static Unit, Unit>(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/references/unit-to-itself.rs b/tests/ui/transmutability/references/unit-to-itself.rs index 789455c03ea17..87d001222f96e 100644 --- a/tests/ui/transmutability/references/unit-to-itself.rs +++ b/tests/ui/transmutability/references/unit-to-itself.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] mod assert { diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr new file mode 100644 index 0000000000000..2cbaa71262cea --- /dev/null +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: `&mut Src` cannot be safely transmuted into `&mut u8` + --> $DIR/should_accept_if_ref_src_has_safety_invariant.rs:29:41 + | +LL | assert::is_transmutable::<&mut Src, &mut Dst>(); + | ^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `TransmuteFrom<&mut Src, Assume { alignment: false, lifetimes: false, safety: true, validity: false }>` is not implemented for `&mut u8` +note: required by a bound in `is_transmutable` + --> $DIR/should_accept_if_ref_src_has_safety_invariant.rs:19:14 + | +LL | pub fn is_transmutable() +LL | where +LL | Dst: TransmuteFrom + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs index eca7a06559d21..32d70c3298eda 100644 --- a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs @@ -1,4 +1,8 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass //! When safety is assumed, a transmutation over exclusive references should be //! accepted if the source type potentially carries safety invariants. diff --git a/tests/ui/transmutability/transmute-higher-ranked.next.stderr b/tests/ui/transmutability/transmute-higher-ranked.next.stderr new file mode 100644 index 0000000000000..9d86559f62bcc --- /dev/null +++ b/tests/ui/transmutability/transmute-higher-ranked.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: `&&u32` cannot be safely transmuted into `&&i32` + --> $DIR/transmute-higher-ranked.rs:21:5 + | +LL | transmute(); + | ^^^^^^^^^^^ unsatisfied trait bound + | + = help: the nightly-only, unstable trait `for<'a> TransmuteFrom<&'a &'a u32, Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `&'a &'a i32` +note: required by a bound in `transmute` + --> $DIR/transmute-higher-ranked.rs:16:26 + | +LL | pub fn transmute() +LL | where +LL | for<'a> &'a &'a i32: TransmuteFrom<&'a &'a u32>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `transmute` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/transmute-higher-ranked.rs b/tests/ui/transmutability/transmute-higher-ranked.rs index f0fe02a7908ee..fc0753942906a 100644 --- a/tests/ui/transmutability/transmute-higher-ranked.rs +++ b/tests/ui/transmutability/transmute-higher-ranked.rs @@ -1,7 +1,11 @@ // Ensure we don't ICE when transmuting higher-ranked types via a // higher-ranked transmute goal. -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#152 +//@[old] check-pass #![feature(transmutability)] diff --git a/tests/ui/type-alias-impl-trait/implied_bounds2.rs b/tests/ui/type-alias-impl-trait/implied_bounds2.rs index 0d829113ce708..99d125b23c486 100644 --- a/tests/ui/type-alias-impl-trait/implied_bounds2.rs +++ b/tests/ui/type-alias-impl-trait/implied_bounds2.rs @@ -1,4 +1,11 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] failure-status: 101 +//@[next] dont-check-compiler-stderr +//@[next] known-bug: trait-system-refactor-initiative#293 +//@[next] needs-rustc-debug-assertions +//@[old] check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.old.stderr similarity index 88% rename from tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr rename to tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.old.stderr index bbc0b91cd5031..7550f9ebf1151 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.old.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:15:5 + --> $DIR/implied_lifetime_wf_check3.rs:22:5 | LL | fn test_lifetime_param_test<'a>() | -- lifetime `'a` defined here @@ -8,7 +8,7 @@ LL | test_lifetime_param::assert_static::<'a>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:31:5 + --> $DIR/implied_lifetime_wf_check3.rs:38:5 | LL | fn test_higher_kinded_lifetime_param_test<'a>() | -- lifetime `'a` defined here @@ -17,7 +17,7 @@ LL | test_higher_kinded_lifetime_param::assert_static::<'a>() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:38:9 + --> $DIR/implied_lifetime_wf_check3.rs:45:9 | LL | fn test<'a>() { | -- lifetime `'a` defined here @@ -25,7 +25,7 @@ LL | assert_static::<'a>() | ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check3.rs:55:5 + --> $DIR/implied_lifetime_wf_check3.rs:62:5 | LL | test_type_param::assert_static::() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs index 889438d1b733e..80ead60158b3b 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check3.rs @@ -1,3 +1,10 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] failure-status: 101 +//@[next] dont-check-compiler-stderr +//@[next] known-bug: trait-system-refactor-initiative#293 +//@[next] needs-rustc-debug-assertions #![feature(type_alias_impl_trait)] mod test_lifetime_param { @@ -13,7 +20,7 @@ where test_lifetime_param::Ty<'a>: 'static, { test_lifetime_param::assert_static::<'a>() - //~^ ERROR: lifetime may not live long enough + //[old]~^ ERROR: lifetime may not live long enough } mod test_higher_kinded_lifetime_param { @@ -29,14 +36,14 @@ where for<'b> test_higher_kinded_lifetime_param::Ty<'b>: 'a, { test_higher_kinded_lifetime_param::assert_static::<'a>() - //~^ ERROR: lifetime may not live long enough + //[old]~^ ERROR: lifetime may not live long enough } mod test_higher_kinded_lifetime_param2 { fn assert_static<'a: 'static>() {} fn test<'a>() { assert_static::<'a>() - //~^ ERROR: lifetime may not live long enough + //[old]~^ ERROR: lifetime may not live long enough } } @@ -53,7 +60,7 @@ where test_type_param::Ty: 'static, { test_type_param::assert_static::() - //~^ ERROR: parameter type `A` may not live long enough + //[old]~^ ERROR: parameter type `A` may not live long enough } mod test_implied_from_fn_sig { diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.old.stderr similarity index 86% rename from tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr rename to tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.old.stderr index 710e4a5ce9e82..56b4f601e3b0e 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.old.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check4_static.rs:6:5 + --> $DIR/implied_lifetime_wf_check4_static.rs:13:5 | LL | s | ^ @@ -8,7 +8,7 @@ LL | s | ...so that the type `A` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/implied_lifetime_wf_check4_static.rs:3:31 + --> $DIR/implied_lifetime_wf_check4_static.rs:10:31 | LL | pub type Ty = impl Sized + 'static; | ^^^^^^^ @@ -18,7 +18,7 @@ LL | pub type Ty = impl Sized + 'static; | +++++++++ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check4_static.rs:15:5 + --> $DIR/implied_lifetime_wf_check4_static.rs:22:5 | LL | assert_static::() | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs index 5484b91e6f1f4..0759414f3148f 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs @@ -1,10 +1,17 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] failure-status: 101 +//@[next] dont-check-compiler-stderr +//@[next] known-bug: trait-system-refactor-initiative#293 +//@[next] needs-rustc-debug-assertions #![feature(type_alias_impl_trait)] pub type Ty = impl Sized + 'static; #[define_opaque(Ty)] fn defining(s: A) -> Ty { s - //~^ ERROR: the parameter type `A` may not live long enough + //[old]~^ ERROR: the parameter type `A` may not live long enough } pub fn assert_static() {} @@ -13,7 +20,7 @@ where Ty: 'static, { assert_static::() - //~^ ERROR: the parameter type `A` may not live long enough + //[old]~^ ERROR: the parameter type `A` may not live long enough } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr b/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr new file mode 100644 index 0000000000000..78724a5ccec1c --- /dev/null +++ b/tests/ui/type-alias-impl-trait/struct-assignment-validity.next.stderr @@ -0,0 +1,23 @@ +error[E0391]: cycle detected when computing type of `::Assoc::{opaque#0}` + --> $DIR/struct-assignment-validity.rs:21:18 + | +LL | type Assoc = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires computing type of opaque `::Assoc::{opaque#0}`... +note: ...which requires borrow-checking `::foo`... + --> $DIR/struct-assignment-validity.rs:22:5 + | +LL | / fn foo() -> Foo +LL | | where +LL | | Self::Assoc:, + | |_____________________^ + = note: ...which requires promoting constants in MIR for `::foo`... + = note: ...which requires normalizing `::Assoc`... + = note: ...which again requires computing type of `::Assoc::{opaque#0}`, completing the cycle + = note: cycle used when checking that `::Assoc::{opaque#0}` is well-formed + = note: for more information, see and + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs b/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs index c52dbd3253905..608c804be9c94 100644 --- a/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs +++ b/tests/ui/type-alias-impl-trait/struct-assignment-validity.rs @@ -1,5 +1,9 @@ +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#303 //@ compile-flags: -Zvalidate-mir -//@ check-pass +//@[old] check-pass // Check that we don't cause cycle errors when validating pre-`RevealOpaques` MIR // that assigns opaques through normalized projections. diff --git a/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs b/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs index 063c4deaf06ee..44ccc5c22e09d 100644 --- a/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs +++ b/tests/ui/type-alias-impl-trait/unbounded_opaque_type.rs @@ -1,4 +1,11 @@ -//@ check-pass +//@ revisions: old next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] failure-status: 101 +//@[next] dont-check-compiler-stderr +//@[next] known-bug: trait-system-refactor-initiative#293 +//@[next] needs-rustc-debug-assertions +//@[old] check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/union/union-inherent-method.rs b/tests/ui/union/union-inherent-method.rs index 86a62ff18cd3d..b3b0fec8c1f37 100644 --- a/tests/ui/union/union-inherent-method.rs +++ b/tests/ui/union/union-inherent-method.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ reference: items.impl.inherent.associated-items.allowed-items +//@ reference: items.impl.inherent.allowed-items union U { a: u8,