|
9 | 9 |
|
10 | 10 | use crate::rustc_internal::{self, opaque}; |
11 | 11 | use crate::stable_mir::mir::{CopyNonOverlapping, UserTypeProjection, VariantIdx}; |
12 | | -use crate::stable_mir::ty::{FloatTy, GenericParamDef, IntTy, Movability, RigidTy, TyKind, UintTy}; |
| 12 | +use crate::stable_mir::ty::{ |
| 13 | + FloatTy, GenericParamDef, IntTy, Movability, RigidTy, Span, TyKind, UintTy, |
| 14 | +}; |
13 | 15 | use crate::stable_mir::{self, CompilerError, Context}; |
14 | 16 | use rustc_hir as hir; |
15 | 17 | use rustc_middle::mir::interpret::{alloc_range, AllocId}; |
@@ -42,7 +44,7 @@ impl<'tcx> Context for Tables<'tcx> { |
42 | 44 | self.tcx.def_path_str(self[def_id]) |
43 | 45 | } |
44 | 46 |
|
45 | | - fn span_of_an_item(&mut self, def_id: stable_mir::DefId) -> stable_mir::ty::Span { |
| 47 | + fn span_of_an_item(&mut self, def_id: stable_mir::DefId) -> Span { |
46 | 48 | self.tcx.def_span(self[def_id]).stable(self) |
47 | 49 | } |
48 | 50 |
|
@@ -168,6 +170,7 @@ pub struct Tables<'tcx> { |
168 | 170 | pub tcx: TyCtxt<'tcx>, |
169 | 171 | pub def_ids: Vec<DefId>, |
170 | 172 | pub alloc_ids: Vec<AllocId>, |
| 173 | + pub spans: Vec<rustc_span::Span>, |
171 | 174 | pub types: Vec<MaybeStable<stable_mir::ty::TyKind, Ty<'tcx>>>, |
172 | 175 | } |
173 | 176 |
|
@@ -1497,9 +1500,8 @@ impl<'tcx> Stable<'tcx> for ty::Region<'tcx> { |
1497 | 1500 | impl<'tcx> Stable<'tcx> for rustc_span::Span { |
1498 | 1501 | type T = stable_mir::ty::Span; |
1499 | 1502 |
|
1500 | | - fn stable(&self, _: &mut Tables<'tcx>) -> Self::T { |
1501 | | - // FIXME: add a real implementation of stable spans |
1502 | | - opaque(self) |
| 1503 | + fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T { |
| 1504 | + tables.create_span(*self) |
1503 | 1505 | } |
1504 | 1506 | } |
1505 | 1507 |
|
|
0 commit comments