Auto merge of #37095 - petrochenkov:metactor, r=alexcrichton
Temporary fix for metadata decoding for struct constructors Same as https://github.com/rust-lang/rust/pull/37078, but for nightly. Ideally, metadata lookup functions should "just work" for constructor ids, but this fixes the issue as well. Fixes https://github.com/rust-lang/rust/issues/37026 r? @alexcrichton
This commit is contained in:
commit
a29c49f5cc
2 changed files with 23 additions and 1 deletions
|
|
@ -2323,7 +2323,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
let enum_did = self.parent_def_id(did).unwrap();
|
||||
self.lookup_adt_def(enum_did).variant_with_id(did)
|
||||
}
|
||||
Def::Struct(did) | Def::StructCtor(did, ..) | Def::Union(did) => {
|
||||
Def::Struct(did) | Def::Union(did) => {
|
||||
self.lookup_adt_def(did).struct_variant()
|
||||
}
|
||||
Def::StructCtor(ctor_did, ..) => {
|
||||
let did = self.parent_def_id(ctor_did).expect("struct ctor has no parent");
|
||||
self.lookup_adt_def(did).struct_variant()
|
||||
}
|
||||
_ => bug!("expect_variant_def used with unexpected def {:?}", def)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue