fix some nits
This commit is contained in:
parent
e6eaf2083a
commit
db6ce463fe
2 changed files with 6 additions and 4 deletions
|
@ -453,7 +453,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
) -> EvalResult<'tcx> {
|
) -> EvalResult<'tcx> {
|
||||||
::log_settings::settings().indentation += 1;
|
::log_settings::settings().indentation += 1;
|
||||||
|
|
||||||
/// Return the set of locals that have a stroage annotation anywhere
|
/// Return the set of locals that have a storage annotation anywhere
|
||||||
fn collect_storage_annotations<'tcx>(mir: &'tcx mir::Mir<'tcx>) -> HashSet<mir::Local> {
|
fn collect_storage_annotations<'tcx>(mir: &'tcx mir::Mir<'tcx>) -> HashSet<mir::Local> {
|
||||||
use rustc::mir::StatementKind::*;
|
use rustc::mir::StatementKind::*;
|
||||||
|
|
||||||
|
@ -475,10 +475,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
// `Value` for that.
|
// `Value` for that.
|
||||||
let annotated_locals = collect_storage_annotations(mir);
|
let annotated_locals = collect_storage_annotations(mir);
|
||||||
let num_locals = mir.local_decls.len() - 1;
|
let num_locals = mir.local_decls.len() - 1;
|
||||||
let mut locals = Vec::with_capacity(num_locals);
|
let mut locals = vec![None; num_locals];
|
||||||
for i in 0..num_locals {
|
for i in 0..num_locals {
|
||||||
let local = mir::Local::new(i+1);
|
let local = mir::Local::new(i+1);
|
||||||
locals.push(if annotated_locals.contains(&local) { None } else { Some(Value::ByVal(PrimVal::Undef)) });
|
if !annotated_locals.contains(&local) {
|
||||||
|
locals[i] = Some(Value::ByVal(PrimVal::Undef));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.stack.push(Frame {
|
self.stack.push(Frame {
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
Ok(Value::ByRef(ptr))
|
Ok(Value::ByRef(ptr))
|
||||||
}
|
}
|
||||||
Lvalue::Local { frame, local, field } => {
|
Lvalue::Local { frame, local, field } => {
|
||||||
Ok(self.stack[frame].get_local(local, field.map(|(i, _)| i))?)
|
self.stack[frame].get_local(local, field.map(|(i, _)| i))
|
||||||
}
|
}
|
||||||
Lvalue::Global(cid) => {
|
Lvalue::Global(cid) => {
|
||||||
Ok(self.globals.get(&cid).expect("global not cached").value)
|
Ok(self.globals.get(&cid).expect("global not cached").value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue