diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-12-20 21:18:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-20 21:18:59 +0100 |
| commit | d0d814ff4847afccd2a87155eb770307c859fed4 (patch) | |
| tree | 2ae766f442d1e5d0eba0e60b81fa4490b077f728 /compiler/rustc_hir_analysis | |
| parent | f6a04f693b7e012574a182b9e9b6149402458382 (diff) | |
| parent | 11337805fba24f88a00c137f6a5af1af296bd71e (diff) | |
| download | rust-d0d814ff4847afccd2a87155eb770307c859fed4.tar.gz rust-d0d814ff4847afccd2a87155eb770307c859fed4.zip | |
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`
Diffstat (limited to 'compiler/rustc_hir_analysis')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/type_of.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 688d32fa32d..d48535c82f5 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -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( diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 15d546537dd..19e7fe388aa 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -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(..) => { |
