Skip to content

Commit

Permalink
Merge pull request rust-lang#38 from oli-obk/dont_step_up_to_the_const
Browse files Browse the repository at this point in the history
don't execute the first statement of a constant/static/promoted right away
  • Loading branch information
solson committed Jun 28, 2016
2 parents f28feed + 7d574f7 commit 87306f1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/interpreter/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}.visit_statement(block, stmt);
if current_stack == self.stack.len() {
self.statement(stmt)?;
} else {
// ConstantExtractor added some new frames for statics/constants/promoteds
// self.step() can't be "done", so it can't return false
assert!(self.step()?);
}
// if ConstantExtractor added new frames, we don't execute anything here
// but await the next call to step
return Ok(true);
}

Expand All @@ -58,11 +56,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}.visit_terminator(block, terminator);
if current_stack == self.stack.len() {
self.terminator(terminator)?;
} else {
// ConstantExtractor added some new frames for statics/constants/promoteds
// self.step() can't be "done", so it can't return false
assert!(self.step()?);
}
// if ConstantExtractor added new frames, we don't execute anything here
// but await the next call to step
Ok(true)
}

Expand Down

0 comments on commit 87306f1

Please sign in to comment.