fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0506]: cannot assign to `i` because it is borrowed 2 --> $DIR/try-block-maybe-bad-lifetime.rs:17:9 3 | 4LL | &i 5 | -- `i` is borrowed here 6LL | }; 7LL | i = 0; 8 | ^^^^^ `i` is assigned to here but it was already borrowed 9LL | let _ = i; 10LL | do_something_with(x); 11 | - borrow later used here 12 13error[E0382]: borrow of moved value: `x` 14 --> $DIR/try-block-maybe-bad-lifetime.rs:28:24 15 | 16LL | let x = String::new(); 17 | - move occurs because `x` has type `String`, which does not implement the `Copy` trait 18... 19LL | ::std::mem::drop(x); 20 | - value moved here 21LL | }; 22LL | println!("{}", x); 23 | ^ value borrowed here after move 24 | 25 = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) 26help: consider cloning the value if the performance cost is acceptable 27 | 28LL | ::std::mem::drop(x.clone()); 29 | ++++++++ 30 31error[E0506]: cannot assign to `i` because it is borrowed 32 --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 33 | 34LL | j = &i; 35 | -- `i` is borrowed here 36LL | }; 37LL | i = 0; 38 | ^^^^^ `i` is assigned to here but it was already borrowed 39LL | let _ = i; 40LL | do_something_with(j); 41 | - borrow later used here 42 43error: aborting due to 3 previous errors 44 45Some errors have detailed explanations: E0382, E0506. 46For more information about an error, try `rustc --explain E0382`.