Skip to content

Commit 591b41a

Browse files
committed
Provide conversion of stable span to internal span
This will allow users to use rustc span messages to display user friendly messages.
1 parent d5afea5 commit 591b41a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

compiler/rustc_smir/src/rustc_internal/internal.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use stable_mir::mir::alloc::AllocId;
1111
use stable_mir::mir::mono::{Instance, MonoItem, StaticDef};
1212
use stable_mir::ty::{
1313
AdtDef, Binder, BoundRegionKind, BoundTyKind, BoundVariableKind, ClosureKind, Const,
14-
ExistentialTraitRef, FloatTy, GenericArgKind, GenericArgs, IntTy, Region, RigidTy, TraitRef,
15-
Ty, UintTy,
14+
ExistentialTraitRef, FloatTy, GenericArgKind, GenericArgs, IntTy, Region, RigidTy, Span,
15+
TraitRef, Ty, UintTy,
1616
};
1717
use stable_mir::{CrateItem, DefId};
1818

@@ -279,6 +279,14 @@ impl<'tcx> RustcInternal<'tcx> for AdtDef {
279279
}
280280
}
281281

282+
impl<'tcx> RustcInternal<'tcx> for Span {
283+
type T = rustc_span::Span;
284+
285+
fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T {
286+
tables[*self]
287+
}
288+
}
289+
282290
impl<'tcx, T> RustcInternal<'tcx> for &T
283291
where
284292
T: RustcInternal<'tcx>,

0 commit comments

Comments
 (0)