1
Fork 0

Remove AdtFlags::IS_ANONYMOUS and Copy/Clone condition for anonymous ADT

This commit is contained in:
Michael Goulet 2025-03-10 02:31:16 +00:00
parent 385970f0c1
commit f525b173ed
3 changed files with 1 additions and 18 deletions

View file

@ -2231,15 +2231,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
}
}
// `Copy` and `Clone` are automatically implemented for an anonymous adt
// if all of its fields are `Copy` and `Clone`
ty::Adt(adt, args) if adt.is_anonymous() => {
// (*) binder moved here
Where(obligation.predicate.rebind(
adt.non_enum_variant().fields.iter().map(|f| f.ty(self.tcx(), args)).collect(),
))
}
ty::Adt(..) | ty::Alias(..) | ty::Param(..) | ty::Placeholder(..) => {
// Fallback to whatever user-defined impls exist in this case.
None