]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0506]: cannot assign to `i` because it is borrowed |
0731742a | 2 | --> $DIR/try-block-maybe-bad-lifetime.rs:17:9 |
b7449926 XL |
3 | | |
4 | LL | &i | |
5 | | -- borrow of `i` occurs here | |
6 | LL | }; | |
532ac7d7 | 7 | LL | i = 0; |
b7449926 XL |
8 | | ^^^^^ assignment to borrowed `i` occurs here |
9 | LL | let _ = i; | |
10 | LL | do_something_with(x); | |
11 | | - borrow later used here | |
12 | ||
13 | error[E0382]: borrow of moved value: `x` | |
0731742a | 14 | --> $DIR/try-block-maybe-bad-lifetime.rs:28:24 |
b7449926 | 15 | | |
9fa01778 XL |
16 | LL | let x = String::new(); |
17 | | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait | |
18 | ... | |
b7449926 XL |
19 | LL | ::std::mem::drop(x); |
20 | | - value moved here | |
21 | LL | }; | |
532ac7d7 | 22 | LL | println!("{}", x); |
b7449926 | 23 | | ^ value borrowed here after move |
b7449926 XL |
24 | |
25 | error[E0506]: cannot assign to `i` because it is borrowed | |
0731742a | 26 | --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 |
b7449926 XL |
27 | | |
28 | LL | j = &i; | |
29 | | -- borrow of `i` occurs here | |
30 | LL | }; | |
532ac7d7 | 31 | LL | i = 0; |
b7449926 XL |
32 | | ^^^^^ assignment to borrowed `i` occurs here |
33 | LL | let _ = i; | |
34 | LL | do_something_with(j); | |
35 | | - borrow later used here | |
36 | ||
37 | error: aborting due to 3 previous errors | |
38 | ||
48663c56 | 39 | Some errors have detailed explanations: E0382, E0506. |
b7449926 | 40 | For more information about an error, try `rustc --explain E0382`. |