Ensure that we don't skip the last statement.

This commit is contained in:
David Wood 2018-05-27 11:31:05 +01:00
parent bbcace5080
commit 0eeebe1795
No known key found for this signature in database
GPG Key ID: 01760B4F9F53F154

View File

@ -70,9 +70,9 @@ fn precompute_borrows_out_of_scope<'a, 'tcx>(
}
let bb_data = &mir[location.block];
// If we are on the last statement, then check the terminator
// If we are past the last statement, then check the terminator
// to determine which location to proceed to.
if location.statement_index == bb_data.statements.len() - 1 {
if location.statement_index == bb_data.statements.len() {
if let Some(ref terminator) = bb_data.terminator {
match terminator.kind {
TerminatorKind::Goto { target } |