]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / suggestions / lifetimes / trait-object-nested-in-impl-trait.stderr
1 error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2 --> $DIR/trait-object-nested-in-impl-trait.rs:30:31
3 |
4 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
5 | ----- this data with an anonymous lifetime `'_`...
6 ...
7 LL | remaining: self.0.iter(),
8 | ------ ^^^^
9 | |
10 | ...is captured here...
11 |
12 note: ...and is required to live as long as `'static` here
13 --> $DIR/trait-object-nested-in-impl-trait.rs:27:23
14 |
15 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
18 |
19 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
20 | ++++
21 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
22 |
23 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
24 | ++++
25
26 error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
27 --> $DIR/trait-object-nested-in-impl-trait.rs:41:31
28 |
29 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
30 | ----- this data with an anonymous lifetime `'_`...
31 ...
32 LL | remaining: self.0.iter(),
33 | ------ ^^^^
34 | |
35 | ...is captured here...
36 |
37 note: ...and is required to live as long as `'static` here
38 --> $DIR/trait-object-nested-in-impl-trait.rs:38:23
39 |
40 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
43 |
44 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
45 | ++++
46
47 error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
48 --> $DIR/trait-object-nested-in-impl-trait.rs:52:31
49 |
50 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
51 | -------- this data with lifetime `'a`...
52 ...
53 LL | remaining: self.0.iter(),
54 | ------ ^^^^
55 | |
56 | ...is captured here...
57 |
58 note: ...and is required to live as long as `'static` here
59 --> $DIR/trait-object-nested-in-impl-trait.rs:49:30
60 |
61 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
62 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
64 |
65 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
66 | ++++
67
68 error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
69 --> $DIR/trait-object-nested-in-impl-trait.rs:63:31
70 |
71 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
72 | -------- this data with lifetime `'a`...
73 ...
74 LL | remaining: self.0.iter(),
75 | ------ ^^^^
76 | |
77 | ...is captured here...
78 |
79 note: ...and is required to live as long as `'static` here
80 --> $DIR/trait-object-nested-in-impl-trait.rs:60:30
81 |
82 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound
85 |
86 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
87 | ++++
88 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
89 |
90 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
91 | ++++
92
93 error: aborting due to 4 previous errors
94
95 For more information about this error, try `rustc --explain E0759`.