Skip to content

Commit e4df70e

Browse files
committed
remove the Context trait
rename the `TablesWrapper` to `Context`.
1 parent acec83d commit e4df70e

File tree

5 files changed

+184
-335
lines changed

5 files changed

+184
-335
lines changed

compiler/rustc_smir/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
pub mod rustc_internal;
2222

2323
// Make this module private for now since external users should not call these directly.
24-
mod rustc_smir;
24+
pub mod rustc_smir;
2525

2626
pub mod stable_mir;

compiler/rustc_smir/src/rustc_internal/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use stable_mir::abi::Layout;
2121
use stable_mir::compiler_interface::CompilerInterface;
2222
use stable_mir::ty::IndexedVal;
2323

24-
use crate::rustc_smir::context::TablesWrapper;
24+
use crate::rustc_smir::context::Context;
2525
use crate::rustc_smir::{Stable, Tables};
2626
use crate::stable_mir;
2727

@@ -197,7 +197,7 @@ pub fn crate_num(item: &stable_mir::Crate) -> CrateNum {
197197
// datastructures and stable MIR datastructures
198198
scoped_thread_local! (static TLV: Cell<*const ()>);
199199

200-
pub(crate) fn init<'tcx, F, T>(tables: &TablesWrapper<'tcx>, f: F) -> T
200+
pub(crate) fn init<'tcx, F, T>(tables: &Context<'tcx>, f: F) -> T
201201
where
202202
F: FnOnce() -> T,
203203
{
@@ -213,7 +213,7 @@ pub(crate) fn with_tables<R>(f: impl for<'tcx> FnOnce(&mut Tables<'tcx>) -> R) -
213213
TLV.with(|tlv| {
214214
let ptr = tlv.get();
215215
assert!(!ptr.is_null());
216-
let wrapper = ptr as *const TablesWrapper<'_>;
216+
let wrapper = ptr as *const Context<'_>;
217217
let mut tables = unsafe { (*wrapper).0.borrow_mut() };
218218
f(&mut *tables)
219219
})
@@ -223,7 +223,7 @@ pub fn run<F, T>(tcx: TyCtxt<'_>, f: F) -> Result<T, Error>
223223
where
224224
F: FnOnce() -> T,
225225
{
226-
let tables = TablesWrapper(RefCell::new(Tables {
226+
let tables = Context(RefCell::new(Tables {
227227
tcx,
228228
def_ids: IndexMap::default(),
229229
alloc_ids: IndexMap::default(),

0 commit comments

Comments
 (0)