]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[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:27:9
3    |
4 LL |             &i
5    |             -- borrow of `i` occurs here
6 LL |         };
7 LL |         i = 0; //~ ERROR cannot assign to `i` because it is borrowed
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:38:24
15    |
16 LL |             ::std::mem::drop(x);
17    |                              - value moved here
18 LL |         };
19 LL |         println!("{}", x); //~ ERROR borrow of moved value: `x`
20    |                        ^ value borrowed here after move
21    |
22    = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
23
24 error[E0506]: cannot assign to `i` because it is borrowed
25   --> $DIR/try-block-maybe-bad-lifetime.rs:50:9
26    |
27 LL |             j = &i;
28    |                 -- borrow of `i` occurs here
29 LL |         };
30 LL |         i = 0; //~ ERROR cannot assign to `i` because it is borrowed
31    |         ^^^^^ assignment to borrowed `i` occurs here
32 LL |         let _ = i;
33 LL |         do_something_with(j);
34    |                           - borrow later used here
35
36 error: aborting due to 3 previous errors
37
38 Some errors occurred: E0382, E0506.
39 For more information about an error, try `rustc --explain E0382`.