Removed ignore-test-compare-mode-nll from hashmap-lifetimes.rs

by strengthening the test there.
This commit is contained in:
Felix S. Klock II 2018-08-15 23:33:14 +02:00
parent fb3ccb2aa2
commit f8084c675e
3 changed files with 16 additions and 1 deletions

View file

@ -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`.

View file

@ -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;
}

View file

@ -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