Rollup merge of #119145 - aDotInTheVoid:variantdata-struct-struct, r=compiler-errors

Give `VariantData::Struct`  named fields, to clairfy `recovered`.

Implements https://github.com/rust-lang/rust/pull/119121#discussion_r1431467066. Supersedes #119121

This way, it's clear what the bool fields means, instead of having to find where it's generated. Changes both ast and hir.

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2023-12-20 21:18:59 +01:00 committed by GitHub
commit d0d814ff48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 51 additions and 40 deletions

View file

@ -814,7 +814,7 @@ fn convert_variant(
})
.collect();
let recovered = match def {
hir::VariantData::Struct(_, r) => *r,
hir::VariantData::Struct { recovered, .. } => *recovered,
_ => false,
};
ty::VariantDef::new(

View file

@ -481,7 +481,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<Ty
},
Node::Ctor(def) | Node::Variant(Variant { data: def, .. }) => match def {
VariantData::Unit(..) | VariantData::Struct(..) => {
VariantData::Unit(..) | VariantData::Struct { .. } => {
tcx.type_of(tcx.hir().get_parent_item(hir_id)).instantiate_identity()
}
VariantData::Tuple(..) => {