]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
[rust.git] / src / test / ui / try-block / try-block-maybe-bad-lifetime.stderr
1 error[E0506]: cannot assign to `i` because it is borrowed
2   --> $DIR/try-block-maybe-bad-lifetime.rs:17:9
3    |
4 LL |             &i
5    |             -- borrow of `i` occurs here
6 LL |         };
7 LL |         i = 0;
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`
14   --> $DIR/try-block-maybe-bad-lifetime.rs:28:24
15    |
16 LL |         let x = String::new();
17    |             - move occurs because `x` has type `String`, which does not implement the `Copy` trait
18 ...
19 LL |             ::std::mem::drop(x);
20    |                              - value moved here
21 LL |         };
22 LL |         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)
26
27 error[E0506]: cannot assign to `i` because it is borrowed
28   --> $DIR/try-block-maybe-bad-lifetime.rs:40:9
29    |
30 LL |             j = &i;
31    |                 -- borrow of `i` occurs here
32 LL |         };
33 LL |         i = 0;
34    |         ^^^^^ assignment to borrowed `i` occurs here
35 LL |         let _ = i;
36 LL |         do_something_with(j);
37    |                           - borrow later used here
38
39 error: aborting due to 3 previous errors
40
41 Some errors have detailed explanations: E0382, E0506.
42 For more information about an error, try `rustc --explain E0382`.