Skip to content

Commit f613b26

Browse files
committed
Add internal() method counterpart to stable()
Note: We do not expect to provide internalizing methods for all StableMIR constructs. They exist only to help migrating efforts to allow users to mix StableMIR and internal constructs.
1 parent 66a554b commit f613b26

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_smir/src/rustc_internal

1 file changed

+5
-1
lines changed

compiler/rustc_smir/src/rustc_internal/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ pub unsafe fn stable<'tcx, S: Stable<'tcx>>(item: &S) -> S::T {
2626
with_tables(|tables| item.stable(tables))
2727
}
2828

29+
pub unsafe fn internal<'tcx, S: RustcInternal<'tcx>>(item: &S) -> S::T {
30+
with_tables(|tables| item.internal(tables))
31+
}
32+
2933
impl<'tcx> Index<stable_mir::DefId> for Tables<'tcx> {
3034
type Output = DefId;
3135

@@ -285,7 +289,7 @@ impl<K: PartialEq + Hash + Eq, V: Copy + Debug + PartialEq + IndexedVal> Index<V
285289
/// Trait used to translate a stable construct to its rustc counterpart.
286290
///
287291
/// This is basically a mirror of [crate::rustc_smir::Stable].
288-
pub(crate) trait RustcInternal<'tcx> {
292+
pub trait RustcInternal<'tcx> {
289293
type T;
290294
fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T;
291295
}

0 commit comments

Comments
 (0)