|
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 |
|
@@ -185,6 +187,7 @@ pub struct Tables<'tcx> { |
185 | 187 | pub tcx: TyCtxt<'tcx>, |
186 | 188 | pub def_ids: Vec<DefId>, |
187 | 189 | pub alloc_ids: Vec<AllocId>, |
| 190 | + pub spans: Vec<rustc_span::Span>, |
188 | 191 | pub types: Vec<MaybeStable<stable_mir::ty::TyKind, Ty<'tcx>>>, |
189 | 192 | } |
190 | 193 |
|
@@ -1514,9 +1517,8 @@ impl<'tcx> Stable<'tcx> for ty::Region<'tcx> { |
1514 | 1517 | impl<'tcx> Stable<'tcx> for rustc_span::Span { |
1515 | 1518 | type T = stable_mir::ty::Span; |
1516 | 1519 |
|
1517 | | - fn stable(&self, _: &mut Tables<'tcx>) -> Self::T { |
1518 | | - // FIXME: add a real implementation of stable spans |
1519 | | - opaque(self) |
| 1520 | + fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T { |
| 1521 | + tables.create_span(*self) |
1520 | 1522 | } |
1521 | 1523 | } |
1522 | 1524 |
|
|
0 commit comments