fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
1.4 KiB40 linesraw
1error[E0506]: cannot assign to `i` because it is borrowed
2  --> $DIR/try-block-maybe-bad-lifetime.rs:17:9
3   |
4LL |             &i
5   |             -- borrow of `i` occurs here
6LL |         };
7LL |         i = 0;
8   |         ^^^^^ assignment to borrowed `i` occurs here
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 `std::string::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
25error[E0506]: cannot assign to `i` because it is borrowed
26  --> $DIR/try-block-maybe-bad-lifetime.rs:40:9
27   |
28LL |             j = &i;
29   |                 -- borrow of `i` occurs here
30LL |         };
31LL |         i = 0;
32   |         ^^^^^ assignment to borrowed `i` occurs here
33LL |         let _ = i;
34LL |         do_something_with(j);
35   |                           - borrow later used here
36
37error: aborting due to 3 previous errors
38
39Some errors have detailed explanations: E0382, E0506.
40For more information about an error, try `rustc --explain E0382`.