1
Fork 0

don't execute the first statement of a constant/static/promoted right away

This might create confusion, because attempting to execute a statement can cause
arbitrary stackframes to be added for the constants/statics/promoteds required by that
statement. Before this commit, the first statement of the last added stackframe was
executed immediately. Thus there was no way to inspect the state before that first
statement.
This commit is contained in:
Oliver Schneider 2016-06-28 15:06:44 +02:00
parent f28feed87d
commit 7d574f7b1c
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -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);
}
@ -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)
}