Skip to content

Commit 9130484

Browse files
committed
create localdecl and add span to it
1 parent 5282e5e commit 9130484

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ impl<'tcx> Context for Tables<'tcx> {
106106
.collect(),
107107
})
108108
.collect(),
109-
locals: mir.local_decls.iter().map(|decl| self.intern_ty(decl.ty)).collect(),
109+
locals: mir
110+
.local_decls
111+
.iter()
112+
.map(|decl| stable_mir::mir::LocalDecl {
113+
ty: self.intern_ty(decl.ty),
114+
span: decl.source_info.span.stable(self),
115+
})
116+
.collect(),
110117
}
111118
}
112119

compiler/stable_mir/src/mir/body.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ use crate::{ty::Ty, Span};
55
#[derive(Clone, Debug)]
66
pub struct Body {
77
pub blocks: Vec<BasicBlock>,
8-
pub locals: Vec<Ty>,
8+
pub locals: Vec<LocalDecl>,
9+
}
10+
11+
#[derive(Clone, Debug)]
12+
pub struct LocalDecl {
13+
pub ty: Ty,
14+
pub span: Span,
915
}
1016

1117
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)