about summary refs log tree commit diff
path: root/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr
blob: 2407d13714a2ad555938006713e07684149f71c7 (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
error: lifetime may not live long enough
  --> $DIR/trait-object-nested-in-impl-trait.rs:27:23
   |
LL |     fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
   |             -         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
   |             |
   |             let's call the lifetime of this reference `'1`
   |
help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a bound
   |
LL |     fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lifetime may not live long enough
  --> $DIR/trait-object-nested-in-impl-trait.rs:39:9
   |
LL |       fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
   |               - let's call the lifetime of this reference `'1`
LL | /         Iter {
LL | |             current: None,
LL | |             remaining: self.0.iter(),
LL | |         }
   | |_________^ returning this value requires that `'1` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/trait-object-nested-in-impl-trait.rs:50:9
   |
LL |       fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
   |               -- lifetime `'a` defined here
LL | /         Iter {
LL | |             current: None,
LL | |             remaining: self.0.iter(),
LL | |         }
   | |_________^ returning this value requires that `'a` must outlive `'static`
   |
   = help: consider replacing `'a` with `'static`

error: lifetime may not live long enough
  --> $DIR/trait-object-nested-in-impl-trait.rs:60:30
   |
LL |     fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
   |             --               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
   |             |
   |             lifetime `'a` defined here
   |
   = help: consider replacing `'a` with `'static`
help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
   |
LL |     fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors