diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index a2112293df204..930a74d8022a7 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -2509,7 +2509,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue { let span = cx.tcx.def_span(adt_def.did()); let mut potential_variants = adt_def.variants().iter().filter_map(|variant| { let definitely_inhabited = match variant - .inhabited_predicate(cx.tcx, *adt_def) + .inhabited_predicate(cx.tcx) .instantiate(cx.tcx, args) .apply_any_module(cx.tcx, cx.typing_env()) { diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 33719340f5978..e127693a2e231 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -2210,7 +2210,7 @@ rustc_queries! { feedable } - query inhabited_predicate_adt(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> { + query inhabited_predicate_for_def(key: DefId) -> ty::inhabitedness::InhabitedPredicate<'tcx> { desc { "computing the uninhabited predicate of `{:?}`", key } } diff --git a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs index 9261986137d9d..b5f8d8b4275c1 100644 --- a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs +++ b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs @@ -46,12 +46,15 @@ use std::assert_matches; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def::DefKind; use rustc_span::def_id::LocalModId; use rustc_type_ir::TyKind::*; use tracing::instrument; use crate::query::Providers; -use crate::ty::{self, DefId, Ty, TyCtxt, TypeVisitableExt, TypingEnv, VariantDef, Visibility}; +use crate::ty::{ + self, AdtDef, DefId, Ty, TyCtxt, TypeVisitableExt, TypingEnv, VariantDef, Visibility, +}; pub mod inhabited_predicate; @@ -59,7 +62,7 @@ pub use inhabited_predicate::InhabitedPredicate; pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { - inhabited_predicate_adt, + inhabited_predicate_for_def, inhabited_predicate_type, is_opsem_inhabited_raw, ..*providers @@ -68,48 +71,64 @@ pub(crate) fn provide(providers: &mut Providers) { /// Returns an `InhabitedPredicate` that is generic over type parameters and /// requires calling [`InhabitedPredicate::instantiate`] -fn inhabited_predicate_adt(tcx: TyCtxt<'_>, def_id: DefId) -> InhabitedPredicate<'_> { - if let Some(def_id) = def_id.as_local() { - tcx.ensure_ok().check_representability(def_id); +fn inhabited_predicate_for_def(tcx: TyCtxt<'_>, def_id: DefId) -> InhabitedPredicate<'_> { + match tcx.def_kind(def_id) { + DefKind::Enum => { + if let Some(def_id) = def_id.as_local() { + tcx.ensure_ok().check_representability(def_id); + } + let adt = tcx.adt_def(def_id); + InhabitedPredicate::any(tcx, adt.variants().iter().map(|v| v.inhabited_predicate(tcx))) + } + DefKind::Struct => { + if let Some(def_id) = def_id.as_local() { + tcx.ensure_ok().check_representability(def_id); + } + let adt = tcx.adt_def(def_id); + variant_inhabited_predicate(tcx, adt, adt.non_enum_variant()) + } + DefKind::Variant => { + let adt = tcx.adt_def(tcx.parent(def_id)); + let variant = adt.variant_with_id(def_id); + variant_inhabited_predicate(tcx, adt, variant) + } + def_kind => bug!("unexpected DefKind: {def_kind:?}"), } - - let adt = tcx.adt_def(def_id); - InhabitedPredicate::any( - tcx, - adt.variants().iter().map(|variant| variant.inhabited_predicate(tcx, adt)), - ) } -impl<'tcx> VariantDef { - /// Calculates the forest of `DefId`s from which this variant is visibly uninhabited. - pub fn inhabited_predicate( - &self, - tcx: TyCtxt<'tcx>, - adt: ty::AdtDef<'_>, - ) -> InhabitedPredicate<'tcx> { - debug_assert!(!adt.is_union()); - InhabitedPredicate::all( - tcx, - self.fields.iter().map(|field| { - let pred = tcx - .type_of(field.did) - .instantiate_identity() - .skip_norm_wip() - .inhabited_predicate(tcx); - if adt.is_enum() { - return pred; - } - match field.vis { - Visibility::Public => pred, - Visibility::Restricted(from) => { - InhabitedPredicate::NotInModule(from).or(tcx, pred) - } - } - }), - ) +impl VariantDef { + pub fn inhabited_predicate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> InhabitedPredicate<'tcx> { + if self.fields.is_empty() { + return InhabitedPredicate::True; + } + tcx.inhabited_predicate_for_def(self.def_id) } } +fn variant_inhabited_predicate<'tcx>( + tcx: TyCtxt<'tcx>, + adt: AdtDef<'tcx>, + variant: &VariantDef, +) -> InhabitedPredicate<'tcx> { + InhabitedPredicate::all( + tcx, + variant.fields.iter().map(|field| { + let pred = tcx + .type_of(field.did) + .instantiate_identity() + .skip_norm_wip() + .inhabited_predicate(tcx); + if adt.is_enum() { + return pred; + } + match field.vis { + Visibility::Public => pred, + Visibility::Restricted(from) => InhabitedPredicate::NotInModule(from).or(tcx, pred), + } + }), + ) +} + impl<'tcx> Ty<'tcx> { #[instrument(level = "debug", skip(tcx), ret)] pub fn inhabited_predicate(self, tcx: TyCtxt<'tcx>) -> InhabitedPredicate<'tcx> { @@ -228,7 +247,7 @@ impl<'tcx> Ty<'tcx> { /// N.B. this query should only be called through `Ty::inhabited_predicate` fn inhabited_predicate_type<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> InhabitedPredicate<'tcx> { match *ty.kind() { - Adt(adt, args) => tcx.inhabited_predicate_adt(adt.did()).instantiate(tcx, args), + Adt(adt, args) => tcx.inhabited_predicate_for_def(adt.did()).instantiate(tcx, args), Tuple(tys) => { InhabitedPredicate::all(tcx, tys.iter().map(|ty| ty.inhabited_predicate(tcx))) diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 86a13736a4cff..d11eef067c51a 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -733,7 +733,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { { let variant_inhabited = adt .variant(*variant_index) - .inhabited_predicate(self.tcx, *adt) + .inhabited_predicate(self.tcx) .instantiate(self.tcx, args); variant_inhabited.apply(self.tcx, cx.typing_env, cx.module) && !variant_inhabited.apply_ignore_module(self.tcx, cx.typing_env) diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index ae5eefa1cded8..d030756cfa954 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -380,7 +380,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { let variant_def_id = def.variant(idx).def_id; // Visibly uninhabited variants. let is_inhabited = v - .inhabited_predicate(cx.tcx, *def) + .inhabited_predicate(cx.tcx) .instantiate(cx.tcx, args) .apply_revealing_opaque(cx.tcx, cx.typing_env, cx.module, &|key| { cx.reveal_opaque_key(key) diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 4fdc9e28363b6..a0a539b6d101d 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -79,6 +79,29 @@ class LLDBFeature(Flag): Float128 = auto() """Added in LLDB 22.1. Adds builtin support for Float 128's, including an `eBasicTypeFloat128`, a formatter, and handlers in `TypeSystemClang`""" + GetParent = auto() + """Added in LLDB 23.1. Adds `SBValue.GetParent`, which retrieves the `SBValue` that the caller + originates from. Useful when a child object must be modified/styled based on information only + available to is parent e.g. unsized array types that must determine their length via the parent + wide pointer value.""" + ProviderDecorator = auto() + """Added in LLDB 23.1. Adds `@lldb.summary` and `@lldb.synthetic`, which can automatically + register decorated providers. At time of writing, we do not use this feature for the following + reasons: + + 1. backwards compatibility + 2. to maintain more strict control over the order in which providers are loaded""" + PerObjectSynthetics = auto() + """Currently only available in prerelease. Adds: + + * `SBValue.SetTypeSynthetic` - allows synthetic providers to override their children's synthetic + provider without overriding the synthetic provider of all objects with that share a type name. + * `SBValue.GetTypeSyntheticImplementation` - retrieves the *instance* of the synthetic provider + associated with that variable. This allows us to easily inspect the state of a parent/child + and use it to make decisions about the current object without needing to redo work. It is worth + noting that this can be achieved backwards-compatibly (though less elegantly) by using a global + `weakref.WeakValueDictionary`, with the keys being `SBValue.GetID()` (which are unique per + session) and the values being the provider instance.""" def detect_features() -> LLDBFeature: @@ -93,6 +116,12 @@ def detect_features() -> LLDBFeature: features |= LLDBFeature.TypeRecognizers if getattr(lldb, "eBasicTypeFloat128", None) is not None: features |= LLDBFeature.Float128 + if getattr(lldb.SBValue, "GetParent", None) is not None: + features |= LLDBFeature.GetParent + if getattr(lldb, "summary", None) is not None: + features |= LLDBFeature.ProviderDecorator + if getattr(lldb.SBValue, "SetTypeSynthetic", None) is not None: + features |= LLDBFeature.PerObjectSynthetics return features diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index c15bc3af026e5..9b878307afc96 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -724,7 +724,6 @@ ui/consts/issue-28113.rs ui/consts/issue-28822.rs ui/consts/issue-29798.rs ui/consts/issue-29914-2.rs -ui/consts/issue-29914-3.rs ui/consts/issue-29914.rs ui/consts/issue-29927-1.rs ui/consts/issue-29927.rs @@ -1915,7 +1914,6 @@ ui/parser/issues/issue-17718-parse-const.rs ui/parser/issues/issue-17904-2.rs ui/parser/issues/issue-17904.rs ui/parser/issues/issue-1802-1.rs -ui/parser/issues/issue-1802-2.rs ui/parser/issues/issue-19096.rs ui/parser/issues/issue-19398.rs ui/parser/issues/issue-20616-1.rs @@ -2764,7 +2762,6 @@ ui/type-alias-impl-trait/issue-57961.rs ui/type-alias-impl-trait/issue-58662-coroutine-with-lifetime.rs ui/type-alias-impl-trait/issue-58662-simplified.rs ui/type-alias-impl-trait/issue-58887.rs -ui/type-alias-impl-trait/issue-58951-2.rs ui/type-alias-impl-trait/issue-58951.rs ui/type-alias-impl-trait/issue-60371.rs ui/type-alias-impl-trait/issue-60407.rs @@ -2790,7 +2787,6 @@ ui/type-alias-impl-trait/issue-70121.rs ui/type-alias-impl-trait/issue-72793.rs ui/type-alias-impl-trait/issue-74244.rs ui/type-alias-impl-trait/issue-74280.rs -ui/type-alias-impl-trait/issue-74761-2.rs ui/type-alias-impl-trait/issue-74761.rs ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs ui/type-alias-impl-trait/issue-77179.rs @@ -2955,7 +2951,6 @@ ui/unsafe/issue-45107-unnecessary-unsafe-in-closure.rs ui/unsafe/issue-47412.rs ui/unsafe/issue-85435-unsafe-op-in-let-under-unsafe-under-closure.rs ui/unsafe/issue-87414-query-cycle.rs -ui/unsized-locals/issue-30276-feature-flagged.rs ui/unsized-locals/issue-30276.rs ui/unsized-locals/issue-50940-with-feature.rs ui/unsized-locals/issue-50940.rs diff --git a/tests/assembly-llvm/x86-vendor-intrinsics.rs b/tests/assembly-llvm/x86-vendor-intrinsics.rs new file mode 100644 index 0000000000000..bcc38782c5aa9 --- /dev/null +++ b/tests/assembly-llvm/x86-vendor-intrinsics.rs @@ -0,0 +1,20 @@ +//@ only-x86_64 +//@ assembly-output: emit-asm +//@ compile-flags: -Ctarget-feature=-sse3 -C opt-level=3 + +// Regression test for various cases where we used to compile x86 vendor intrinsics in a suboptimal +// way. + +#![crate_type = "lib"] + +use std::arch::x86_64::*; + +// CHECK-LABEL: test_packus_epi16: +#[unsafe(no_mangle)] +#[target_feature(enable = "sse2")] +extern "C" fn test_packus_epi16(a: __m128i, b: __m128i) -> __m128i { + // CHECK: .cfi_startproc + // CHECK-NEXT: packuswb + // CHECK-NEXT: ret + _mm_packus_epi16(a, b) +} diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index f61e76cbe5997..1f07c0e29dea1 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -82,6 +82,7 @@ impl TraitWithAssocType for i32 { fn get_value(&self) -> i64 { *self as i64 } } +#[repr(C)] struct Struct { b: T, b1: T::Type, diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 03897177959eb..9d2460639805f 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -25,6 +25,7 @@ #![allow(unused_variables)] +#[repr(C)] struct StructWithSomePadding { x: i16, y: i32, @@ -32,6 +33,7 @@ struct StructWithSomePadding { w: i64 } +#[repr(C)] struct StructWithDestructor { x: i16, y: i32, diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index 6839c07cd55a5..6ae3c3bcdd572 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -57,18 +57,21 @@ use self::AnEnum::{OneHundred, OneThousand, OneMillion}; use self::AnotherEnum::{MountainView, Toronto, Vienna}; +#[repr(u32)] enum AnEnum { OneHundred = 100, OneThousand = 1000, OneMillion = 1000000 } +#[repr(u8)] enum AnotherEnum { MountainView, Toronto, Vienna } +#[repr(C)] struct PaddedStruct { a: i16, b: AnEnum, @@ -77,7 +80,7 @@ struct PaddedStruct { e: i16 } -#[repr(packed)] +#[repr(C, packed)] struct PackedStruct { a: i16, b: AnEnum, @@ -86,6 +89,7 @@ struct PackedStruct { e: i16 } +#[repr(C)] struct NonPaddedStruct { a: AnEnum, b: AnotherEnum, diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index b8cde881b9ce6..13395f5e407a4 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -73,6 +73,8 @@ // === LLDB TESTS ================================================================================== //@ lldb-command:type format add --format hex char +// MSVC uses signed char +//@ lldb-command:type format add --format hex 'signed char' //@ lldb-command:type format add --format hex 'unsigned char' //@ lldb-command:run @@ -144,6 +146,7 @@ #![allow(unused_variables)] #![feature(deref_patterns)] +#[repr(C)] struct Struct { x: i16, y: f32, diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 44e7d359d81ec..646091d5f3c1a 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -41,17 +41,20 @@ #![allow(unused_variables)] +#[repr(C)] struct NoPadding1 { x: [u32; 3], y: i32, z: [f32; 2] } +#[repr(C)] struct NoPadding2 { x: [u32; 3], y: [[u32; 2]; 2] } +#[repr(C)] struct StructInternalPadding { x: [i16; 2], y: [i64; 2] @@ -61,6 +64,7 @@ struct SingleVec { x: [i16; 5] } +#[repr(C)] struct StructPaddedAtEnd { x: [i64; 2], y: [i16; 2] diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index 59fc3d3ca15c2..9cb4c4ada03da 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -63,7 +63,7 @@ #![allow(unused_variables)] -#[repr(packed)] +#[repr(C, packed)] struct Packed { x: i16, y: i32, @@ -74,7 +74,7 @@ impl Drop for Packed { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPacked { a: i32, b: Packed, @@ -82,6 +82,7 @@ struct PackedInPacked { d: Packed } +#[repr(C)] struct PackedInUnpacked { a: i32, b: Packed, @@ -89,6 +90,7 @@ struct PackedInUnpacked { d: Packed } +#[repr(C)] struct Unpacked { x: i64, y: i32, @@ -99,7 +101,7 @@ impl Drop for Unpacked { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPacked { a: i16, b: Unpacked, @@ -107,7 +109,7 @@ struct UnpackedInPacked { d: i64 } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPackedWithDrop { a: i32, b: Packed, @@ -119,6 +121,7 @@ impl Drop for PackedInPackedWithDrop { fn drop(&mut self) {} } +#[repr(C)] struct PackedInUnpackedWithDrop { a: i32, b: Packed, @@ -130,7 +133,7 @@ impl Drop for PackedInUnpackedWithDrop { fn drop(&mut self) {} } -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPackedWithDrop { a: i16, b: Unpacked, @@ -142,6 +145,7 @@ impl Drop for UnpackedInPackedWithDrop { fn drop(&mut self) {} } +#[repr(C)] struct DeeplyNested { a: PackedInPacked, b: UnpackedInPackedWithDrop, diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index e601ac1ffc6a2..f2e08fac063f6 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -49,14 +49,14 @@ #![allow(unused_variables)] -#[repr(packed)] +#[repr(C, packed)] struct Packed { x: i16, y: i32, z: i64 } -#[repr(packed)] +#[repr(C, packed)] struct PackedInPacked { a: i32, b: Packed, @@ -64,6 +64,7 @@ struct PackedInPacked { d: Packed } +#[repr(C)] // layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd.. struct PackedInUnpacked { a: i32, @@ -72,6 +73,7 @@ struct PackedInUnpacked { d: Packed } +#[repr(C)] // layout (64 bit): xx.. yyyy zz.. .... wwww wwww struct Unpacked { x: i16, @@ -81,7 +83,7 @@ struct Unpacked { } // layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd -#[repr(packed)] +#[repr(C, packed)] struct UnpackedInPacked { a: i16, b: Unpacked, diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index fe42e9d1421f1..5b3941452685c 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -87,23 +87,27 @@ #![allow(unused_variables)] #![allow(dead_code)] +#[repr(C)] struct NoPadding16 { x: u16, y: i16 } +#[repr(C)] struct NoPadding32 { x: i32, y: f32, z: u32 } +#[repr(C)] struct NoPadding64 { x: f64, y: i64, z: u64 } +#[repr(C)] struct NoPadding163264 { a: i16, b: u16, @@ -111,11 +115,13 @@ struct NoPadding163264 { d: u64 } +#[repr(C)] struct InternalPadding { x: u16, y: i64 } +#[repr(C)] struct PaddingAtEnd { x: i64, y: u16 diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 8b7ceb0c7aa29..f4357292b6c67 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -50,34 +50,40 @@ struct Simple { x: i32 } +#[repr(C)] struct InternalPadding { x: i32, y: i64 } +#[repr(C)] struct PaddingAtEnd { x: i64, y: i32 } +#[repr(C)] struct ThreeSimpleStructs { x: Simple, y: Simple, z: Simple } +#[repr(C)] struct InternalPaddingParent { x: InternalPadding, y: InternalPadding, z: InternalPadding } +#[repr(C)] struct PaddingAtEndParent { x: PaddingAtEnd, y: PaddingAtEnd, z: PaddingAtEnd } +#[repr(C)] struct Mixed { x: PaddingAtEnd, y: InternalPadding, @@ -97,6 +103,7 @@ struct ThatsJustOverkill { x: BagInBag } +#[repr(C)] struct Tree { x: Simple, y: InternalPaddingParent, diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index a0ada74bc2f8f..0872d3501de26 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -35,11 +35,13 @@ #![allow(unused_variables)] +#[repr(C)] struct NoDestructor { x: i32, y: i64 } +#[repr(C)] struct WithDestructor { x: i32, y: i64 @@ -49,11 +51,13 @@ impl Drop for WithDestructor { fn drop(&mut self) {} } +#[repr(C)] struct NoDestructorGuarded { a: NoDestructor, guard: i64 } +#[repr(C)] struct WithDestructorGuarded { a: WithDestructor, guard: i64 diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index b5e626854ae3c..1657e55c1cfdc 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -74,6 +74,7 @@ #![allow(dead_code, unused_variables)] +#[repr(C)] struct AStruct { x: i16, y: i32, diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs deleted file mode 100644 index 2b93f90137671..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -//@ edition:2021 - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option> -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = None; - let element = parse_info(info); - let _ = send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn assert_send(_: T) {} - -fn main() { - let agent = Agent { info_result: InfoResult { node: None } }; - // FIXME: It would be nice for this to work. See #94067. - assert_send(agent.handle()); - //~^ ERROR cannot be sent between threads safely -} diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr deleted file mode 100644 index 9fce4d61b3b6f..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error: future cannot be sent between threads safely - --> $DIR/drop-track-field-assign-nonsend.rs:42:17 - | -LL | assert_send(agent.handle()); - | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` - | - = help: within `impl Future`, the trait `Send` is not implemented for `Rc` -note: future is not `Send` as this value is used across an await - --> $DIR/drop-track-field-assign-nonsend.rs:20:39 - | -LL | let mut info = self.info_result.clone(); - | -------- has type `InfoResult` which is not `Send` -... -LL | let _ = send_element(element).await; - | ^^^^^ await occurs here, with `mut info` maybe used later -note: required by a bound in `assert_send` - --> $DIR/drop-track-field-assign-nonsend.rs:37:19 - | -LL | fn assert_send(_: T) {} - | ^^^^ required by this bound in `assert_send` - -error: aborting due to 1 previous error - diff --git a/tests/ui/async-await/drop-track-field-assign.rs b/tests/ui/async-await/drop-track-field-assign.rs deleted file mode 100644 index 491f80d062bbb..0000000000000 --- a/tests/ui/async-await/drop-track-field-assign.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Derived from an ICE found in tokio-xmpp during a crater run. -//@ edition:2021 -//@ build-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct InfoResult { - node: Option -} - -struct Agent { - info_result: InfoResult -} - -impl Agent { - async fn handle(&mut self) { - let mut info = self.info_result.clone(); - info.node = Some("bar".into()); - let element = parse_info(info); - send_element(element).await; - } -} - -struct Element { -} - -async fn send_element(_: Element) {} - -fn parse(_: &[u8]) -> Result<(), ()> { - Ok(()) -} - -fn parse_info(_: InfoResult) -> Element { - Element { } -} - -fn main() { - let mut agent = Agent { - info_result: InfoResult { node: None } - }; - let _ = agent.handle(); -} diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.rs b/tests/ui/borrowck/suggest-local-var-for-vector.rs deleted file mode 100644 index 40f013f6a78a7..0000000000000 --- a/tests/ui/borrowck/suggest-local-var-for-vector.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let mut vec = vec![0u32; 420]; - vec[vec.len() - 1] = 123; //~ ERROR cannot borrow `vec` as immutable because it is also borrowed as mutable -} diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr deleted file mode 100644 index d88e8b09687db..0000000000000 --- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mutable - --> $DIR/suggest-local-var-for-vector.rs:3:9 - | -LL | vec[vec.len() - 1] = 123; - | ----^^^----------- - | | || - | | |immutable borrow occurs here - | | mutable borrow later used here - | mutable borrow occurs here - | -help: try adding a local storing this... - --> $DIR/suggest-local-var-for-vector.rs:3:9 - | -LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^ -help: ...and then using that local here - --> $DIR/suggest-local-var-for-vector.rs:3:8 - | -LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs b/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs deleted file mode 100644 index 98bbfd4420dc6..0000000000000 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ build-fail -//@ compile-flags: -Copt-level=0 - -pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { - if n > 15 { - encode_num(n / 16, &mut writer)?; - //~^ ERROR: reached the recursion limit while instantiating - } - Ok(()) -} - -pub trait ExampleWriter { - type Error; -} - -impl<'a, T: ExampleWriter> ExampleWriter for &'a mut T { - type Error = T::Error; -} - -struct Error; - -impl ExampleWriter for Error { - type Error = (); -} - -fn main() { - encode_num(69, &mut Error).unwrap(); -} diff --git a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr b/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr deleted file mode 100644 index 94fba4621d0a0..0000000000000 --- a/tests/ui/codegen/normalization-overflow/recursion-issue-105275.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: reached the recursion limit while instantiating `encode_num::<&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut Error>` - --> $DIR/recursion-issue-105275.rs:6:9 - | -LL | encode_num(n / 16, &mut writer)?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: `encode_num` defined here - --> $DIR/recursion-issue-105275.rs:4:1 - | -LL | pub fn encode_num(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/consts/const-blocks/migrate-fail.rs b/tests/ui/consts/const-blocks/migrate-fail.rs deleted file mode 100644 index e7dbb68d920e5..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-fail.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![allow(warnings)] - -// Some type that is not copyable. -struct Bar; - -mod non_constants { - use crate::Bar; - - fn no_impl_copy_empty_value_multiple_elements() { - let x = None; - let arr: [Option; 2] = [x; 2]; - //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277] - } - - fn no_impl_copy_value_multiple_elements() { - let x = Some(Bar); - let arr: [Option; 2] = [x; 2]; - //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277] - } -} - -fn main() {} diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr deleted file mode 100644 index 3c116026e5804..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-fail.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0277]: the trait bound `Bar: Copy` is not satisfied - --> $DIR/migrate-fail.rs:11:38 - | -LL | let arr: [Option; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar` - | - = note: required for `Option` to implement `Copy` - = note: the `Copy` trait is required because this value will be copied for each element of the array - = help: consider using `core::array::from_fn` to initialize the array - = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider annotating `Bar` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct Bar; - | - -error[E0277]: the trait bound `Bar: Copy` is not satisfied - --> $DIR/migrate-fail.rs:17:38 - | -LL | let arr: [Option; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar` - | - = note: required for `Option` to implement `Copy` - = note: the `Copy` trait is required because this value will be copied for each element of the array - = help: consider using `core::array::from_fn` to initialize the array - = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information -help: consider annotating `Bar` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct Bar; - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-blocks/migrate-pass.rs b/tests/ui/consts/const-blocks/migrate-pass.rs deleted file mode 100644 index 629d4db0dc6f1..0000000000000 --- a/tests/ui/consts/const-blocks/migrate-pass.rs +++ /dev/null @@ -1,125 +0,0 @@ -//@ check-pass -#![allow(warnings)] - -// Some type that is not copyable. -struct Bar; - -mod constants { - use crate::Bar; - - fn no_impl_copy_empty_value_no_elements() { - const FOO: Option = None; - const ARR: [Option; 0] = [FOO; 0]; - } - - fn no_impl_copy_empty_value_single_element() { - const FOO: Option = None; - const ARR: [Option; 1] = [FOO; 1]; - } - - fn no_impl_copy_empty_value_multiple_elements() { - const FOO: Option = None; - const ARR: [Option; 2] = [FOO; 2]; - } - - fn no_impl_copy_value_no_elements() { - const FOO: Option = Some(Bar); - const ARR: [Option; 0] = [FOO; 0]; - } - - fn no_impl_copy_value_single_element() { - const FOO: Option = Some(Bar); - const ARR: [Option; 1] = [FOO; 1]; - } - - fn no_impl_copy_value_multiple_elements() { - const FOO: Option = Some(Bar); - const ARR: [Option; 2] = [FOO; 2]; - } - - fn impl_copy_empty_value_no_elements() { - const FOO: Option = None; - const ARR: [Option; 0] = [FOO; 0]; - } - - fn impl_copy_empty_value_one_element() { - const FOO: Option = None; - const ARR: [Option; 1] = [FOO; 1]; - } - - fn impl_copy_empty_value_multiple_elements() { - const FOO: Option = None; - const ARR: [Option; 2] = [FOO; 2]; - } - - fn impl_copy_value_no_elements() { - const FOO: Option = Some(4); - const ARR: [Option; 0] = [FOO; 0]; - } - - fn impl_copy_value_one_element() { - const FOO: Option = Some(4); - const ARR: [Option; 1] = [FOO; 1]; - } - - fn impl_copy_value_multiple_elements() { - const FOO: Option = Some(4); - const ARR: [Option; 2] = [FOO; 2]; - } -} - -mod non_constants { - use crate::Bar; - - fn no_impl_copy_empty_value_no_elements() { - let x = None; - let arr: [Option; 0] = [x; 0]; - } - - fn no_impl_copy_empty_value_single_element() { - let x = None; - let arr: [Option; 1] = [x; 1]; - } - - fn no_impl_copy_value_no_elements() { - let x = Some(Bar); - let arr: [Option; 0] = [x; 0]; - } - - fn no_impl_copy_value_single_element() { - let x = Some(Bar); - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_empty_value_no_elements() { - let x: Option = None; - let arr: [Option; 0] = [x; 0]; - } - - fn impl_copy_empty_value_one_element() { - let x: Option = None; - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_empty_value_multiple_elements() { - let x: Option = None; - let arr: [Option; 2] = [x; 2]; - } - - fn impl_copy_value_no_elements() { - let x: Option = Some(4); - let arr: [Option; 0] = [x; 0]; - } - - fn impl_copy_value_one_element() { - let x: Option = Some(4); - let arr: [Option; 1] = [x; 1]; - } - - fn impl_copy_value_multiple_elements() { - let x: Option = Some(4); - let arr: [Option; 2] = [x; 2]; - } -} - -fn main() {} diff --git a/tests/ui/consts/issue-29914-2.rs b/tests/ui/consts/issue-29914-2.rs index 36a82f5b95012..575cd30e229d9 100644 --- a/tests/ui/consts/issue-29914-2.rs +++ b/tests/ui/consts/issue-29914-2.rs @@ -1,6 +1,7 @@ //@ run-pass const ARR: [usize; 5] = [5, 4, 3, 2, 1]; +const BLA: usize = ARR[ARR[3]]; fn main() { - assert_eq!(3, ARR[ARR[3]]); + assert_eq!(3, BLA); } diff --git a/tests/ui/consts/issue-29914-3.rs b/tests/ui/consts/issue-29914-3.rs deleted file mode 100644 index 575cd30e229d9..0000000000000 --- a/tests/ui/consts/issue-29914-3.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -const ARR: [usize; 5] = [5, 4, 3, 2, 1]; -const BLA: usize = ARR[ARR[3]]; - -fn main() { - assert_eq!(3, BLA); -} diff --git a/tests/ui/coroutine/derived-drop-parent-expr.rs b/tests/ui/coroutine/derived-drop-parent-expr.rs index cc217e4960e90..96872ab1cf9f7 100644 --- a/tests/ui/coroutine/derived-drop-parent-expr.rs +++ b/tests/ui/coroutine/derived-drop-parent-expr.rs @@ -1,6 +1,6 @@ //@ build-pass -//! Like drop-tracking-parent-expression, but also tests that this doesn't ICE when building MIR +//! Like parent-expression, but also tests that this doesn't ICE when building MIR #![feature(coroutines, stmt_expr_attributes)] fn assert_send(_thing: T) {} diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.rs b/tests/ui/coroutine/drop-tracking-parent-expression.rs deleted file mode 100644 index 702cbc88ae4b0..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.rs +++ /dev/null @@ -1,70 +0,0 @@ -//@ dont-require-annotations: NOTE - -#![feature(coroutines, negative_impls, rustc_attrs, stmt_expr_attributes)] - -macro_rules! type_combinations { - ( - $( $name:ident => { $( $tt:tt )* } );* $(;)? - ) => { $( - mod $name { - $( $tt )* - - impl !Sync for Client {} - impl !Send for Client {} - } - - // Struct update syntax. This fails because the Client used in the update is considered - // dropped *after* the yield. - { - let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - //~^ NOTE `significant_drop::Client` which is not `Send` - //~| NOTE `insignificant_dtor::Client` which is not `Send` - //~| NOTE `derived_drop::Client` which is not `Send` - _ => yield, - }; - assert_send(g); - //~^ ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - //~| ERROR cannot be sent between threads - } - - // Simple owned value. This works because the Client is considered moved into `drop`, - // even though the temporary expression doesn't end until after the yield. - { - let g = #[coroutine] move || match drop($name::Client::default()) { - _ => yield, - }; - assert_send(g); - } - )* } -} - -fn assert_send(_thing: T) {} - -fn main() { - type_combinations!( - // OK - copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; - // NOT OK: MIR borrowck thinks that this is used after the yield, even though - // this has no `Drop` impl and only the drops of the fields are observable. - // FIXME: this should compile. - derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - // NOT OK - significant_drop => { - #[derive(Default)] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - // NOT OK (we need to agree with MIR borrowck) - insignificant_dtor => { - #[derive(Default)] - #[rustc_insignificant_dtor] - pub struct Client; - impl Drop for Client { - fn drop(&mut self) {} - } - }; - ); -} diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr deleted file mode 100644 index fe8c17c12946d..0000000000000 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ /dev/null @@ -1,128 +0,0 @@ -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `derived_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:51:46 - | -LL | derived_drop => { #[derive(Default)] pub struct Client { pub nickname: String } }; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `derived_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `significant_drop::Client` - --> $DIR/drop-tracking-parent-expression.rs:55:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `significant_drop::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: coroutine cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:25:13 - | -LL | assert_send(g); - | ^^^^^^^^^^^^^^ coroutine is not `Send` -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation - | -help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:19:34: 19:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` - --> $DIR/drop-tracking-parent-expression.rs:64:13 - | -LL | pub struct Client; - | ^^^^^^^^^^^^^^^^^ -note: coroutine is not `Send` as this value is used across a yield - --> $DIR/drop-tracking-parent-expression.rs:23:22 - | -LL | let g = #[coroutine] move || match drop($name::Client { ..$name::Client::default() }) { - | ------------------------ has type `insignificant_dtor::Client` which is not `Send` -... -LL | _ => yield, - | ^^^^^ yield occurs here, with `$name::Client::default()` maybe used later -... -LL | / type_combinations!( -LL | | // OK -LL | | copy => { #[derive(Copy, Clone, Default)] pub struct Client; }; -... | -LL | | }; -LL | | ); - | |_____- in this macro invocation -note: required by a bound in `assert_send` - --> $DIR/drop-tracking-parent-expression.rs:42:19 - | -LL | fn assert_send(_thing: T) {} - | ^^^^ required by this bound in `assert_send` - = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - diff --git a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs deleted file mode 100644 index ce3ea7dd5796a..0000000000000 --- a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs +++ /dev/null @@ -1,10 +0,0 @@ -// https://github.com/rust-lang/rust/issues/7899 -//@ run-pass -#![allow(unused_variables)] -//@ aux-build:aux-7899.rs - -extern crate aux_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/tests/ui/error-codes/E0508-fail.rs b/tests/ui/error-codes/E0508-fail.rs deleted file mode 100644 index 072c3d66183e3..0000000000000 --- a/tests/ui/error-codes/E0508-fail.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct NonCopy; - -fn main() { - let array = [NonCopy; 1]; - let _value = array[0]; //~ ERROR [E0508] -} diff --git a/tests/ui/error-codes/E0508-fail.stderr b/tests/ui/error-codes/E0508-fail.stderr deleted file mode 100644 index fcfac399e0df5..0000000000000 --- a/tests/ui/error-codes/E0508-fail.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508-fail.rs:5:18 - | -LL | let _value = array[0]; - | ^^^^^^^^ - | | - | cannot move out of here - | move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait - | -note: if `NonCopy` implemented `Clone`, you could clone the value - --> $DIR/E0508-fail.rs:1:1 - | -LL | struct NonCopy; - | ^^^^^^^^^^^^^^ consider implementing `Clone` for this type -... -LL | let _value = array[0]; - | -------- you could clone this value -help: consider borrowing here - | -LL | let _value = &array[0]; - | + - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0508`. diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs index 00de48278b27c..16039f177b4de 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -1,8 +1,13 @@ -struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } +// Regression test for #91831 -fn foo(mut y: Ref, x: &u32) { - y.b = x; - //~^ ERROR lifetime may not live long enough +struct Foo<'a>(&'a i32); + +impl<'a> Foo<'a> { + fn modify(&'a mut self) {} +} + +fn bar(foo: &mut Foo) { + foo.modify(); //~ ERROR lifetime may not live long enough } -fn main() { } +fn main() {} diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index d07b821444ccc..02c0658ff1730 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -1,17 +1,20 @@ error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:5 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:10:5 | -LL | fn foo(mut y: Ref, x: &u32) { - | ----- - let's call the lifetime of this reference `'1` +LL | fn bar(foo: &mut Foo) { + | --- - let's call the lifetime of this reference `'1` | | - | has type `Ref<'_, '2>` -LL | y.b = x; - | ^^^^^^^ assignment requires that `'1` must outlive `'2` + | has type `&mut Foo<'2>` +LL | foo.modify(); + | ^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` | + = note: requirement occurs because of a mutable reference to `Foo<'_>` + = note: mutable references are invariant over their type parameter + = help: see for more information about variance help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(mut y: Ref<'a, 'a>, x: &'a u32) { - | ++++ ++++++++ ++ +LL | fn bar<'a>(foo: &'a mut Foo<'a>) { + | ++++ ++ ++++ error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs deleted file mode 100644 index 16039f177b4de..0000000000000 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Regression test for #91831 - -struct Foo<'a>(&'a i32); - -impl<'a> Foo<'a> { - fn modify(&'a mut self) {} -} - -fn bar(foo: &mut Foo) { - foo.modify(); //~ ERROR lifetime may not live long enough -} - -fn main() {} diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr deleted file mode 100644 index f02b65230b6eb..0000000000000 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-5.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/ex3-both-anon-regions-one-is-struct-5.rs:10:5 - | -LL | fn bar(foo: &mut Foo) { - | --- - let's call the lifetime of this reference `'1` - | | - | has type `&mut Foo<'2>` -LL | foo.modify(); - | ^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - | - = note: requirement occurs because of a mutable reference to `Foo<'_>` - = note: mutable references are invariant over their type parameter - = help: see for more information about variance -help: consider introducing a named lifetime parameter - | -LL | fn bar<'a>(foo: &'a mut Foo<'a>) { - | ++++ ++ ++++ - -error: aborting due to 1 previous error - diff --git a/tests/ui/lint/auxiliary/stability_cfg2.rs b/tests/ui/lint/auxiliary/stability_cfg2.rs deleted file mode 100644 index ed69d26a9cb1e..0000000000000 --- a/tests/ui/lint/auxiliary/stability_cfg2.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:--cfg foo - -#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "none"))] -#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] -#![feature(staged_api)] diff --git a/tests/ui/parser/issues/issue-1802-2.rs b/tests/ui/parser/issues/issue-1802-2.rs deleted file mode 100644 index 3c34b0d8febbc..0000000000000 --- a/tests/ui/parser/issues/issue-1802-2.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn log(a: i32, b: i32) {} - -fn main() { - let error = 42; - log(error, 0b); - //~^ ERROR no valid digits found for number -} diff --git a/tests/ui/parser/issues/issue-1802-2.stderr b/tests/ui/parser/issues/issue-1802-2.stderr deleted file mode 100644 index 7c802e4bdf7b6..0000000000000 --- a/tests/ui/parser/issues/issue-1802-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0768]: no valid digits found for number - --> $DIR/issue-1802-2.rs:5:16 - | -LL | log(error, 0b); - | ^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0768`. diff --git a/tests/ui/tool-attributes/tool_lints_2018_preview.rs b/tests/ui/tool-attributes/tool_lints_2018_preview.rs deleted file mode 100644 index 458eca19ed6c7..0000000000000 --- a/tests/ui/tool-attributes/tool_lints_2018_preview.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-pass - -#![deny(unknown_lints)] - -#[allow(clippy::almost_swapped)] -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-58951-2.rs b/tests/ui/type-alias-impl-trait/issue-58951-2.rs deleted file mode 100644 index de6b9e741198b..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-58951-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ check-pass - -#![feature(type_alias_impl_trait)] - -pub type A = impl Iterator; - -#[define_opaque(A)] -pub fn def_a() -> A { - 0..1 -} - -pub fn use_a() { - def_a().map(|x| x); -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.rs b/tests/ui/type-alias-impl-trait/issue-74761-2.rs deleted file mode 100644 index e556025adee6e..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(impl_trait_in_assoc_type)] - -pub trait A { - type B; - fn f(&self) -> Self::B; -} -impl<'a, 'b> A for () { - //~^ ERROR the lifetime parameter `'a` is not constrained - //~| ERROR the lifetime parameter `'b` is not constrained - type B = impl core::fmt::Debug; - - fn f(&self) -> Self::B {} - //~^ ERROR expected generic lifetime parameter -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr b/tests/ui/type-alias-impl-trait/issue-74761-2.stderr deleted file mode 100644 index 26babc29000c0..0000000000000 --- a/tests/ui/type-alias-impl-trait/issue-74761-2.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:7:6 - | -LL | impl<'a, 'b> A for () { - | ^^ unconstrained lifetime parameter - -error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:7:10 - | -LL | impl<'a, 'b> A for () { - | ^^ unconstrained lifetime parameter - -error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/issue-74761-2.rs:12:28 - | -LL | impl<'a, 'b> A for () { - | -- this generic parameter must be used with a generic lifetime parameter -... -LL | fn f(&self) -> Self::B {} - | ^^ - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0207, E0792. -For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs deleted file mode 100644 index 6b67ebbec1c0c..0000000000000 --- a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs +++ /dev/null @@ -1,6 +0,0 @@ -struct Test([i32]); - -fn main() { - let _x: fn(_) -> Test = Test; - //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time -} diff --git a/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr b/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr deleted file mode 100644 index a7bf27a0c4acc..0000000000000 --- a/tests/ui/unsized-locals/issue-30276-feature-flagged.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-30276-feature-flagged.rs:4:29 - | -LL | let _x: fn(_) -> Test = Test; - | ^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[i32]` - = note: all function arguments must have a statically known size - = help: unsized fn params are gated as an unstable feature - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`.