@@ -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 } ;
@@ -249,15 +249,25 @@ impl Into<DataTypeKind> for AdtKind {
249249}
250250
251251impl AdtDefData {
252+ pub ( super ) fn new_from_flags (
253+ did : DefId ,
254+ variants : IndexVec < VariantIdx , VariantDef > ,
255+ flags : AdtFlags ,
256+ repr : ReprOptions ,
257+ ) -> Self {
258+ AdtDefData { did, variants, flags, repr }
259+ }
260+
252261 /// Creates a new `AdtDefData`.
253262 pub ( super ) fn new (
254263 tcx : TyCtxt < ' _ > ,
255- did : DefId ,
264+ did : LocalDefId ,
256265 kind : AdtKind ,
257266 variants : IndexVec < VariantIdx , VariantDef > ,
258267 repr : ReprOptions ,
259268 is_anonymous : bool ,
260269 ) -> Self {
270+ let did = did. to_def_id ( ) ;
261271 debug ! (
262272 "AdtDef::new({:?}, {:?}, {:?}, {:?}, {:?})" ,
263273 did, kind, variants, repr, is_anonymous
0 commit comments