diff options
| author | Celina G. Val <celinval@amazon.com> | 2023-11-17 08:05:40 -0800 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2023-11-21 19:16:58 -0800 |
| commit | 5b3cf6610b7c94d5eea715386946ba0bf564690e (patch) | |
| tree | fba1f6930bc8b415080c450d1dc9d4f5987e439a /compiler/rustc_smir/src/rustc_internal/internal.rs | |
| parent | fa5ff859e610b46b924ac17df63de69c734759f8 (diff) | |
| download | rust-5b3cf6610b7c94d5eea715386946ba0bf564690e.tar.gz rust-5b3cf6610b7c94d5eea715386946ba0bf564690e.zip | |
Add support to get virtual table allocation
Diffstat (limited to 'compiler/rustc_smir/src/rustc_internal/internal.rs')
| -rw-r--r-- | compiler/rustc_smir/src/rustc_internal/internal.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/compiler/rustc_smir/src/rustc_internal/internal.rs b/compiler/rustc_smir/src/rustc_internal/internal.rs index 988d1d7226a..fe226ef60ed 100644 --- a/compiler/rustc_smir/src/rustc_internal/internal.rs +++ b/compiler/rustc_smir/src/rustc_internal/internal.rs @@ -10,8 +10,9 @@ use rustc_span::Symbol; use stable_mir::mir::alloc::AllocId; use stable_mir::mir::mono::{Instance, MonoItem, StaticDef}; use stable_mir::ty::{ - AdtDef, Binder, BoundRegionKind, BoundTyKind, BoundVariableKind, ClosureKind, Const, FloatTy, - GenericArgKind, GenericArgs, IntTy, Region, RigidTy, TraitRef, Ty, UintTy, + AdtDef, Binder, BoundRegionKind, BoundTyKind, BoundVariableKind, ClosureKind, Const, + ExistentialTraitRef, FloatTy, GenericArgKind, GenericArgs, IntTy, Region, RigidTy, TraitRef, + Ty, UintTy, }; use stable_mir::{CrateItem, DefId}; @@ -229,6 +230,17 @@ impl<'tcx> RustcInternal<'tcx> for BoundVariableKind { } } +impl<'tcx> RustcInternal<'tcx> for ExistentialTraitRef { + type T = rustc_ty::ExistentialTraitRef<'tcx>; + + fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T { + rustc_ty::ExistentialTraitRef { + def_id: self.def_id.0.internal(tables), + args: self.generic_args.internal(tables), + } + } +} + impl<'tcx> RustcInternal<'tcx> for TraitRef { type T = rustc_ty::TraitRef<'tcx>; @@ -277,3 +289,13 @@ where (*self).internal(tables) } } +impl<'tcx, T> RustcInternal<'tcx> for Option<T> +where + T: RustcInternal<'tcx>, +{ + type T = Option<T::T>; + + fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T { + self.as_ref().map(|inner| inner.internal(tables)) + } +} |
