diff options
| author | Celina G. Val <celinval@amazon.com> | 2023-11-21 19:09:01 -0800 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2023-11-22 07:32:56 -0800 |
| commit | 591b41abb8d2c6e7b0798ad658e3cc49bc92b2df (patch) | |
| tree | efcda485afc0eddc3f244e7b5471e959983df011 | |
| parent | d5afea51dc5e3b9d8898e5ae176d71224566d956 (diff) | |
| download | rust-591b41abb8d2c6e7b0798ad658e3cc49bc92b2df.tar.gz rust-591b41abb8d2c6e7b0798ad658e3cc49bc92b2df.zip | |
Provide conversion of stable span to internal span
This will allow users to use rustc span messages to display user friendly messages.
| -rw-r--r-- | compiler/rustc_smir/src/rustc_internal/internal.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_smir/src/rustc_internal/internal.rs b/compiler/rustc_smir/src/rustc_internal/internal.rs index fe226ef60ed..202ca1b156a 100644 --- a/compiler/rustc_smir/src/rustc_internal/internal.rs +++ b/compiler/rustc_smir/src/rustc_internal/internal.rs @@ -11,8 +11,8 @@ 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, - ExistentialTraitRef, FloatTy, GenericArgKind, GenericArgs, IntTy, Region, RigidTy, TraitRef, - Ty, UintTy, + ExistentialTraitRef, FloatTy, GenericArgKind, GenericArgs, IntTy, Region, RigidTy, Span, + TraitRef, Ty, UintTy, }; use stable_mir::{CrateItem, DefId}; @@ -279,6 +279,14 @@ impl<'tcx> RustcInternal<'tcx> for AdtDef { } } +impl<'tcx> RustcInternal<'tcx> for Span { + type T = rustc_span::Span; + + fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T { + tables[*self] + } +} + impl<'tcx, T> RustcInternal<'tcx> for &T where T: RustcInternal<'tcx>, |
