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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user