about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-29 22:10:16 -0400
committerMichael Goulet <michael@errs.io>2024-10-01 13:55:46 -0400
commite3a0da18633a8cfb5263bb975747352690b01fcf (patch)
treee5f9850e4d0a47a6d7178469cea7f53bac319d20
parent8dd5cd0bc1d683c30805e1dc831cac546b621a75 (diff)
Remove unnamed field feature
-rw-r--r--compiler/rustc_ast_passes/messages.ftl8
-rw-r--r--compiler/rustc_ast_passes/src/ast_validation.rs26
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs18
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs1
-rw-r--r--compiler/rustc_feature/src/removed.rs2
-rw-r--r--compiler/rustc_feature/src/unstable.rs2
-rw-r--r--compiler/rustc_hir_analysis/messages.ftl15
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs56
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs104
-rw-r--r--compiler/rustc_hir_analysis/src/errors.rs42
-rw-r--r--compiler/rustc_hir_typeck/src/expr.rs63
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs10
-rw-r--r--compiler/rustc_hir_typeck/src/pat.rs3
-rw-r--r--compiler/rustc_hir_typeck/src/writeback.rs5
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs3
-rw-r--r--compiler/rustc_middle/src/ty/adt.rs9
-rw-r--r--compiler/rustc_middle/src/ty/context.rs10
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs22
-rw-r--r--compiler/rustc_middle/src/ty/typeck_results.rs19
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/expr.rs20
-rw-r--r--compiler/rustc_parse/src/parser/item.rs4
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.rs29
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.stderr63
-rw-r--r--tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs11
-rw-r--r--tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr16
-rw-r--r--tests/ui/union/unnamed-fields/auxiliary/dep.rs18
-rw-r--r--tests/ui/union/unnamed-fields/field_uniqueness_check.rs337
-rw-r--r--tests/ui/union/unnamed-fields/field_uniqueness_check.stderr1734
-rw-r--r--tests/ui/union/unnamed-fields/repr_check.rs69
-rw-r--r--tests/ui/union/unnamed-fields/repr_check.stderr152
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs32
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr48
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs32
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr48
-rw-r--r--tests/ui/union/unnamed-fields/restrict_type_hir.rs44
-rw-r--r--tests/ui/union/unnamed-fields/restrict_type_hir.stderr62
-rw-r--r--tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.rs25
-rw-r--r--tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.stderr45
-rw-r--r--tests/ui/unpretty/expanded-exhaustive.rs14
-rw-r--r--tests/ui/unpretty/expanded-exhaustive.stdout18
40 files changed, 30 insertions, 3209 deletions
diff --git a/compiler/rustc_ast_passes/messages.ftl b/compiler/rustc_ast_passes/messages.ftl
index c361c35b723..0146a8d9082 100644
--- a/compiler/rustc_ast_passes/messages.ftl
+++ b/compiler/rustc_ast_passes/messages.ftl
@@ -160,14 +160,6 @@ ast_passes_inherent_cannot_be = inherent impls cannot be {$annotation}
     .type = inherent impl for this type
     .only_trait = only trait implementations may be annotated with {$annotation}
 
-ast_passes_invalid_unnamed_field =
-    unnamed fields are not allowed outside of structs or unions
-    .label = unnamed field declared here
-
-ast_passes_invalid_unnamed_field_ty =
-    unnamed fields can only have struct or union types
-    .label = not a struct or union
-
 ast_passes_item_invalid_safety = items outside of `unsafe extern {"{ }"}` cannot be declared with `safe` safety qualifier
     .suggestion = remove safe from this item
 
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index 229d04f8de2..b3d91d881c4 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -255,7 +255,6 @@ impl<'a> AstValidator<'a> {
         if let Some(ident) = field.ident
             && ident.name == kw::Underscore
         {
-            self.check_unnamed_field_ty(&field.ty, ident.span);
             self.visit_vis(&field.vis);
             self.visit_ident(ident);
             self.visit_ty_common(&field.ty);
@@ -294,21 +293,6 @@ impl<'a> AstValidator<'a> {
         }
     }
 
-    fn check_unnamed_field_ty(&self, ty: &Ty, span: Span) {
-        if matches!(
-            &ty.kind,
-            // We already checked for `kw::Underscore` before calling this function,
-            // so skip the check
-            TyKind::AnonStruct(..) | TyKind::AnonUnion(..)
-            // If the anonymous field contains a Path as type, we can't determine
-            // if the path is a valid struct or union, so skip the check
-            | TyKind::Path(..)
-        ) {
-            return;
-        }
-        self.dcx().emit_err(errors::InvalidUnnamedFieldTy { span, ty_span: ty.span });
-    }
-
     fn deny_anon_struct_or_union(&self, ty: &Ty) {
         let struct_or_union = match &ty.kind {
             TyKind::AnonStruct(..) => "struct",
@@ -318,15 +302,6 @@ impl<'a> AstValidator<'a> {
         self.dcx().emit_err(errors::AnonStructOrUnionNotAllowed { struct_or_union, span: ty.span });
     }
 
-    fn deny_unnamed_field(&self, field: &FieldDef) {
-        if let Some(ident) = field.ident
-            && ident.name == kw::Underscore
-        {
-            self.dcx()
-                .emit_err(errors::InvalidUnnamedField { span: field.span, ident_span: ident.span });
-        }
-    }
-
     fn check_trait_fn_not_const(&self, constness: Const, parent: &TraitOrTraitImpl) {
         let Const::Yes(span) = constness else {
             return;
@@ -895,7 +870,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
     }
 
     fn visit_field_def(&mut self, field: &'a FieldDef) {
-        self.deny_unnamed_field(field);
         visit::walk_field_def(self, field)
     }
 
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index 5cce47ce7bd..07515897c69 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -815,24 +815,6 @@ pub(crate) struct NegativeBoundWithParentheticalNotation {
 }
 
 #[derive(Diagnostic)]
-#[diag(ast_passes_invalid_unnamed_field_ty)]
-pub(crate) struct InvalidUnnamedFieldTy {
-    #[primary_span]
-    pub span: Span,
-    #[label]
-    pub ty_span: Span,
-}
-
-#[derive(Diagnostic)]
-#[diag(ast_passes_invalid_unnamed_field)]
-pub(crate) struct InvalidUnnamedField {
-    #[primary_span]
-    pub span: Span,
-    #[label]
-    pub ident_span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(ast_passes_anon_struct_or_union_not_allowed)]
 pub(crate) struct AnonStructOrUnionNotAllowed {
     #[primary_span]
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index 83931a8c1a9..e47f5d43128 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -541,7 +541,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
     gate_all!(builtin_syntax, "`builtin #` syntax is unstable");
     gate_all!(explicit_tail_calls, "`become` expression is experimental");
     gate_all!(generic_const_items, "generic const items are experimental");
-    gate_all!(unnamed_fields, "unnamed fields are not yet fully implemented");
     gate_all!(fn_delegation, "functions delegation is not yet fully implemented");
     gate_all!(postfix_match, "postfix match is experimental");
     gate_all!(mut_ref, "mutable by-reference bindings are experimental");
diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs
index 0cd0963d4e3..276814dd0d9 100644
--- a/compiler/rustc_feature/src/removed.rs
+++ b/compiler/rustc_feature/src/removed.rs
@@ -216,6 +216,8 @@ declare_features! (
     (removed, test_removed_feature, "1.0.0", None, None),
     /// Allows using items which are missing stability attributes
     (removed, unmarked_api, "1.0.0", None, None),
+    /// Allows unnamed fields of struct and union type
+    (removed, unnamed_fields, "1.74.0", Some(49804)),
     (removed, unsafe_no_drop_flag, "1.0.0", None, None),
     /// Allows `union` fields that don't implement `Copy` as long as they don't have any drop glue.
     (removed, untagged_unions, "1.13.0", Some(55149),
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index c5530097e96..843610a18a1 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -618,8 +618,6 @@ declare_features! (
     /// Allows creation of instances of a struct by moving fields that have
     /// not changed from prior instances of the same struct (RFC #2528)
     (unstable, type_changing_struct_update, "1.58.0", Some(86555)),
-    /// Allows unnamed fields of struct and union type
-    (incomplete, unnamed_fields, "1.74.0", Some(49804)),
     /// Allows const generic parameters to be defined with types that
     /// are not `Sized`, e.g. `fn foo<const N: [u8]>() {`.
     (incomplete, unsized_const_params, "1.82.0", Some(95174)),
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index c73826c489f..b64a400f75e 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -248,8 +248,6 @@ hir_analysis_invalid_union_field =
 hir_analysis_invalid_union_field_sugg =
     wrap the field type in `ManuallyDrop<...>`
 
-hir_analysis_invalid_unnamed_field_ty = unnamed fields can only have struct or union types
-
 hir_analysis_late_bound_const_in_apit = `impl Trait` can only mention const parameters from an fn or impl
     .label = const parameter declared here
 
@@ -535,19 +533,6 @@ hir_analysis_unconstrained_generic_parameter = the {$param_def_kind} `{$param_na
 hir_analysis_unconstrained_opaque_type = unconstrained opaque type
     .note = `{$name}` must be used in combination with a concrete type within the same {$what}
 
-hir_analysis_unnamed_fields_repr_field_defined = unnamed field defined here
-
-hir_analysis_unnamed_fields_repr_field_missing_repr_c =
-    named type of unnamed field must have `#[repr(C)]` representation
-    .label = unnamed field defined here
-    .field_ty_label = `{$field_ty}` defined here
-    .suggestion = add `#[repr(C)]` to this {$field_adt_kind}
-
-hir_analysis_unnamed_fields_repr_missing_repr_c =
-    {$adt_kind} with unnamed fields must have `#[repr(C)]` representation
-    .label = {$adt_kind} `{$adt_name}` defined here
-    .suggestion = add `#[repr(C)]` to this {$adt_kind}
-
 hir_analysis_unrecognized_atomic_operation =
     unrecognized atomic operation function: `{$op}`
     .label = unrecognized atomic operation
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index d725772a5b3..b9111a5cd39 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -76,7 +76,6 @@ fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
 
     check_transparent(tcx, def);
     check_packed(tcx, span, def);
-    check_unnamed_fields(tcx, def);
 }
 
 fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) {
@@ -86,61 +85,6 @@ fn check_union(tcx: TyCtxt<'_>, def_id: LocalDefId) {
     check_transparent(tcx, def);
     check_union_fields(tcx, span, def_id);
     check_packed(tcx, span, def);
-    check_unnamed_fields(tcx, def);
-}
-
-/// Check the representation of adts with unnamed fields.
-fn check_unnamed_fields(tcx: TyCtxt<'_>, def: ty::AdtDef<'_>) {
-    if def.is_enum() {
-        return;
-    }
-    let variant = def.non_enum_variant();
-    if !variant.has_unnamed_fields() {
-        return;
-    }
-    if !def.is_anonymous() {
-        let adt_kind = def.descr();
-        let span = tcx.def_span(def.did());
-        let unnamed_fields = variant
-            .fields
-            .iter()
-            .filter(|f| f.is_unnamed())
-            .map(|f| {
-                let span = tcx.def_span(f.did);
-                errors::UnnamedFieldsReprFieldDefined { span }
-            })
-            .collect::<Vec<_>>();
-        debug_assert_ne!(unnamed_fields.len(), 0, "expect unnamed fields in this adt");
-        let adt_name = tcx.item_name(def.did());
-        if !def.repr().c() {
-            tcx.dcx().emit_err(errors::UnnamedFieldsRepr::MissingReprC {
-                span,
-                adt_kind,
-                adt_name,
-                unnamed_fields,
-                sugg_span: span.shrink_to_lo(),
-            });
-        }
-    }
-    for field in variant.fields.iter().filter(|f| f.is_unnamed()) {
-        let field_ty = tcx.type_of(field.did).instantiate_identity();
-        if let Some(adt) = field_ty.ty_adt_def()
-            && !adt.is_enum()
-        {
-            if !adt.is_anonymous() && !adt.repr().c() {
-                let field_ty_span = tcx.def_span(adt.did());
-                tcx.dcx().emit_err(errors::UnnamedFieldsRepr::FieldMissingReprC {
-                    span: tcx.def_span(field.did),
-                    field_ty_span,
-                    field_ty,
-                    field_adt_kind: adt.descr(),
-                    sugg_span: field_ty_span.shrink_to_lo(),
-                });
-            }
-        } else {
-            tcx.dcx().emit_err(errors::InvalidUnnamedFieldTy { span: tcx.def_span(field.did) });
-        }
-    }
 }
 
 /// Check that the fields of the `union` do not need dropping.
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 93b021be245..cfa148d925d 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1007,79 +1007,6 @@ impl<'tcx> FieldUniquenessCheckContext<'tcx> {
             }
         }
     }
-
-    /// Check the uniqueness of fields across adt where there are
-    /// nested fields imported from an unnamed field.
-    fn check_field_in_nested_adt(&mut self, adt_def: ty::AdtDef<'_>, unnamed_field_span: Span) {
-        for field in adt_def.all_fields() {
-            if field.is_unnamed() {
-                // Here we don't care about the generic parameters, so `instantiate_identity` is enough.
-                match self.tcx.type_of(field.did).instantiate_identity().kind() {
-                    ty::Adt(adt_def, _) => {
-                        self.check_field_in_nested_adt(*adt_def, unnamed_field_span);
-                    }
-                    ty_kind => span_bug!(
-                        self.tcx.def_span(field.did),
-                        "Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt(): {ty_kind:?}"
-                    ),
-                }
-            } else {
-                self.check_field_decl(
-                    field.ident(self.tcx),
-                    NestedSpan {
-                        span: unnamed_field_span,
-                        nested_field_span: self.tcx.def_span(field.did),
-                    }
-                    .into(),
-                );
-            }
-        }
-    }
-
-    /// Check the uniqueness of fields in a struct variant, and recursively
-    /// check the nested fields if it is an unnamed field with type of an
-    /// anonymous adt.
-    fn check_field(&mut self, field: &hir::FieldDef<'_>) {
-        if field.ident.name != kw::Underscore {
-            self.check_field_decl(field.ident, field.span.into());
-            return;
-        }
-        match &field.ty.kind {
-            hir::TyKind::AnonAdt(item_id) => {
-                match &self.tcx.hir_node(item_id.hir_id()).expect_item().kind {
-                    hir::ItemKind::Struct(variant_data, ..)
-                    | hir::ItemKind::Union(variant_data, ..) => {
-                        variant_data.fields().iter().for_each(|f| self.check_field(f));
-                    }
-                    item_kind => span_bug!(
-                        field.ty.span,
-                        "Unexpected ItemKind in FieldUniquenessCheckContext::check_field(): {item_kind:?}"
-                    ),
-                }
-            }
-            hir::TyKind::Path(hir::QPath::Resolved(_, hir::Path { res, .. })) => {
-                // If this is a direct path to an ADT, we can check it
-                // If this is a type alias or non-ADT, `check_unnamed_fields` should verify it
-                if let Some(def_id) = res.opt_def_id()
-                    && let Some(local) = def_id.as_local()
-                    && let Node::Item(item) = self.tcx.hir_node_by_def_id(local)
-                    && item.is_adt()
-                {
-                    self.check_field_in_nested_adt(self.tcx.adt_def(def_id), field.span);
-                }
-            }
-            // Abort due to errors (there must be an error if an unnamed field
-            //  has any type kind other than an anonymous adt or a named adt)
-            ty_kind => {
-                self.tcx.dcx().span_delayed_bug(
-                    field.ty.span,
-                    format!("Unexpected TyKind in FieldUniquenessCheckContext::check_field(): {ty_kind:?}"),
-                );
-                // FIXME: errors during AST validation should abort the compilation before reaching here.
-                self.tcx.dcx().abort_if_errors();
-            }
-        }
-    }
 }
 
 fn lower_variant(
@@ -1090,20 +1017,13 @@ fn lower_variant(
     def: &hir::VariantData<'_>,
     adt_kind: ty::AdtKind,
     parent_did: LocalDefId,
-    is_anonymous: bool,
 ) -> ty::VariantDef {
-    let mut has_unnamed_fields = false;
     let mut field_uniqueness_check_ctx = FieldUniquenessCheckContext::new(tcx);
     let fields = def
         .fields()
         .iter()
-        .inspect(|f| {
-            has_unnamed_fields |= f.ident.name == kw::Underscore;
-            // We only check named ADT here because anonymous ADTs are checked inside
-            // the named ADT in which they are defined.
-            if !is_anonymous {
-                field_uniqueness_check_ctx.check_field(f);
-            }
+        .inspect(|field| {
+            field_uniqueness_check_ctx.check_field_decl(field.ident, field.span.into());
         })
         .map(|f| ty::FieldDef {
             did: f.def_id.to_def_id(),
@@ -1127,7 +1047,6 @@ fn lower_variant(
         adt_kind == AdtKind::Struct && tcx.has_attr(parent_did, sym::non_exhaustive)
             || variant_did
                 .is_some_and(|variant_did| tcx.has_attr(variant_did, sym::non_exhaustive)),
-        has_unnamed_fields,
     )
 }
 
@@ -1138,20 +1057,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
         bug!("expected ADT to be an item");
     };
 
-    let is_anonymous = item.ident.name == kw::Empty;
-    let repr = if is_anonymous {
-        let parent = tcx.local_parent(def_id);
-        if let Node::Item(item) = tcx.hir_node_by_def_id(parent)
-            && item.is_struct_or_union()
-        {
-            tcx.adt_def(parent).repr()
-        } else {
-            tcx.dcx().span_delayed_bug(item.span, "anonymous field inside non struct/union");
-            ty::ReprOptions::default()
-        }
-    } else {
-        tcx.repr_options_of_def(def_id)
-    };
+    let repr = tcx.repr_options_of_def(def_id);
     let (kind, variants) = match &item.kind {
         ItemKind::Enum(def, _) => {
             let mut distance_from_explicit = 0;
@@ -1175,7 +1081,6 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
                         &v.data,
                         AdtKind::Enum,
                         def_id,
-                        is_anonymous,
                     )
                 })
                 .collect();
@@ -1195,7 +1100,6 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
                 def,
                 adt_kind,
                 def_id,
-                is_anonymous,
             ))
             .collect();
 
@@ -1203,7 +1107,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
         }
         _ => bug!("{:?} is not an ADT", item.owner_id.def_id),
     };
-    tcx.mk_adt_def(def_id.to_def_id(), kind, variants, repr, is_anonymous)
+    tcx.mk_adt_def(def_id.to_def_id(), kind, variants, repr)
 }
 
 fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 4edb68e6199..9099703e812 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -735,13 +735,6 @@ pub(crate) struct InvalidUnionField {
 }
 
 #[derive(Diagnostic)]
-#[diag(hir_analysis_invalid_unnamed_field_ty)]
-pub(crate) struct InvalidUnnamedFieldTy {
-    #[primary_span]
-    pub span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(hir_analysis_return_type_notation_on_non_rpitit)]
 pub(crate) struct ReturnTypeNotationOnNonRpitit<'tcx> {
     #[primary_span]
@@ -1599,41 +1592,6 @@ pub(crate) struct UnconstrainedGenericParameter {
 }
 
 #[derive(Diagnostic)]
-pub(crate) enum UnnamedFieldsRepr<'a> {
-    #[diag(hir_analysis_unnamed_fields_repr_missing_repr_c)]
-    MissingReprC {
-        #[primary_span]
-        #[label]
-        span: Span,
-        adt_kind: &'static str,
-        adt_name: Symbol,
-        #[subdiagnostic]
-        unnamed_fields: Vec<UnnamedFieldsReprFieldDefined>,
-        #[suggestion(code = "#[repr(C)]\n")]
-        sugg_span: Span,
-    },
-    #[diag(hir_analysis_unnamed_fields_repr_field_missing_repr_c)]
-    FieldMissingReprC {
-        #[primary_span]
-        #[label]
-        span: Span,
-        #[label(hir_analysis_field_ty_label)]
-        field_ty_span: Span,
-        field_ty: Ty<'a>,
-        field_adt_kind: &'static str,
-        #[suggestion(code = "#[repr(C)]\n")]
-        sugg_span: Span,
-    },
-}
-
-#[derive(Subdiagnostic)]
-#[note(hir_analysis_unnamed_fields_repr_field_defined)]
-pub(crate) struct UnnamedFieldsReprFieldDefined {
-    #[primary_span]
-    pub span: Span,
-}
-
-#[derive(Diagnostic)]
 #[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)]
 pub(crate) struct OpaqueCapturesHigherRankedLifetime {
     #[primary_span]
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index b34ed4640db..ed7be72551b 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -33,7 +33,6 @@ use rustc_span::symbol::{Ident, Symbol, kw, sym};
 use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
 use rustc_trait_selection::infer::InferCtxtExt;
 use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt};
-use smallvec::SmallVec;
 use tracing::{debug, instrument, trace};
 use {rustc_ast as ast, rustc_hir as hir};
 
@@ -1722,8 +1721,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             let ident = tcx.adjust_ident(field.ident, variant.def_id);
             let field_type = if let Some((i, v_field)) = remaining_fields.remove(&ident) {
                 seen_fields.insert(ident, field.span);
-                // FIXME: handle nested fields
-                self.write_field_index(field.hir_id, i, Vec::new());
+                self.write_field_index(field.hir_id, i);
 
                 // We don't look at stability attributes on
                 // struct-like enums (yet...), but it's definitely not
@@ -2367,35 +2365,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         &self,
         base_def: ty::AdtDef<'tcx>,
         ident: Ident,
-        nested_fields: &mut SmallVec<[(FieldIdx, &'tcx ty::FieldDef); 1]>,
-    ) -> bool {
+    ) -> Option<(FieldIdx, &'tcx ty::FieldDef)> {
         // No way to find a field in an enum.
         if base_def.is_enum() {
-            return false;
+            return None;
         }
 
         for (field_idx, field) in base_def.non_enum_variant().fields.iter_enumerated() {
-            if field.is_unnamed() {
-                // We have an unnamed field, recurse into the nested ADT to find `ident`.
-                // If we find it there, return immediately, and `nested_fields` will contain the
-                // correct path.
-                nested_fields.push((field_idx, field));
-
-                let field_ty = self.tcx.type_of(field.did).instantiate_identity();
-                let adt_def = field_ty.ty_adt_def().expect("expect Adt for unnamed field");
-                if self.find_adt_field(adt_def, ident, &mut *nested_fields) {
-                    return true;
-                }
-
-                nested_fields.pop();
-            } else if field.ident(self.tcx).normalize_to_macros_2_0() == ident {
+            if field.ident(self.tcx).normalize_to_macros_2_0() == ident {
                 // We found the field we wanted.
-                nested_fields.push((field_idx, field));
-                return true;
+                return Some((field_idx, field));
             }
         }
 
-        false
+        None
     }
 
     // Check field access expressions
@@ -2425,34 +2408,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                         return Ty::new_error(self.tcx(), guar);
                     }
 
-                    let mut field_path = SmallVec::new();
-                    if self.find_adt_field(*base_def, ident, &mut field_path) {
-                        let (first_idx, _) = field_path[0];
-                        let (_, last_field) = field_path.last().unwrap();
-
-                        // Save the index of all fields regardless of their visibility in case
-                        // of error recovery.
-                        let nested_fields = field_path[..]
-                            .array_windows()
-                            .map(|[(_, outer), (inner_idx, _)]| {
-                                let outer_ty = self.field_ty(expr.span, outer, args);
-                                (outer_ty, *inner_idx)
-                            })
-                            .collect();
-                        self.write_field_index(expr.hir_id, first_idx, nested_fields);
+                    if let Some((idx, field)) = self.find_adt_field(*base_def, ident) {
+                        self.write_field_index(expr.hir_id, idx);
 
                         let adjustments = self.adjust_steps(&autoderef);
-                        if last_field.vis.is_accessible_from(def_scope, self.tcx) {
+                        if field.vis.is_accessible_from(def_scope, self.tcx) {
                             self.apply_adjustments(base, adjustments);
                             self.register_predicates(autoderef.into_obligations());
 
-                            self.tcx.check_stability(
-                                last_field.did,
-                                Some(expr.hir_id),
-                                expr.span,
-                                None,
-                            );
-                            return self.field_ty(expr.span, last_field, args);
+                            self.tcx.check_stability(field.did, Some(expr.hir_id), expr.span, None);
+                            return self.field_ty(expr.span, field, args);
                         }
 
                         // The field is not accessible, fall through to error reporting.
@@ -2467,11 +2432,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                                 self.apply_adjustments(base, adjustments);
                                 self.register_predicates(autoderef.into_obligations());
 
-                                self.write_field_index(
-                                    expr.hir_id,
-                                    FieldIdx::from_usize(index),
-                                    Vec::new(),
-                                );
+                                self.write_field_index(expr.hir_id, FieldIdx::from_usize(index));
                                 return field_ty;
                             }
                         }
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 62107877283..cd4c5de2a66 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -165,16 +165,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         }
     }
 
-    pub(crate) fn write_field_index(
-        &self,
-        hir_id: HirId,
-        index: FieldIdx,
-        nested_fields: Vec<(Ty<'tcx>, FieldIdx)>,
-    ) {
+    pub(crate) fn write_field_index(&self, hir_id: HirId, index: FieldIdx) {
         self.typeck_results.borrow_mut().field_indices_mut().insert(hir_id, index);
-        if !nested_fields.is_empty() {
-            self.typeck_results.borrow_mut().nested_fields_mut().insert(hir_id, nested_fields);
-        }
     }
 
     #[instrument(level = "debug", skip(self))]
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 49c5a7d8a65..fb78da0a86c 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -1513,8 +1513,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     field_map
                         .get(&ident)
                         .map(|(i, f)| {
-                            // FIXME: handle nested fields
-                            self.write_field_index(field.hir_id, *i, Vec::new());
+                            self.write_field_index(field.hir_id, *i);
                             self.tcx.check_stability(f.did, Some(pat.hir_id), span, None);
                             self.field_ty(span, f, args)
                         })
diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs
index 3254dddaee9..b193b81f6de 100644
--- a/compiler/rustc_hir_typeck/src/writeback.rs
+++ b/compiler/rustc_hir_typeck/src/writeback.rs
@@ -588,11 +588,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
         {
             self.typeck_results.field_indices_mut().insert(hir_id, index);
         }
-        if let Some(nested_fields) =
-            self.fcx.typeck_results.borrow_mut().nested_fields_mut().remove(hir_id)
-        {
-            self.typeck_results.nested_fields_mut().insert(hir_id, nested_fields);
-        }
     }
 
     #[instrument(skip(self, span), level = "debug")]
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 2157324d5cc..600a9b75097 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -1107,8 +1107,6 @@ impl<'a> CrateMetadataRef<'a> {
                 parent_did,
                 None,
                 data.is_non_exhaustive,
-                // FIXME: unnamed fields in crate metadata is unimplemented yet.
-                false,
             ),
         )
     }
@@ -1151,7 +1149,6 @@ impl<'a> CrateMetadataRef<'a> {
             adt_kind,
             variants.into_iter().map(|(_, variant)| variant).collect(),
             repr,
-            false,
         )
     }
 
diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs
index 8f89f5c25af..3322a2643d7 100644
--- a/compiler/rustc_middle/src/ty/adt.rs
+++ b/compiler/rustc_middle/src/ty/adt.rs
@@ -259,12 +259,8 @@ impl AdtDefData {
         kind: AdtKind,
         variants: IndexVec<VariantIdx, VariantDef>,
         repr: ReprOptions,
-        is_anonymous: bool,
     ) -> Self {
-        debug!(
-            "AdtDef::new({:?}, {:?}, {:?}, {:?}, {:?})",
-            did, kind, variants, repr, is_anonymous
-        );
+        debug!("AdtDef::new({:?}, {:?}, {:?}, {:?})", did, kind, variants, repr);
         let mut flags = AdtFlags::NO_ADT_FLAGS;
 
         if kind == AdtKind::Enum && tcx.has_attr(did, sym::non_exhaustive) {
@@ -297,9 +293,6 @@ impl AdtDefData {
         if tcx.is_lang_item(did, LangItem::UnsafeCell) {
             flags |= AdtFlags::IS_UNSAFE_CELL;
         }
-        if is_anonymous {
-            flags |= AdtFlags::IS_ANONYMOUS;
-        }
 
         AdtDefData { did, variants, flags, repr }
     }
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 2ffb273cb6f..4eaba540e33 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -1419,16 +1419,8 @@ impl<'tcx> TyCtxt<'tcx> {
         kind: AdtKind,
         variants: IndexVec<VariantIdx, ty::VariantDef>,
         repr: ReprOptions,
-        is_anonymous: bool,
     ) -> ty::AdtDef<'tcx> {
-        self.mk_adt_def_from_data(ty::AdtDefData::new(
-            self,
-            did,
-            kind,
-            variants,
-            repr,
-            is_anonymous,
-        ))
+        self.mk_adt_def_from_data(ty::AdtDefData::new(self, did, kind, variants, repr))
     }
 
     /// Allocates a read-only byte or string literal for `mir::interpret`.
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 2b1212a5eb5..33bb5fa5739 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -1155,8 +1155,6 @@ bitflags::bitflags! {
         const NO_VARIANT_FLAGS        = 0;
         /// Indicates whether the field list of this variant is `#[non_exhaustive]`.
         const IS_FIELD_LIST_NON_EXHAUSTIVE = 1 << 0;
-        /// Indicates whether this variant has unnamed fields.
-        const HAS_UNNAMED_FIELDS = 1 << 1;
     }
 }
 rustc_data_structures::external_bitflags_debug! { VariantFlags }
