| error[E0597]: `my_string` does not live long enough |
| --> $DIR/catch-bad-lifetime.rs:20:35 |
| | |
| LL | let my_str: & str = & my_string; |
| | ^^^^^^^^^ borrowed value does not live long enough |
| ... |
| LL | }; |
| | - `my_string` dropped here while still borrowed |
| LL | } |
| | - borrowed value needs to live until here |
| |
| error[E0506]: cannot assign to `i` because it is borrowed |
| --> $DIR/catch-bad-lifetime.rs:33:13 |
| | |
| LL | let k = &mut i; |
| | - borrow of `i` occurs here |
| ... |
| LL | i = 10; //~ ERROR cannot assign to `i` because it is borrowed |
| | ^^^^^^ assignment to borrowed `i` occurs here |
| |
| error[E0382]: use of moved value: `k` |
| --> $DIR/catch-bad-lifetime.rs:35:26 |
| | |
| LL | Err(k) ?; |
| | - value moved here |
| ... |
| LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` |
| | ^ value used here after move |
| | |
| = note: move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait |
| |
| error[E0506]: cannot assign to `i` because it is borrowed |
| --> $DIR/catch-bad-lifetime.rs:36:9 |
| | |
| LL | let k = &mut i; |
| | - borrow of `i` occurs here |
| ... |
| LL | i = 40; //~ ERROR cannot assign to `i` because it is borrowed |
| | ^^^^^^ assignment to borrowed `i` occurs here |
| |
| error: aborting due to 4 previous errors |
| |
| Some errors occurred: E0382, E0506, E0597. |
| For more information about an error, try `rustc --explain E0382`. |