@@ -28,13 +28,18 @@ use std::fmt::Debug;
2828use  std:: { fmt,  io} ; 
2929
3030pub ( crate )  use  rustc_smir:: IndexedVal ; 
31+ use  rustc_smir:: Tables ; 
32+ use  rustc_smir:: context:: SmirCtxt ; 
3133use  serde:: Serialize ; 
3234use  stable_mir:: compiler_interface:: with; 
3335pub  use  stable_mir:: crate_def:: { CrateDef ,  CrateDefItems ,  CrateDefType ,  DefId } ; 
3436pub  use  stable_mir:: error:: * ; 
3537use  stable_mir:: mir:: mono:: StaticDef ; 
3638use  stable_mir:: mir:: { Body ,  Mutability } ; 
37- use  stable_mir:: ty:: { AssocItem ,  FnDef ,  ForeignModuleDef ,  ImplDef ,  Span ,  TraitDef ,  Ty } ; 
39+ use  stable_mir:: ty:: { 
40+     AssocItem ,  FnDef ,  ForeignModuleDef ,  ImplDef ,  ProvenanceMap ,  Span ,  TraitDef ,  Ty , 
41+ } ; 
42+ use  stable_mir:: unstable:: Stable ; 
3843
3944use  crate :: { rustc_smir,  stable_mir} ; 
4045
@@ -277,3 +282,23 @@ impl rustc_smir::bridge::Prov<compiler_interface::BridgeTys> for stable_mir::ty:
277282        Self ( aid) 
278283    } 
279284} 
285+ 
286+ impl  rustc_smir:: bridge:: Allocation < compiler_interface:: BridgeTys >  for  stable_mir:: ty:: Allocation  { 
287+     fn  new < ' tcx > ( 
288+         bytes :  Vec < Option < u8 > > , 
289+         ptrs :  Vec < ( usize ,  rustc_middle:: mir:: interpret:: AllocId ) > , 
290+         align :  u64 , 
291+         mutability :  rustc_middle:: mir:: Mutability , 
292+         tables :  & mut  Tables < ' tcx ,  compiler_interface:: BridgeTys > , 
293+         cx :  & SmirCtxt < ' tcx ,  compiler_interface:: BridgeTys > , 
294+     )  -> Self  { 
295+         Self  { 
296+             bytes, 
297+             provenance :  ProvenanceMap  { 
298+                 ptrs :  ptrs. iter ( ) . map ( |( i,  aid) | ( * i,  tables. prov ( * aid) ) ) . collect ( ) , 
299+             } , 
300+             align, 
301+             mutability :  mutability. stable ( tables,  cx) , 
302+         } 
303+     } 
304+ } 
0 commit comments