Skip to content

Commit

Permalink
Removed ignore-test-compare-mode-nll from hashmap-lifetimes.rs
Browse files Browse the repository at this point in the history
by strengthening the test there.
  • Loading branch information
pnkfelix committed Aug 15, 2018
1 parent fb3ccb2 commit f8084c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/test/ui/hashmap-lifetimes.nll.stderr
Original file line number Diff line number Diff line change
@@ -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`.
3 changes: 2 additions & 1 deletion src/test/ui/hashmap-lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
// 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();
my_stuff.insert(0, 42);

let mut it = my_stuff.iter();
my_stuff.insert(1, 43); //~ ERROR cannot borrow
it;
}
1 change: 1 addition & 0 deletions src/test/ui/hashmap-lifetimes.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f8084c6

Please sign in to comment.