]> git.lizzy.rs Git - rust.git/commitdiff
Ensure that we don't skip the last statement.
authorDavid Wood <david@davidtw.co>
Sun, 27 May 2018 10:31:05 +0000 (11:31 +0100)
committerDavid Wood <david@davidtw.co>
Sun, 27 May 2018 10:31:05 +0000 (11:31 +0100)
src/librustc_mir/dataflow/impls/borrows.rs

index 7018ab345db4357618c0348eba8b5604a49711f0..ed111c994f41a52495b4d608cfacf1817e56fc0f 100644 (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 } |