Skip to content

Commit f8084c6

Browse files
committed
Removed ignore-test-compare-mode-nll from hashmap-lifetimes.rs
by strengthening the test there.
1 parent fb3ccb2 commit f8084c6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
2+
--> $DIR/hashmap-lifetimes.rs:18:5
3+
|
4+
LL | let mut it = my_stuff.iter();
5+
| -------- immutable borrow occurs here
6+
LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow
7+
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
8+
LL | it;
9+
| -- borrow later used here
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0502`.

src/test/ui/hashmap-lifetimes.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-compare-mode-nll
11+
1212

1313
fn main() {
1414
let mut my_stuff = std::collections::HashMap::new();
1515
my_stuff.insert(0, 42);
1616

1717
let mut it = my_stuff.iter();
1818
my_stuff.insert(1, 43); //~ ERROR cannot borrow
19+
it;
1920
}

src/test/ui/hashmap-lifetimes.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | let mut it = my_stuff.iter();
55
| -------- immutable borrow occurs here
66
LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow
77
| ^^^^^^^^ mutable borrow occurs here
8+
LL | it;
89
LL | }
910
| - immutable borrow ends here
1011

0 commit comments

Comments
 (0)