@@ -1209,12 +1207,11 @@ impl VariantDef {
         parent_did: DefId,
         recover_tainted: Option<ErrorGuaranteed>,
         is_field_list_non_exhaustive: bool,
-        has_unnamed_fields: bool,
     ) -> Self {
         debug!(
             "VariantDef::new(name = {:?}, variant_did = {:?}, ctor = {:?}, discr = {:?},
-             fields = {:?}, adt_kind = {:?}, parent_did = {:?}, has_unnamed_fields = {:?})",
-            name, variant_did, ctor, discr, fields, adt_kind, parent_did, has_unnamed_fields,
+             fields = {:?}, adt_kind = {:?}, parent_did = {:?})",
+            name, variant_did, ctor, discr, fields, adt_kind, parent_did,
         );
 
         let mut flags = VariantFlags::NO_VARIANT_FLAGS;
@@ -1222,10 +1219,6 @@ impl VariantDef {
             flags |= VariantFlags::IS_FIELD_LIST_NON_EXHAUSTIVE;
         }
 
-        if has_unnamed_fields {
-            flags |= VariantFlags::HAS_UNNAMED_FIELDS;
-        }
-
         VariantDef {
             def_id: variant_did.unwrap_or(parent_did),
             ctor,
@@ -1243,12 +1236,6 @@ impl VariantDef {
         self.flags.intersects(VariantFlags::IS_FIELD_LIST_NON_EXHAUSTIVE)
     }
 
-    /// Does this variant contains unnamed fields
-    #[inline]
-    pub fn has_unnamed_fields(&self) -> bool {
-        self.flags.intersects(VariantFlags::HAS_UNNAMED_FIELDS)
-    }
-
     /// Computes the `Ident` of this variant by looking up the `Span`
     pub fn ident(&self, tcx: TyCtxt<'_>) -> Ident {
         Ident::new(self.name, tcx.def_ident_span(self.def_id).unwrap())
@@ -1434,11 +1421,6 @@ impl<'tcx> FieldDef {
     pub fn ident(&self, tcx: TyCtxt<'_>) -> Ident {
         Ident::new(self.name, tcx.def_ident_span(self.did).unwrap())
     }
-
-    /// Returns whether the field is unnamed
-    pub fn is_unnamed(&self) -> bool {
-        self.name == rustc_span::symbol::kw::Underscore
-    }
 }
 
 #[derive(Debug, PartialEq, Eq)]
diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs
index 17280c3d047..c01d2120111 100644
--- a/compiler/rustc_middle/src/ty/typeck_results.rs
+++ b/compiler/rustc_middle/src/ty/typeck_results.rs
@@ -42,12 +42,6 @@ pub struct TypeckResults<'tcx> {
     /// belongs, but it may not exist if it's a tuple field (`tuple.0`).
     field_indices: ItemLocalMap<FieldIdx>,
 
-    /// Resolved types and indices for the nested fields' accesses of `obj.field` (expanded
-    /// to `obj._(1)._(2).field` in THIR). This map only stores the intermediate type
-    /// of `obj._(1)` and index of `_(1)._(2)`, and the type of `_(1)._(2)`, and the index of
-    /// `_(2).field`.
-    nested_fields: ItemLocalMap<Vec<(Ty<'tcx>, FieldIdx)>>,
-
     /// Stores the types for various nodes in the AST. Note that this table
     /// is not guaranteed to be populated outside inference. See
     /// typeck::check::fn_ctxt for details.
@@ -225,7 +219,6 @@ impl<'tcx> TypeckResults<'tcx> {
             hir_owner,
             type_dependent_defs: Default::default(),
             field_indices: Default::default(),
-            nested_fields: Default::default(),
             user_provided_types: Default::default(),
             user_provided_sigs: Default::default(),
             node_types: Default::default(),
@@ -299,18 +292,6 @@ impl<'tcx> TypeckResults<'tcx> {
         self.field_indices().get(id).cloned()
     }
 
-    pub fn nested_fields(&self) -> LocalTableInContext<'_, Vec<(Ty<'tcx>, FieldIdx)>> {
-        LocalTableInContext { hir_owner: self.hir_owner, data: &self.nested_fields }
-    }
-
-    pub fn nested_fields_mut(&mut self) -> LocalTableInContextMut<'_, Vec<(Ty<'tcx>, FieldIdx)>> {
-        LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.nested_fields }
-    }
-
-    pub fn nested_field_tys_and_indices(&self, id: HirId) -> &[(Ty<'tcx>, FieldIdx)] {
-        self.nested_fields().get(id).map_or(&[], Vec::as_slice)
-    }
-
     pub fn user_provided_types(&self) -> LocalTableInContext<'_, CanonicalUserType<'tcx>> {
         LocalTableInContext { hir_owner: self.hir_owner, data: &self.user_provided_types }
     }
diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs
index 2ffad0b4834..044d8045a27 100644
--- a/compiler/rustc_mir_build/src/thir/cx/expr.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs
@@ -807,21 +807,11 @@ impl<'tcx> Cx<'tcx> {
                 });
                 ExprKind::Loop { body }
             }
-            hir::ExprKind::Field(source, ..) => {
-                let mut kind = ExprKind::Field {
-                    lhs: self.mirror_expr(source),
-                    variant_index: FIRST_VARIANT,
-                    name: self.typeck_results.field_index(expr.hir_id),
-                };
-                let nested_field_tys_and_indices =
-                    self.typeck_results.nested_field_tys_and_indices(expr.hir_id);
-                for &(ty, idx) in nested_field_tys_and_indices {
-                    let expr = Expr { temp_lifetime, ty, span: source.span, kind };
-                    let lhs = self.thir.exprs.push(expr);
-                    kind = ExprKind::Field { lhs, variant_index: FIRST_VARIANT, name: idx };
-                }
-                kind
-            }
+            hir::ExprKind::Field(source, ..) => ExprKind::Field {
+                lhs: self.mirror_expr(source),
+                variant_index: FIRST_VARIANT,
+                name: self.typeck_results.field_index(expr.hir_id),
+            },
             hir::ExprKind::Cast(source, cast_ty) => {
                 // Check for a user-given type annotation on this `cast`
                 let user_provided_types = self.typeck_results.user_provided_types();
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 9fc82d84225..13681c00f8e 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -2009,9 +2009,7 @@ impl<'a> Parser<'a> {
     /// for better diagnostics and suggestions.
     fn parse_field_ident(&mut self, adt_ty: &str, lo: Span) -> PResult<'a, Ident> {
         let (ident, is_raw) = self.ident_or_err(true)?;
-        if ident.name == kw::Underscore {
-            self.psess.gated_spans.gate(sym::unnamed_fields, lo);
-        } else if matches!(is_raw, IdentIsRaw::No) && ident.is_reserved() {
+        if matches!(is_raw, IdentIsRaw::No) && ident.is_reserved() {
             let snapshot = self.create_snapshot_for_diagnostic();
             let err = if self.check_fn_front_matter(false, Case::Sensitive) {
                 let inherited_vis =
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
deleted file mode 100644
index 302a9bbeb45..00000000000
--- a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#[repr(C)]
-struct Foo {
-    foo: u8,
-    _: union { //~ ERROR unnamed fields are not yet fully implemented [E0658]
-    //~^ ERROR unnamed fields are not yet fully implemented [E0658]
-        bar: u8,
-        baz: u16
-    }
-}
-
-#[repr(C)]
-union Bar {
-    foobar: u8,
-    _: struct { //~ ERROR unnamed fields are not yet fully implemented [E0658]
-    //~^ ERROR unnamed fields are not yet fully implemented [E0658]
-        foobaz: u8,
-        barbaz: u16
-    }
-}
-
-#[repr(C)]
-struct S;
-
-#[repr(C)]
-struct Baz {
-    _: S //~ ERROR unnamed fields are not yet fully implemented [E0658]
-}
-
-fn main(){}
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
deleted file mode 100644
index bc9e95bab98..00000000000
--- a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
+++ /dev/null
@@ -1,63 +0,0 @@
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:4:5
-   |
-LL |     _: union {
-   |     ^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:4:8
-   |
-LL |       _: union {
-   |  ________^
-LL | |
-LL | |         bar: u8,
-LL | |         baz: u16
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:14:5
-   |
-LL |     _: struct {
-   |     ^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:14:8
-   |
-LL |       _: struct {
-   |  ________^
-LL | |
-LL | |         foobaz: u8,
-LL | |         barbaz: u16
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:26:5
-   |
-LL |     _: S
-   |     ^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: aborting due to 5 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs
deleted file mode 100644
index 00f9bfd5cdf..00000000000
--- a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![crate_type = "lib"]
-#![feature(unnamed_fields)]
-#![allow(unused, incomplete_features)]
-
-enum K {
-    M {
-        _ : struct { field: u8 },
-        //~^ error: unnamed fields are not allowed outside of structs or unions
-        //~| error: anonymous structs are not allowed outside of unnamed struct or union fields
-    }
-}
diff --git a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr b/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr
deleted file mode 100644
index 43843141e2e..00000000000
--- a/tests/ui/union/unnamed-fields/anon-struct-in-enum-issue-121446.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/anon-struct-in-enum-issue-121446.rs:7:9
-   |
-LL |         _ : struct { field: u8 },
-   |         -^^^^^^^^^^^^^^^^^^^^^^^
-   |         |
-   |         unnamed field declared here
-
-error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/anon-struct-in-enum-issue-121446.rs:7:13
-   |
-LL |         _ : struct { field: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/union/unnamed-fields/auxiliary/dep.rs b/tests/ui/union/unnamed-fields/auxiliary/dep.rs
deleted file mode 100644
index a11f3e18f52..00000000000
--- a/tests/ui/union/unnamed-fields/auxiliary/dep.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#[repr(C)]
-pub struct GoodStruct(());
-
-pub struct BadStruct(());
-
-pub enum BadEnum {
-    A,
-    B,
-}
-
-#[repr(C)]
-pub enum BadEnum2 {
-    A,
-    B,
-}
-
-pub type GoodAlias = GoodStruct;
-pub type BadAlias = i32;
diff --git a/tests/ui/union/unnamed-fields/field_uniqueness_check.rs b/tests/ui/union/unnamed-fields/field_uniqueness_check.rs
deleted file mode 100644
index ddb951aa06c..00000000000
--- a/tests/ui/union/unnamed-fields/field_uniqueness_check.rs
+++ /dev/null
@@ -1,337 +0,0 @@
-#![allow(incomplete_features)]
-#![feature(unnamed_fields)]
-
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct Foo {
-    a: u8,
-}
-
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct Bar {
-    _: union {
-        a: u8,
-    },
-}
-
-
-// duplicated with a normal field
-#[derive(Clone, Copy)]
-#[repr(C)]
-union A {
-    // referent field
-    a: u8,
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared [E0124]
-    // nested field
-    _: struct {
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-    },
-    // more nested field
-    _: union {
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-        },
-    },
-    // nested field in a named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: struct {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a nested field
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct B {
-    _: union {
-        // referent field
-        a: u8,
-
-        // normal field (within the same anonymous adt)
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-        // nested field (within the same anonymous adt)
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-        },
-        // more nested field (within the same anonymous adt)
-        _: union {
-            _: struct {
-                a: u8, //~ ERROR field `a` is already declared [E0124]
-            },
-        },
-        // nested field in a named adt (within the same anonymous adt)
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
-        _: struct {
-            _: Foo, //~ ERROR field `a` is already declared
-            _: Bar, //~ ERROR field `a` is already declared
-        },
-    },
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared [E0124]
-    // nested field
-    _: struct {
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-    },
-    // more nested field
-    _: union {
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-        },
-    },
-    // nested field in a named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: struct {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a more nested field
-#[derive(Clone, Copy)]
-#[repr(C)]
-union C {
-    _: struct {
-        _: union {
-            // referent field
-            a: u8,
-
-            // normal field (within the same anonymous adt)
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-            // nested field (within the same anonymous adt)
-            _: struct {
-                a: u8, //~ ERROR field `a` is already declared [E0124]
-            },
-            // more nested field (within the same anonymous adt)
-            _: union {
-                _: struct {
-                    a: u8, //~ ERROR field `a` is already declared [E0124]
-                },
-            },
-            // nested field in a named adt (within the same anonymous adt)
-            _: Foo, //~ ERROR field `a` is already declared
-            _: Bar, //~ ERROR field `a` is already declared
-            // nested field in a named adt in an anoymous adt (within the same anonymous adt)
-            _: struct {
-                _: Foo, //~ ERROR field `a` is already declared
-                _: Bar, //~ ERROR field `a` is already declared
-            },
-        },
-
-        // normal field (within the direct outer anonymous adt)
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-        // nested field (within the direct outer anonymous adt)
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-        },
-        // more nested field (within the direct outer anonymous adt)
-        _: union {
-            _: struct {
-                a: u8, //~ ERROR field `a` is already declared [E0124]
-            },
-        },
-        // nested field in a named adt (within the direct outer anonymous adt)
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-        // nested field in a named adt in an anoymous adt (within the direct outer anonymous adt)
-        _: struct {
-            _: Foo, //~ ERROR field `a` is already declared
-            _: Bar, //~ ERROR field `a` is already declared
-        },
-    },
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared [E0124]
-    // nested field
-    _: union {
-        a: u8, //~ ERROR field `a` is already declared [E0124]
-    },
-    // more nested field
-    _: struct {
-        _: union {
-            a: u8, //~ ERROR field `a` is already declared [E0124]
-        },
-    },
-    // nested field in a named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: union {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a nested field in a named adt
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct D {
-    // referent field `a`
-    _: Foo,
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared
-    // nested field
-    _: union {
-        a: u8, //~ ERROR field `a` is already declared
-    },
-    // more nested field
-    _: struct {
-        _: union {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-    },
-    // nested field in another named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: union {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a nested field in a nested field of a named adt
-#[derive(Clone, Copy)]
-#[repr(C)]
-union D2 {
-    // referent field `a`
-    _: Bar,
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared
-    // nested field
-    _: union {
-        a: u8, //~ ERROR field `a` is already declared
-    },
-    // more nested field
-    _: struct {
-        _: union {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-    },
-    // nested field in another named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: union {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a nested field in a named adt in an anonymous adt
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct E {
-    _: struct {
-        // referent field `a`
-        _: Foo,
-
-        // normal field (within the same anonymous adt)
-        a: u8, //~ ERROR field `a` is already declared
-        // nested field (within the same anonymous adt)
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-        // more nested field (within the same anonymous adt)
-        _: union {
-            _: struct {
-                a: u8, //~ ERROR field `a` is already declared
-            },
-        },
-        // nested field in a named adt (within the same anonymous adt)
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
-        _: struct {
-            _: Foo, //~ ERROR field `a` is already declared
-            _: Bar, //~ ERROR field `a` is already declared
-        },
-    },
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared
-    // nested field
-    _: union {
-        a: u8, //~ ERROR field `a` is already declared
-    },
-    // more nested field
-    _: struct {
-        _: union {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-    },
-    // nested field in another named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: union {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-// duplicated with a nested field in a named adt in an anonymous adt
-#[repr(C)]
-#[derive(Clone, Copy)]
-union E2 {
-    _: struct {
-        // referent field `a`
-        _: Bar,
-
-        // normal field (within the same anonymous adt)
-        a: u8, //~ ERROR field `a` is already declared
-        // nested field (within the same anonymous adt)
-        _: struct {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-        // more nested field (within the same anonymous adt)
-        _: union {
-            _: struct {
-                a: u8, //~ ERROR field `a` is already declared
-            },
-        },
-        // nested field in a named adt (within the same anonymous adt)
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
-        _: struct {
-            _: Foo, //~ ERROR field `a` is already declared
-            _: Bar, //~ ERROR field `a` is already declared
-        },
-    },
-
-    // normal field
-    a: u8, //~ ERROR field `a` is already declared
-    // nested field
-    _: union {
-        a: u8, //~ ERROR field `a` is already declared
-    },
-    // more nested field
-    _: struct {
-        _: union {
-            a: u8, //~ ERROR field `a` is already declared
-        },
-    },
-    // nested field in another named adt
-    _: Foo, //~ ERROR field `a` is already declared
-    _: Bar, //~ ERROR field `a` is already declared
-    // nested field in a named adt in an anoymous adt
-    _: union {
-        _: Foo, //~ ERROR field `a` is already declared
-        _: Bar, //~ ERROR field `a` is already declared
-    },
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr b/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr
deleted file mode 100644
index 11978386843..00000000000
--- a/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr
+++ /dev/null
@@ -1,1734 +0,0 @@
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:27:5
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:30:9
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:31:9
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:36:13
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:40:5
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:40:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:41:5
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:41:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:44:9
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:44:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:45:9
-   |
-LL |     a: u8,
-   |     ----- `a` first declared here
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:45:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:58:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:61:13
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:66:17
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |                 a: u8,
-   |                 ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:70:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:70:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:71:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:71:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:74:13
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |             _: Foo,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:74:13
-   |
-LL |             _: Foo,
-   |             ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:75:13
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |             _: Bar,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:75:13
-   |
-LL |             _: Bar,
-   |             ^^^^^^
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:80:5
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:83:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:88:13
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:92:5
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:92:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:93:5
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:93:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:96:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:96:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:97:9
-   |
-LL |         a: u8,
-   |         ----- `a` first declared here
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:97:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:111:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:114:17
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |                 a: u8,
-   |                 ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:119:21
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |                     a: u8,
-   |                     ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:123:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             _: Foo,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:123:13
-   |
-LL |             _: Foo,
-   |             ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:124:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             _: Bar,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:124:13
-   |
-LL |             _: Bar,
-   |             ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:127:17
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |                 _: Foo,
-   |                 ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:127:17
-   |
-LL |                 _: Foo,
-   |                 ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:128:17
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |                 _: Bar,
-   |                 ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:128:17
-   |
-LL |                 _: Bar,
-   |                 ^^^^^^
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:133:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:136:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:141:17
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |                 a: u8,
-   |                 ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:145:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:145:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:146:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:146:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:149:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             _: Foo,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:149:13
-   |
-LL |             _: Foo,
-   |             ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:150:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             _: Bar,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:150:13
-   |
-LL |             _: Bar,
-   |             ^^^^^^
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:154:5
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:157:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-
-error[E0124]: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:162:13
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:166:5
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:166:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:167:5
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:167:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:170:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:170:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:171:9
-   |
-LL |             a: u8,
-   |             ----- `a` first declared here
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:171:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:183:5
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:186:9
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:191:13
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:195:5
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:195:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:196:5
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:196:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:199:9
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:199:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:200:9
-   |
-LL |     _: Foo,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:200:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:180:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:212:5
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:215:9
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:220:13
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:224:5
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:224:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:225:5
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:225:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:228:9
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:228:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:229:9
-   |
-LL |     _: Bar,
-   |     ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:229:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:209:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:242:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:245:13
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:250:17
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |                 a: u8,
-   |                 ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:254:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:254:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:255:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:255:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:258:13
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             _: Foo,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:258:13
-   |
-LL |             _: Foo,
-   |             ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:259:13
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             _: Bar,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:259:13
-   |
-LL |             _: Bar,
-   |             ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:264:5
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:267:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:272:13
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:276:5
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:276:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:277:5
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:277:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:280:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:280:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:281:9
-   |
-LL |         _: Foo,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:281:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:239:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:294:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:297:13
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:302:17
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |                 a: u8,
-   |                 ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:306:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:306:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:307:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:307:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:310:13
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             _: Foo,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:310:13
-   |
-LL |             _: Foo,
-   |             ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:311:13
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             _: Bar,
-   |             ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:311:13
-   |
-LL |             _: Bar,
-   |             ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:316:5
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     a: u8,
-   |     ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:319:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         a: u8,
-   |         ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:324:13
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |             a: u8,
-   |             ^^^^^ field already declared
-   |
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:328:5
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     _: Foo,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:328:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:329:5
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |     _: Bar,
-   |     ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:329:5
-   |
-LL |     _: Bar,
-   |     ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:332:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Foo,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:7:5
-   |
-LL |     a: u8,
-   |     ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:332:9
-   |
-LL |         _: Foo,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: field `a` is already declared
-  --> $DIR/field_uniqueness_check.rs:333:9
-   |
-LL |         _: Bar,
-   |         ------ `a` first declared here in this unnamed field
-...
-LL |         _: Bar,
-   |         ^^^^^^ field `a` declared in this unnamed field
-   |
-note: field `a` declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:333:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-note: field `a` first declared here
-  --> $DIR/field_uniqueness_check.rs:14:9
-   |
-LL |         a: u8,
-   |         ^^^^^
-help: fields from the type of this unnamed field are considered fields of the outer type
-  --> $DIR/field_uniqueness_check.rs:291:9
-   |
-LL |         _: Bar,
-   |         ^^^^^^
-
-error: aborting due to 85 previous errors
-
-For more information about this error, try `rustc --explain E0124`.
diff --git a/tests/ui/union/unnamed-fields/repr_check.rs b/tests/ui/union/unnamed-fields/repr_check.rs
deleted file mode 100644
index b50b54b20af..00000000000
--- a/tests/ui/union/unnamed-fields/repr_check.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-#![allow(incomplete_features)]
-#![feature(unnamed_fields)]
-
-struct A { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
-           //~^ NOTE struct `A` defined here
-    _: struct { //~ NOTE unnamed field defined here
-        a: i32,
-    },
-    _: struct { //~ NOTE unnamed field defined here
-        _: struct {
-            b: i32,
-        },
-    },
-}
-
-union B { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
-          //~^ NOTE union `B` defined here
-    _: union { //~ NOTE unnamed field defined here
-        a: i32,
-    },
-    _: union { //~ NOTE unnamed field defined here
-        _: union {
-            b: i32,
-        },
-    },
-}
-
-#[derive(Clone, Copy)]
-#[repr(C)]
-struct Foo {}
-
-#[derive(Clone, Copy)]
-struct Bar {}
-//~^ `Bar` defined here
-//~| `Bar` defined here
-//~| `Bar` defined here
-//~| `Bar` defined here
-
-struct C { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
-           //~^ NOTE struct `C` defined here
-    _: Foo, //~ NOTE unnamed field defined here
-}
-
-union D { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
-          //~^ NOTE union `D` defined here
-    _: Foo, //~ NOTE unnamed field defined here
-}
-
-#[repr(C)]
-struct E {
-    _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
-            //~^ NOTE unnamed field defined here
-    _: struct {
-        _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
-                //~^ NOTE unnamed field defined here
-    },
-}
-
-#[repr(C)]
-union F {
-    _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
-            //~^ NOTE unnamed field defined here
-    _: union {
-        _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
-                //~^ NOTE unnamed field defined here
-    },
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/repr_check.stderr b/tests/ui/union/unnamed-fields/repr_check.stderr
deleted file mode 100644
index 324968b1264..00000000000
--- a/tests/ui/union/unnamed-fields/repr_check.stderr
+++ /dev/null
@@ -1,152 +0,0 @@
-error: struct with unnamed fields must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:4:1
-   |
-LL | struct A {
-   | ^^^^^^^^ struct `A` defined here
-   |
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:6:5
-   |
-LL | /     _: struct {
-LL | |         a: i32,
-LL | |     },
-   | |_____^
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:9:5
-   |
-LL | /     _: struct {
-LL | |         _: struct {
-LL | |             b: i32,
-LL | |         },
-LL | |     },
-   | |_____^
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct A {
-   |
-
-error: union with unnamed fields must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:16:1
-   |
-LL | union B {
-   | ^^^^^^^ union `B` defined here
-   |
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:18:5
-   |
-LL | /     _: union {
-LL | |         a: i32,
-LL | |     },
-   | |_____^
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:21:5
-   |
-LL | /     _: union {
-LL | |         _: union {
-LL | |             b: i32,
-LL | |         },
-LL | |     },
-   | |_____^
-help: add `#[repr(C)]` to this union
-   |
-LL + #[repr(C)]
-LL | union B {
-   |
-
-error: struct with unnamed fields must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:39:1
-   |
-LL | struct C {
-   | ^^^^^^^^ struct `C` defined here
-   |
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:41:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct C {
-   |
-
-error: union with unnamed fields must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:44:1
-   |
-LL | union D {
-   | ^^^^^^^ union `D` defined here
-   |
-note: unnamed field defined here
-  --> $DIR/repr_check.rs:46:5
-   |
-LL |     _: Foo,
-   |     ^^^^^^
-help: add `#[repr(C)]` to this union
-   |
-LL + #[repr(C)]
-LL | union D {
-   |
-
-error: named type of unnamed field must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:51:5
-   |
-LL | struct Bar {}
-   | ---------- `Bar` defined here
-...
-LL |     _: Bar,
-   |     ^^^^^^ unnamed field defined here
-   |
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct Bar {}
-   |
-
-error: named type of unnamed field must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:54:9
-   |
-LL | struct Bar {}
-   | ---------- `Bar` defined here
-...
-LL |         _: Bar,
-   |         ^^^^^^ unnamed field defined here
-   |
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct Bar {}
-   |
-
-error: named type of unnamed field must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:61:5
-   |
-LL | struct Bar {}
-   | ---------- `Bar` defined here
-...
-LL |     _: Bar,
-   |     ^^^^^^ unnamed field defined here
-   |
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct Bar {}
-   |
-
-error: named type of unnamed field must have `#[repr(C)]` representation
-  --> $DIR/repr_check.rs:64:9
-   |
-LL | struct Bar {}
-   | ---------- `Bar` defined here
-...
-LL |         _: Bar,
-   |         ^^^^^^ unnamed field defined here
-   |
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct Bar {}
-   |
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
deleted file mode 100644
index 03545ed7b18..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![allow(incomplete_features)]
-#![feature(unnamed_fields)]
-
-struct F {
-    field1: struct { field2: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
-    _: struct { field3: u8 },
-}
-
-struct G {
-    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
-}
-
-union H {
-    field1: struct { field2: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
-    _: struct { field3: u8 },
-}
-
-union I {
-    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
-}
-
-enum K {
-    M {
-        _ : struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
-        //~^ ERROR unnamed fields are not allowed outside of structs or unions
-    },
-    N {
-        _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
deleted file mode 100644
index 3b3890af771..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:5:13
-   |
-LL |     field1: struct { field2: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_structs.rs:10:5
-   |
-LL |     _: (u8, u8),
-   |     ^  -------- not a struct or union
-
-error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:14:13
-   |
-LL |     field1: struct { field2: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_structs.rs:19:5
-   |
-LL |     _: (u8, u8),
-   |     ^  -------- not a struct or union
-
-error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_structs.rs:24:9
-   |
-LL |         _ : struct { field: u8 },
-   |         -^^^^^^^^^^^^^^^^^^^^^^^
-   |         |
-   |         unnamed field declared here
-
-error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:24:13
-   |
-LL |         _ : struct { field: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
-
-error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_structs.rs:28:9
-   |
-LL |         _ : u8,
-   |         -^^^^^
-   |         |
-   |         unnamed field declared here
-
-error: aborting due to 7 previous errors
-
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
deleted file mode 100644
index 9ffe71b28c2..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![allow(incomplete_features)]
-#![feature(unnamed_fields)]
-
-struct F {
-    field1: union { field2: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
-    _: union { field3: u8 },
-}
-
-struct G {
-    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
-}
-
-union H {
-    field1: union { field2: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
-    _: union { field3: u8 },
-}
-
-union I {
-    _: (u8, u8), //~ ERROR unnamed fields can only have struct or union types
-}
-
-enum K {
-    M {
-        _ : union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
-        //~^ ERROR unnamed fields are not allowed outside of structs or unions
-    },
-    N {
-        _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
deleted file mode 100644
index f8679aad2d7..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:5:13
-   |
-LL |     field1: union { field2: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^ anonymous union declared here
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_unions.rs:10:5
-   |
-LL |     _: (u8, u8),
-   |     ^  -------- not a struct or union
-
-error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:14:13
-   |
-LL |     field1: union { field2: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^ anonymous union declared here
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_unions.rs:19:5
-   |
-LL |     _: (u8, u8),
-   |     ^  -------- not a struct or union
-
-error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_unions.rs:24:9
-   |
-LL |         _ : union { field: u8 },
-   |         -^^^^^^^^^^^^^^^^^^^^^^
-   |         |
-   |         unnamed field declared here
-
-error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:24:13
-   |
-LL |         _ : union { field: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
-
-error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_unions.rs:28:9
-   |
-LL |         _ : u8,
-   |         -^^^^^
-   |         |
-   |         unnamed field declared here
-
-error: aborting due to 7 previous errors
-
diff --git a/tests/ui/union/unnamed-fields/restrict_type_hir.rs b/tests/ui/union/unnamed-fields/restrict_type_hir.rs
deleted file mode 100644
index 80e4608be82..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_type_hir.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-//@ aux-build:dep.rs
-
-// test for #121151
-
-#![allow(incomplete_features)]
-#![feature(unnamed_fields)]
-
-extern crate dep;
-
-#[repr(C)]
-struct A {
-    a: u8,
-}
-
-enum BadEnum {
-    A,
-    B,
-}
-
-#[repr(C)]
-enum BadEnum2 {
-    A,
-    B,
-}
-
-type MyStruct = A;
-type MyI32 = i32;
-
-#[repr(C)]
-struct L {
-    _: i32, //~ ERROR unnamed fields can only have struct or union types
-    _: MyI32, //~ ERROR unnamed fields can only have struct or union types
-    _: BadEnum, //~ ERROR unnamed fields can only have struct or union types
-    _: BadEnum2, //~ ERROR unnamed fields can only have struct or union types
-    _: MyStruct,
-    _: dep::BadStruct, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
-    _: dep::BadEnum, //~ ERROR unnamed fields can only have struct or union types
-    _: dep::BadEnum2, //~ ERROR unnamed fields can only have struct or union types
-    _: dep::BadAlias, //~ ERROR unnamed fields can only have struct or union types
-    _: dep::GoodAlias,
-    _: dep::GoodStruct,
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/restrict_type_hir.stderr b/tests/ui/union/unnamed-fields/restrict_type_hir.stderr
deleted file mode 100644
index 3e80d7fbf5c..00000000000
--- a/tests/ui/union/unnamed-fields/restrict_type_hir.stderr
+++ /dev/null
@@ -1,62 +0,0 @@
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:31:5
-   |
-LL |     _: i32,
-   |     ^^^^^^
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:32:5
-   |
-LL |     _: MyI32,
-   |     ^^^^^^^^
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:33:5
-   |
-LL |     _: BadEnum,
-   |     ^^^^^^^^^^
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:34:5
-   |
-LL |     _: BadEnum2,
-   |     ^^^^^^^^^^^
-
-error: named type of unnamed field must have `#[repr(C)]` representation
-  --> $DIR/restrict_type_hir.rs:36:5
-   |
-LL |     _: dep::BadStruct,
-   |     ^^^^^^^^^^^^^^^^^ unnamed field defined here
-   |
-  ::: $DIR/auxiliary/dep.rs:4:1
-   |
-LL | pub struct BadStruct(());
-   | -------------------- `BadStruct` defined here
-   |
-help: add `#[repr(C)]` to this struct
-  --> $DIR/auxiliary/dep.rs:4:1
-   |
-LL + #[repr(C)]
-LL | pub struct BadStruct(());
-   |
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:37:5
-   |
-LL |     _: dep::BadEnum,
-   |     ^^^^^^^^^^^^^^^
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:38:5
-   |
-LL |     _: dep::BadEnum2,
-   |     ^^^^^^^^^^^^^^^^
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_type_hir.rs:39:5
-   |
-LL |     _: dep::BadAlias,
-   |     ^^^^^^^^^^^^^^^^
-
-error: aborting due to 8 previous errors
-
diff --git a/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.rs b/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.rs
deleted file mode 100644
index 5d15ec4cffd..00000000000
--- a/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-type NodeId = u32;
-struct Type<'a>(std::marker::PhantomData::<&'a ()>);
-
-type Ast<'ast> = &'ast AstStructure<'ast>;
-
-struct AstStructure<'ast> {
-//~^ ERROR struct with unnamed fields must have `#[repr(C)]` representation
-    id: NodeId,
-    _: AstKind<'ast>
-//~^ ERROR unnamed fields are not yet fully implemented [E0658]
-//~^^ ERROR unnamed fields can only have struct or union types
-}
-
-enum AstKind<'ast> {
-    ExprInt,
-    ExprLambda(Ast<'ast>),
-}
-
-fn compute_types<'tcx,'ast>(ast: Ast<'ast>) -> Type<'tcx>
-{
-    match ast.kind {}
-//~^ ERROR no field `kind` on type `&'ast AstStructure<'ast>` [E0609]
-}
-
-fn main() {}
diff --git a/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.stderr b/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.stderr
deleted file mode 100644
index 4ea910202de..00000000000
--- a/tests/ui/union/unnamed-fields/unnamed-enum-field-issue-121757.stderr
+++ /dev/null
@@ -1,45 +0,0 @@
-error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/unnamed-enum-field-issue-121757.rs:9:5
-   |
-LL |     _: AstKind<'ast>
-   |     ^
-   |
-   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
-   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: struct with unnamed fields must have `#[repr(C)]` representation
-  --> $DIR/unnamed-enum-field-issue-121757.rs:6:1
-   |
-LL | struct AstStructure<'ast> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ struct `AstStructure` defined here
-   |
-note: unnamed field defined here
-  --> $DIR/unnamed-enum-field-issue-121757.rs:9:5
-   |
-LL |     _: AstKind<'ast>
-   |     ^^^^^^^^^^^^^^^^
-help: add `#[repr(C)]` to this struct
-   |
-LL + #[repr(C)]
-LL | struct AstStructure<'ast> {
-   |
-
-error: unnamed fields can only have struct or union types
-  --> $DIR/unnamed-enum-field-issue-121757.rs:9:5
-   |
-LL |     _: AstKind<'ast>
-   |     ^^^^^^^^^^^^^^^^
-
-error[E0609]: no field `kind` on type `&'ast AstStructure<'ast>`
-  --> $DIR/unnamed-enum-field-issue-121757.rs:21:15
-   |
-LL |     match ast.kind {}
-   |               ^^^^ unknown field
-   |
-   = note: available fields are: `id`, `_`
-
-error: aborting due to 4 previous errors
-
-Some errors have detailed explanations: E0609, E0658.
-For more information about an error, try `rustc --explain E0609`.
diff --git a/tests/ui/unpretty/expanded-exhaustive.rs b/tests/ui/unpretty/expanded-exhaustive.rs
index 279d723a26c..b287e48e476 100644
--- a/tests/ui/unpretty/expanded-exhaustive.rs
+++ b/tests/ui/unpretty/expanded-exhaustive.rs
@@ -786,20 +786,6 @@ mod types {
         let _: (T, T);
     }
 
-    /// TyKind::AnonStruct
-    fn ty_anon_struct() {
-        struct Struct {
-            _: struct { t: T },
-        }
-    }
-
-    /// TyKind::AnonUnion
-    fn ty_anon_union() {
-        struct Struct {
-            _: union { t: T },
-        }
-    }
-
     /// TyKind::Path
     fn ty_path() {
         let _: T;
diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout
index 149659693ae..f8d09650d92 100644
--- a/tests/ui/unpretty/expanded-exhaustive.stdout
+++ b/tests/ui/unpretty/expanded-exhaustive.stdout
@@ -364,8 +364,6 @@ mod expressions {
 
 
 
-
-
         { builtin # offset_of(T, field) };
     }
     /// ExprKind::MacCall
@@ -636,22 +634,6 @@ mod types {
     fn ty_never() { let _: !; }
     /// TyKind::Tup
     fn ty_tup() { let _: (); let _: (T,); let _: (T, T); }
-    /// TyKind::AnonStruct
-    fn ty_anon_struct() {
-        struct Struct {
-            _: struct  {
-                t: T,
-            },
-        }
-    }
-    /// TyKind::AnonUnion
-    fn ty_anon_union() {
-        struct Struct {
-            _: union  {
-                t: T,
-            },
-        }
-    }
     /// TyKind::Path
     fn ty_path() {
         let _: T;