summaryrefslogtreecommitdiffstats
path: root/tests/ui/dst/dst-bad-coerce3.stderr
blob: 1254250bcbd85cb91a8e43b53a5f47dcccc46c50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
error[E0597]: `f1` does not live long enough
  --> $DIR/dst-bad-coerce3.rs:16:32
   |
LL | fn baz<'a>() {
   |        -- lifetime `'a` defined here
LL |     // With a vec of ints.
LL |     let f1 = Fat { ptr: [1, 2, 3] };
   |         -- binding `f1` declared here
LL |     let f2: &Fat<[isize; 3]> = &f1;
   |                                ^^^ borrowed value does not live long enough
LL |     let f3: &'a Fat<[isize]> = f2;
   |             ---------------- type annotation requires that `f1` is borrowed for `'a`
...
LL | }
   | - `f1` dropped here while still borrowed

error[E0597]: `f1` does not live long enough
  --> $DIR/dst-bad-coerce3.rs:21:25
   |
LL | fn baz<'a>() {
   |        -- lifetime `'a` defined here
...
LL |     let f1 = Fat { ptr: Foo };
   |         -- binding `f1` declared here
LL |     let f2: &Fat<Foo> = &f1;
   |                         ^^^ borrowed value does not live long enough
LL |     let f3: &'a Fat<dyn Bar> = f2;
   |             ---------------- type annotation requires that `f1` is borrowed for `'a`
...
LL | }
   | - `f1` dropped here while still borrowed

error[E0597]: `f1` does not live long enough
  --> $DIR/dst-bad-coerce3.rs:26:30
   |
LL | fn baz<'a>() {
   |        -- lifetime `'a` defined here
...
LL |     let f1 = ([1, 2, 3],);
   |         -- binding `f1` declared here
LL |     let f2: &([isize; 3],) = &f1;
   |                              ^^^ borrowed value does not live long enough
LL |     let f3: &'a ([isize],) = f2;
   |             -------------- type annotation requires that `f1` is borrowed for `'a`
...
LL | }
   | - `f1` dropped here while still borrowed

error[E0597]: `f1` does not live long enough
  --> $DIR/dst-bad-coerce3.rs:31:23
   |
LL | fn baz<'a>() {
   |        -- lifetime `'a` defined here
...
LL |     let f1 = (Foo,);
   |         -- binding `f1` declared here
LL |     let f2: &(Foo,) = &f1;
   |                       ^^^ borrowed value does not live long enough
LL |     let f3: &'a (dyn Bar,) = f2;
   |             -------------- type annotation requires that `f1` is borrowed for `'a`
LL | }
   | - `f1` dropped here while still borrowed

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0597`.