blob: 0bd7f289340f36d6f4e77b7e7208c98bf30f9d1a (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/trait-object-nested-in-impl-trait.rs:35:31
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
| ----- this data with an anonymous lifetime `'_`...
...
LL | remaining: self.0.iter(),
| ------ ^^^^
| |
| ...is used here...
|
note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:31:23
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
| ++++
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
| ++++
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/trait-object-nested-in-impl-trait.rs:48:31
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
| ----- this data with an anonymous lifetime `'_`...
...
LL | remaining: self.0.iter(),
| ------ ^^^^
| |
| ...is used here...
|
note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:44:23
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
| ++++
error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/trait-object-nested-in-impl-trait.rs:61:31
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
| -------- this data with lifetime `'a`...
...
LL | remaining: self.0.iter(),
| ------ ^^^^
| |
| ...is used here...
|
note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:57:30
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
| ++++
error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
--> $DIR/trait-object-nested-in-impl-trait.rs:74:31
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
| -------- this data with lifetime `'a`...
...
LL | remaining: self.0.iter(),
| ------ ^^^^
| |
| ...is used here...
|
note: ...and is required to live as long as `'static` here
--> $DIR/trait-object-nested-in-impl-trait.rs:70:30
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
| ++++
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
| ++++
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0759`.
|