Provide conversion of stable span to internal span

This will allow users to use rustc span messages to display user
friendly messages.
This commit is contained in:
Celina G. Val 2023-11-21 19:09:01 -08:00
parent d5afea51dc
commit 591b41abb8

View File

@ -11,8 +11,8 @@
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 @@ fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T {
}
}
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>,