mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
Fix decoding attributes of SyntheticCoroutineBody
This commit is contained in:
@@ -1432,17 +1432,26 @@ impl CrateMetadata {
|
||||
.attributes
|
||||
.get(self, id)
|
||||
.unwrap_or_else(|| {
|
||||
// Structure and variant constructors don't have any attributes encoded for them,
|
||||
// but we assume that someone passing a constructor ID actually wants to look at
|
||||
// the attributes on the corresponding struct or variant.
|
||||
let def_key = self.def_key(id);
|
||||
assert_eq!(def_key.disambiguated_data.data, DefPathData::Ctor);
|
||||
let parent_id = def_key.parent.expect("no parent for a constructor");
|
||||
self.root
|
||||
.tables
|
||||
.attributes
|
||||
.get(self, parent_id)
|
||||
.expect("no encoded attributes for a structure or variant")
|
||||
match def_key.disambiguated_data.data {
|
||||
DefPathData::Ctor => {
|
||||
// Structure and variant constructors don't have any attributes encoded for them,
|
||||
// but we assume that someone passing a constructor ID actually wants to look at
|
||||
// the attributes on the corresponding struct or variant.
|
||||
assert_eq!(def_key.disambiguated_data.data, DefPathData::Ctor);
|
||||
let parent_id = def_key.parent.expect("no parent for a constructor");
|
||||
self.root
|
||||
.tables
|
||||
.attributes
|
||||
.get(self, parent_id)
|
||||
.expect("no encoded attributes for a structure or variant")
|
||||
}
|
||||
DefPathData::SyntheticCoroutineBody => {
|
||||
// SyntheticCoroutineBodies cannot have attributes
|
||||
LazyArray::default()
|
||||
}
|
||||
_ => panic!("Definition key {def_key:?} of type `{:?}` did not have any attributes stored", def_key.disambiguated_data.data)
|
||||
}
|
||||
})
|
||||
.decode((self, tcx))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user