Skip to content

Commit 71cb3b2

Browse files
authored
Rollup merge of rust-lang#138296 - compiler-errors:deanonymous, r=lcnr
Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT cc rust-lang#131045, which removed anonymous ADTs from the compiler I forgot more stuff I guess.
2 parents c376c91 + f525b17 commit 71cb3b2

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

Diff for: compiler/rustc_middle/src/ty/adt.rs

-8
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ bitflags::bitflags! {
5353
const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 8;
5454
/// Indicates whether the type is `UnsafeCell`.
5555
const IS_UNSAFE_CELL = 1 << 9;
56-
/// Indicates whether the type is anonymous.
57-
const IS_ANONYMOUS = 1 << 10;
5856
}
5957
}
6058
rustc_data_structures::external_bitflags_debug! { AdtFlags }
@@ -402,12 +400,6 @@ impl<'tcx> AdtDef<'tcx> {
402400
self.flags().contains(AdtFlags::IS_MANUALLY_DROP)
403401
}
404402

405-
/// Returns `true` if this is an anonymous adt
406-
#[inline]
407-
pub fn is_anonymous(self) -> bool {
408-
self.flags().contains(AdtFlags::IS_ANONYMOUS)
409-
}
410-
411403
/// Returns `true` if this type has a destructor.
412404
pub fn has_dtor(self, tcx: TyCtxt<'tcx>) -> bool {
413405
self.destructor(tcx).is_some()

Diff for: compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ pub struct VariantDef {
11511151
/// `DefId` that identifies the variant's constructor.
11521152
/// If this variant is a struct variant, then this is `None`.
11531153
pub ctor: Option<(CtorKind, DefId)>,
1154-
/// Variant or struct name, maybe empty for anonymous adt (struct or union).
1154+
/// Variant or struct name.
11551155
pub name: Symbol,
11561156
/// Discriminant of this variant.
11571157
pub discr: VariantDiscr,

Diff for: compiler/rustc_trait_selection/src/traits/select/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -2231,15 +2231,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
22312231
}
22322232
}
22332233

2234-
// `Copy` and `Clone` are automatically implemented for an anonymous adt
2235-
// if all of its fields are `Copy` and `Clone`
2236-
ty::Adt(adt, args) if adt.is_anonymous() => {
2237-
// (*) binder moved here
2238-
Where(obligation.predicate.rebind(
2239-
adt.non_enum_variant().fields.iter().map(|f| f.ty(self.tcx(), args)).collect(),
2240-
))
2241-
}
2242-
22432234
ty::Adt(..) | ty::Alias(..) | ty::Param(..) | ty::Placeholder(..) => {
22442235
// Fallback to whatever user-defined impls exist in this case.
22452236
None

0 commit comments

Comments
 (0)