Skip to content

Commit e480dcd

Browse files
committed
rename CompilerInterface to SmirInterface
1 parent e4df70e commit e480dcd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Diff for: compiler/rustc_smir/src/rustc_internal/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use rustc_span::def_id::{CrateNum, DefId};
1818
use scoped_tls::scoped_thread_local;
1919
use stable_mir::Error;
2020
use stable_mir::abi::Layout;
21-
use stable_mir::compiler_interface::CompilerInterface;
21+
use stable_mir::compiler_interface::SmirInterface;
2222
use stable_mir::ty::IndexedVal;
2323

2424
use crate::rustc_smir::context::Context;
@@ -235,9 +235,9 @@ where
235235
layouts: IndexMap::default(),
236236
}));
237237

238-
let interface = CompilerInterface { cx: tables };
238+
let interface = SmirInterface { cx: tables };
239239

240-
// Pass the `CompilerInterface` to compiler_interface::run
240+
// Pass the `SmirInterface` to compiler_interface::run
241241
// and initialize the rustc-specific TLS with tables.
242242
stable_mir::compiler_interface::run(&interface, || init(&interface.cx, f))
243243
}

Diff for: compiler/rustc_smir/src/stable_mir/compiler_interface.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ use crate::{rustc_smir, stable_mir};
3131
/// similar APIs but based on internal rustc constructs.
3232
///
3333
/// Do not use this directly. This is currently used in the macro expansion.
34-
pub struct CompilerInterface<'tcx> {
34+
pub struct SmirInterface<'tcx> {
3535
pub(crate) cx: Context<'tcx>,
3636
}
3737

38-
impl<'tcx> CompilerInterface<'tcx> {
38+
impl<'tcx> SmirInterface<'tcx> {
3939
pub fn entry_fn(&self) -> Option<CrateItem> {
4040
self.cx.entry_fn()
4141
}
@@ -461,30 +461,30 @@ impl<'tcx> CompilerInterface<'tcx> {
461461
}
462462
}
463463

464-
// A thread local variable that stores a pointer to [`CompilerInterface`].
464+
// A thread local variable that stores a pointer to [`SmirInterface`].
465465
scoped_tls::scoped_thread_local!(static TLV: Cell<*const ()>);
466466

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>
468468
where
469469
F: FnOnce() -> T,
470470
{
471471
if TLV.is_set() {
472472
Err(Error::from("StableMIR already running"))
473473
} else {
474-
let ptr: *const () = (interface as *const CompilerInterface<'tcx>) as *const ();
474+
let ptr: *const () = (interface as *const SmirInterface<'tcx>) as *const ();
475475
TLV.set(&Cell::new(ptr), || Ok(f()))
476476
}
477477
}
478478

479-
/// Execute the given function with access the [`CompilerInterface`].
479+
/// Execute the given function with access the [`SmirInterface`].
480480
///
481481
/// I.e., This function will load the current interface and calls a function with it.
482482
/// 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 {
484484
assert!(TLV.is_set());
485485
TLV.with(|tlv| {
486486
let ptr = tlv.get();
487487
assert!(!ptr.is_null());
488-
f(unsafe { &*(ptr as *const CompilerInterface<'_>) })
488+
f(unsafe { &*(ptr as *const SmirInterface<'_>) })
489489
})
490490
}

0 commit comments

Comments
 (0)