]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hashmap-iter-value-lifetime.nll.stderr
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / hashmap-iter-value-lifetime.nll.stderr
1 error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
2   --> $DIR/hashmap-iter-value-lifetime.rs:17:5
3    |
4 LL |     let (_, thing) = my_stuff.iter().next().unwrap();
5    |                      -------- immutable borrow occurs here
6 LL | 
7 LL |     my_stuff.clear(); //~ ERROR cannot borrow
8    |     ^^^^^^^^^^^^^^^^ mutable borrow occurs here
9 LL | 
10 LL |     println!("{}", *thing);
11    |                    ------ borrow later used here
12
13 error: aborting due to previous error
14
15 For more information about this error, try `rustc --explain E0502`.