@@ -9,7 +9,7 @@ use rustc_data_structures::stable_hasher::HashingControls;
99use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
1010use rustc_errors:: ErrorGuaranteed ;
1111use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
12- use rustc_hir:: def_id:: DefId ;
12+ use rustc_hir:: def_id:: { DefId , LocalDefId } ;
1313use rustc_hir:: { self as hir, LangItem } ;
1414use rustc_index:: { IndexSlice , IndexVec } ;
1515use rustc_macros:: { HashStable , TyDecodable , TyEncodable } ;
@@ -253,15 +253,25 @@ impl Into<DataTypeKind> for AdtKind {
253253}
254254
255255impl AdtDefData {
256+ pub ( super ) fn new_from_flags (
257+ did : DefId ,
258+ variants : IndexVec < VariantIdx , VariantDef > ,
259+ flags : AdtFlags ,
260+ repr : ReprOptions ,
261+ ) -> Self {
262+ AdtDefData { did, variants, flags, repr }
263+ }
264+
256265 /// Creates a new `AdtDefData`.
257266 pub ( super ) fn new (
258267 tcx : TyCtxt < ' _ > ,
259- did : DefId ,
268+ did : LocalDefId ,
260269 kind : AdtKind ,
261270 variants : IndexVec < VariantIdx , VariantDef > ,
262271 repr : ReprOptions ,
263272 is_anonymous : bool ,
264273 ) -> Self {
274+ let did = did. to_def_id ( ) ;
265275 debug ! (
266276 "AdtDef::new({:?}, {:?}, {:?}, {:?}, {:?})" ,
267277 did, kind, variants, repr, is_anonymous
0 commit comments