about summary refs log tree commit diff
path: root/compiler/rustc_smir
diff options
context:
space:
mode:
authorCelina G. Val <celinval@amazon.com>2023-10-23 12:02:17 -0700
committerCelina G. Val <celinval@amazon.com>2023-10-23 12:11:07 -0700
commitf613b26cfbfea5d7b1afbbad57be8e5774669775 (patch)
treeab78d0eb176d6c09b77da0646d1dcb74458ec765 /compiler/rustc_smir
parent66a554b04539a1319c68b3d52c7c3e027208dfec (diff)
downloadrust-f613b26cfbfea5d7b1afbbad57be8e5774669775.tar.gz
rust-f613b26cfbfea5d7b1afbbad57be8e5774669775.zip
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.
Diffstat (limited to 'compiler/rustc_smir')
-rw-r--r--compiler/rustc_smir/src/rustc_internal/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs
index 7bec946788b..58cdcd49087 100644
--- a/compiler/rustc_smir/src/rustc_internal/mod.rs
+++ b/compiler/rustc_smir/src/rustc_internal/mod.rs
@@ -26,6 +26,10 @@ pub unsafe fn stable<'tcx, S: Stable<'tcx>>(item: &S) -> S::T {
     with_tables(|tables| item.stable(tables))
 }
 
+pub unsafe fn internal<'tcx, S: RustcInternal<'tcx>>(item: &S) -> S::T {
+    with_tables(|tables| item.internal(tables))
+}
+
 impl<'tcx> Index<stable_mir::DefId> for Tables<'tcx> {
     type Output = DefId;
 
@@ -285,7 +289,7 @@ impl<K: PartialEq + Hash + Eq, V: Copy + Debug + PartialEq + IndexedVal> Index<V
 /// Trait used to translate a stable construct to its rustc counterpart.
 ///
 /// This is basically a mirror of [crate::rustc_smir::Stable].
-pub(crate) trait RustcInternal<'tcx> {
+pub trait RustcInternal<'tcx> {
     type T;
     fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T;
 }