fork/rust
git clone https://git.julia.blue/fork/rust
73528e339aa
1.40.0
1error[E0597]: `my_string` does not live long enough 2 --> $DIR/try-block-bad-lifetime.rs:15:33 3 | 4LL | let result: Result<(), &str> = try { 5 | ------ borrow later stored here 6LL | let my_string = String::from(""); 7LL | let my_str: & str = & my_string; 8 | ^^^^^^^^^^^ borrowed value does not live long enough 9... 10LL | }; 11 | - `my_string` dropped here while still borrowed 12 13error[E0506]: cannot assign to `i` because it is borrowed 14 --> $DIR/try-block-bad-lifetime.rs:29:13 15 | 16LL | let k = &mut i; 17 | ------ borrow of `i` occurs here 18... 19LL | i = 10; 20 | ^^^^^^ assignment to borrowed `i` occurs here 21LL | }; 22LL | ::std::mem::drop(k); 23 | - borrow later used here 24 25error[E0382]: use of moved value: `k` 26 --> $DIR/try-block-bad-lifetime.rs:31:26 27 | 28LL | let k = &mut i; 29 | - move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait 30LL | let mut j: Result<(), &mut i32> = try { 31LL | Err(k) ?; 32 | - value moved here 33... 34LL | ::std::mem::drop(k); 35 | ^ value used here after move 36 37error[E0506]: cannot assign to `i` because it is borrowed 38 --> $DIR/try-block-bad-lifetime.rs:32:9 39 | 40LL | let k = &mut i; 41 | ------ borrow of `i` occurs here 42... 43LL | i = 40; 44 | ^^^^^^ assignment to borrowed `i` occurs here 45LL | 46LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; 47 | - borrow later used here 48 49error: aborting due to 4 previous errors 50 51Some errors have detailed explanations: E0382, E0506, E0597. 52For more information about an error, try `rustc --explain E0382`.