]> git.lizzy.rs Git - rust.git/blob - src/test/ui/dst/dst-bad-coerce3.nll.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / dst / dst-bad-coerce3.nll.stderr
1 error[E0597]: `f1` does not live long enough
2   --> $DIR/dst-bad-coerce3.rs:16:32
3    |
4 LL | fn baz<'a>() {
5    |        -- lifetime `'a` defined here
6 ...
7 LL |     let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough
8    |                                ^^^ borrowed value does not live long enough
9 LL |     let f3: &'a Fat<[isize]> = f2;
10    |             ---------------- type annotation requires that `f1` is borrowed for `'a`
11 ...
12 LL | }
13    | - `f1` dropped here while still borrowed
14
15 error[E0597]: `f1` does not live long enough
16   --> $DIR/dst-bad-coerce3.rs:21:25
17    |
18 LL | fn baz<'a>() {
19    |        -- lifetime `'a` defined here
20 ...
21 LL |     let f2: &Fat<Foo> = &f1; //~ ERROR `f1` does not live long enough
22    |                         ^^^ borrowed value does not live long enough
23 LL |     let f3: &'a Fat<Bar> = f2;
24    |             ------------ type annotation requires that `f1` is borrowed for `'a`
25 ...
26 LL | }
27    | - `f1` dropped here while still borrowed
28
29 error[E0597]: `f1` does not live long enough
30   --> $DIR/dst-bad-coerce3.rs:26:30
31    |
32 LL | fn baz<'a>() {
33    |        -- lifetime `'a` defined here
34 ...
35 LL |     let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough
36    |                              ^^^ borrowed value does not live long enough
37 LL |     let f3: &'a ([isize],) = f2;
38    |             -------------- type annotation requires that `f1` is borrowed for `'a`
39 ...
40 LL | }
41    | - `f1` dropped here while still borrowed
42
43 error[E0597]: `f1` does not live long enough
44   --> $DIR/dst-bad-coerce3.rs:31:23
45    |
46 LL | fn baz<'a>() {
47    |        -- lifetime `'a` defined here
48 ...
49 LL |     let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough
50    |                       ^^^ borrowed value does not live long enough
51 LL |     let f3: &'a (Bar,) = f2;
52    |             ---------- type annotation requires that `f1` is borrowed for `'a`
53 LL | }
54    | - `f1` dropped here while still borrowed
55
56 error: aborting due to 4 previous errors
57
58 For more information about this error, try `rustc --explain E0597`.