Fix erroneous loop diagnostic in nll

This commit fixes the logic of detecting when a use happen in a later
iteration of where a borrow was defined

Fixes #53773
This commit is contained in:
Santiago Pastorino
2018-11-20 17:48:16 -03:00
parent cbc865defd
commit 801c3f060f
13 changed files with 205 additions and 73 deletions

View File

@@ -7,7 +7,7 @@ LL | foo.mutate();
| ^^^^^^^^^^^^ mutable borrow occurs here
LL | //~^ ERROR cannot borrow `foo` as mutable
LL | println!("foo={:?}", *string);
| ------- immutable borrow used here, in later iteration of loop
| ------- immutable borrow later used here
error: aborting due to previous error