Skip to content

Commit

Permalink
create localdecl and add span to it
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Sep 30, 2023
1 parent 5282e5e commit 9130484
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion compiler/rustc_smir/src/rustc_smir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ impl<'tcx> Context for Tables<'tcx> {
.collect(),
})
.collect(),
locals: mir.local_decls.iter().map(|decl| self.intern_ty(decl.ty)).collect(),
locals: mir
.local_decls
.iter()
.map(|decl| stable_mir::mir::LocalDecl {
ty: self.intern_ty(decl.ty),
span: decl.source_info.span.stable(self),
})
.collect(),
}
}

Expand Down
8 changes: 7 additions & 1 deletion compiler/stable_mir/src/mir/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ use crate::{ty::Ty, Span};
#[derive(Clone, Debug)]
pub struct Body {
pub blocks: Vec<BasicBlock>,
pub locals: Vec<Ty>,
pub locals: Vec<LocalDecl>,
}

#[derive(Clone, Debug)]
pub struct LocalDecl {
pub ty: Ty,
pub span: Span,
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 9130484

Please sign in to comment.