Skip to content

Commit db6ce46

Browse files
committed
fix some nits
1 parent e6eaf20 commit db6ce46

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/eval_context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
453453
) -> EvalResult<'tcx> {
454454
::log_settings::settings().indentation += 1;
455455

456-
/// Return the set of locals that have a stroage annotation anywhere
456+
/// Return the set of locals that have a storage annotation anywhere
457457
fn collect_storage_annotations<'tcx>(mir: &'tcx mir::Mir<'tcx>) -> HashSet<mir::Local> {
458458
use rustc::mir::StatementKind::*;
459459

@@ -475,10 +475,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
475475
// `Value` for that.
476476
let annotated_locals = collect_storage_annotations(mir);
477477
let num_locals = mir.local_decls.len() - 1;
478-
let mut locals = Vec::with_capacity(num_locals);
478+
let mut locals = vec![None; num_locals];
479479
for i in 0..num_locals {
480480
let local = mir::Local::new(i+1);
481-
locals.push(if annotated_locals.contains(&local) { None } else { Some(Value::ByVal(PrimVal::Undef)) });
481+
if !annotated_locals.contains(&local) {
482+
locals[i] = Some(Value::ByVal(PrimVal::Undef));
483+
}
482484
}
483485

484486
self.stack.push(Frame {

src/lvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
130130
Ok(Value::ByRef(ptr))
131131
}
132132
Lvalue::Local { frame, local, field } => {
133-
Ok(self.stack[frame].get_local(local, field.map(|(i, _)| i))?)
133+
self.stack[frame].get_local(local, field.map(|(i, _)| i))
134134
}
135135
Lvalue::Global(cid) => {
136136
Ok(self.globals.get(&cid).expect("global not cached").value)

0 commit comments

Comments
 (0)