@@ -31,11 +31,11 @@ use crate::{rustc_smir, stable_mir};
31
31
/// similar APIs but based on internal rustc constructs.
32
32
///
33
33
/// Do not use this directly. This is currently used in the macro expansion.
34
- pub struct CompilerInterface < ' tcx > {
34
+ pub struct SmirInterface < ' tcx > {
35
35
pub ( crate ) cx : Context < ' tcx > ,
36
36
}
37
37
38
- impl < ' tcx > CompilerInterface < ' tcx > {
38
+ impl < ' tcx > SmirInterface < ' tcx > {
39
39
pub fn entry_fn ( & self ) -> Option < CrateItem > {
40
40
self . cx . entry_fn ( )
41
41
}
@@ -461,30 +461,30 @@ impl<'tcx> CompilerInterface<'tcx> {
461
461
}
462
462
}
463
463
464
- // A thread local variable that stores a pointer to [`CompilerInterface `].
464
+ // A thread local variable that stores a pointer to [`SmirInterface `].
465
465
scoped_tls:: scoped_thread_local!( static TLV : Cell <* const ( ) >) ;
466
466
467
- pub fn run < ' tcx , T , F > ( interface : & CompilerInterface < ' tcx > , f : F ) -> Result < T , Error >
467
+ pub fn run < ' tcx , T , F > ( interface : & SmirInterface < ' tcx > , f : F ) -> Result < T , Error >
468
468
where
469
469
F : FnOnce ( ) -> T ,
470
470
{
471
471
if TLV . is_set ( ) {
472
472
Err ( Error :: from ( "StableMIR already running" ) )
473
473
} else {
474
- let ptr: * const ( ) = ( interface as * const CompilerInterface < ' tcx > ) as * const ( ) ;
474
+ let ptr: * const ( ) = ( interface as * const SmirInterface < ' tcx > ) as * const ( ) ;
475
475
TLV . set ( & Cell :: new ( ptr) , || Ok ( f ( ) ) )
476
476
}
477
477
}
478
478
479
- /// Execute the given function with access the [`CompilerInterface `].
479
+ /// Execute the given function with access the [`SmirInterface `].
480
480
///
481
481
/// I.e., This function will load the current interface and calls a function with it.
482
482
/// Do not nest these, as that will ICE.
483
- pub ( crate ) fn with < R > ( f : impl FnOnce ( & CompilerInterface < ' _ > ) -> R ) -> R {
483
+ pub ( crate ) fn with < R > ( f : impl FnOnce ( & SmirInterface < ' _ > ) -> R ) -> R {
484
484
assert ! ( TLV . is_set( ) ) ;
485
485
TLV . with ( |tlv| {
486
486
let ptr = tlv. get ( ) ;
487
487
assert ! ( !ptr. is_null( ) ) ;
488
- f ( unsafe { & * ( ptr as * const CompilerInterface < ' _ > ) } )
488
+ f ( unsafe { & * ( ptr as * const SmirInterface < ' _ > ) } )
489
489
} )
490
490
}
0 commit comments