@@ -18,9 +18,10 @@ use rustc_span::def_id::{CrateNum, DefId};
1818use  scoped_tls:: scoped_thread_local; 
1919use  stable_mir:: Error ; 
2020use  stable_mir:: abi:: Layout ; 
21+ use  stable_mir:: compiler_interface:: SmirInterface ; 
2122use  stable_mir:: ty:: IndexedVal ; 
2223
23- use  crate :: rustc_smir:: context:: TablesWrapper ; 
24+ use  crate :: rustc_smir:: context:: Context ; 
2425use  crate :: rustc_smir:: { Stable ,  Tables } ; 
2526use  crate :: stable_mir; 
2627
@@ -196,12 +197,12 @@ pub fn crate_num(item: &stable_mir::Crate) -> CrateNum {
196197// datastructures and stable MIR datastructures 
197198scoped_thread_local !  ( static  TLV :  Cell <* const  ( ) >) ; 
198199
199- pub ( crate )  fn  init < ' tcx ,  F ,  T > ( tables :  & TablesWrapper < ' tcx > ,  f :  F )  -> T 
200+ pub ( crate )  fn  init < ' tcx ,  F ,  T > ( cx :  & Context < ' tcx > ,  f :  F )  -> T 
200201where 
201202    F :  FnOnce ( )  -> T , 
202203{ 
203204    assert ! ( !TLV . is_set( ) ) ; 
204-     let  ptr = tables  as  * const  _  as  * const  ( ) ; 
205+     let  ptr = cx  as  * const  _  as  * const  ( ) ; 
205206    TLV . set ( & Cell :: new ( ptr) ,  || f ( ) ) 
206207} 
207208
@@ -212,8 +213,8 @@ pub(crate) fn with_tables<R>(f: impl for<'tcx> FnOnce(&mut Tables<'tcx>) -> R) -
212213    TLV . with ( |tlv| { 
213214        let  ptr = tlv. get ( ) ; 
214215        assert ! ( !ptr. is_null( ) ) ; 
215-         let  wrapper  = ptr as  * const  TablesWrapper < ' _ > ; 
216-         let  mut  tables = unsafe  {  ( * wrapper ) . 0 . borrow_mut ( )  } ; 
216+         let  context  = ptr as  * const  Context < ' _ > ; 
217+         let  mut  tables = unsafe  {  ( * context ) . 0 . borrow_mut ( )  } ; 
217218        f ( & mut  * tables) 
218219    } ) 
219220} 
@@ -222,7 +223,7 @@ pub fn run<F, T>(tcx: TyCtxt<'_>, f: F) -> Result<T, Error>
222223where 
223224    F :  FnOnce ( )  -> T , 
224225{ 
225-     let  tables = TablesWrapper ( RefCell :: new ( Tables  { 
226+     let  tables = Context ( RefCell :: new ( Tables  { 
226227        tcx, 
227228        def_ids :  IndexMap :: default ( ) , 
228229        alloc_ids :  IndexMap :: default ( ) , 
@@ -233,7 +234,12 @@ where
233234        mir_consts :  IndexMap :: default ( ) , 
234235        layouts :  IndexMap :: default ( ) , 
235236    } ) ) ; 
236-     stable_mir:: compiler_interface:: run ( & tables,  || init ( & tables,  f) ) 
237+ 
238+     let  interface = SmirInterface  {  cx :  tables } ; 
239+ 
240+     // Pass the `SmirInterface` to compiler_interface::run 
241+     // and initialize the rustc-specific TLS with tables. 
242+     stable_mir:: compiler_interface:: run ( & interface,  || init ( & interface. cx ,  f) ) 
237243} 
238244
239245/// Instantiate and run the compiler with the provided arguments and callback. 
0 commit comments