@@ -28,13 +28,18 @@ use std::fmt::Debug;
28
28
use std:: { fmt, io} ;
29
29
30
30
pub ( crate ) use rustc_smir:: IndexedVal ;
31
+ use rustc_smir:: Tables ;
32
+ use rustc_smir:: context:: SmirCtxt ;
31
33
use serde:: Serialize ;
32
34
use stable_mir:: compiler_interface:: with;
33
35
pub use stable_mir:: crate_def:: { CrateDef , CrateDefItems , CrateDefType , DefId } ;
34
36
pub use stable_mir:: error:: * ;
35
37
use stable_mir:: mir:: mono:: StaticDef ;
36
38
use 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 ;
38
43
39
44
use crate :: { rustc_smir, stable_mir} ;
40
45
@@ -277,3 +282,23 @@ impl rustc_smir::bridge::Prov<compiler_interface::BridgeTys> for stable_mir::ty:
277
282
Self ( aid)
278
283
}
279
284
}
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