diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr new file mode 100644 index 000000000000..943b684fe8d7 --- /dev/null +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -0,0 +1,13 @@ +error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable + --> $DIR/hashmap-lifetimes.rs:18:5 + | +LL | let mut it = my_stuff.iter(); + | -------- immutable borrow occurs here +LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow + | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here +LL | it; + | -- borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/hashmap-lifetimes.rs b/src/test/ui/hashmap-lifetimes.rs index 9418c34cbfda..eb7404e7b780 100644 --- a/src/test/ui/hashmap-lifetimes.rs +++ b/src/test/ui/hashmap-lifetimes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-compare-mode-nll + fn main() { let mut my_stuff = std::collections::HashMap::new(); @@ -16,4 +16,5 @@ fn main() { let mut it = my_stuff.iter(); my_stuff.insert(1, 43); //~ ERROR cannot borrow + it; } diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr index eb129848ed2d..187c98ab298b 100644 --- a/src/test/ui/hashmap-lifetimes.stderr +++ b/src/test/ui/hashmap-lifetimes.stderr @@ -5,6 +5,7 @@ LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow | ^^^^^^^^ mutable borrow occurs here +LL | it; LL | } | - immutable borrow ends here