1
Fork 0

Check representation of unnamed fields

This commit is contained in:
Frank King 2024-01-06 18:22:37 +08:00
parent 7d012e8f19
commit 7660d6bf2c
12 changed files with 309 additions and 30 deletions

View file

@ -997,7 +997,11 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
};
let is_anonymous = item.ident.name == kw::Empty;
let repr = tcx.repr_options_of_def(def_id.to_def_id());
let repr = if is_anonymous {
tcx.adt_def(tcx.local_parent(def_id)).repr()
} else {
tcx.repr_options_of_def(def_id.to_def_id())
};
let (kind, variants) = match &item.kind {
ItemKind::Enum(def, _) => {
let mut distance_from_explicit = 0;