summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-05-27 11:31:05 +0100
committerDavid Wood <david@davidtw.co>2018-05-27 11:31:05 +0100
commit0eeebe179590836cb4d9307bbc13f31e7f2f80e5 (patch)
tree7f0ada9018b819da851c67cc1470752da55438b4
parentUse precomputed DFS of borrows that out of scope at a location. (diff)
downloadgrust-0eeebe179590836cb4d9307bbc13f31e7f2f80e5.tar.gz
grust-0eeebe179590836cb4d9307bbc13f31e7f2f80e5.tar.bz2
grust-0eeebe179590836cb4d9307bbc13f31e7f2f80e5.tar.xz
Ensure that we don't skip the last statement.
-rw-r--r--src/librustc_mir/dataflow/impls/borrows.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs
index 7018ab345d..ed111c994f 100644
--- a/src/librustc_mir/dataflow/impls/borrows.rs
+++ b/src/librustc_mir/dataflow/impls/borrows.rs
@@ -70,9 +70,9 @@ fn precompute_borrows_out_of_scope<'a, 'tcx>(
70 } 70 }
71 71
72 let bb_data = &mir[location.block]; 72 let bb_data = &mir[location.block];
73 // If we are on the last statement, then check the terminator 73 // If we are past the last statement, then check the terminator
74 // to determine which location to proceed to. 74 // to determine which location to proceed to.
75 if location.statement_index == bb_data.statements.len() - 1 { 75 if location.statement_index == bb_data.statements.len() {
76 if let Some(ref terminator) = bb_data.terminator { 76 if let Some(ref terminator) = bb_data.terminator {
77 match terminator.kind { 77 match terminator.kind {
78 TerminatorKind::Goto { target } | 78 TerminatorKind::Goto { target } |