]> git.proxmox.com Git - rustc.git/blame - src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.stderr
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / suggestions / lifetimes / trait-object-nested-in-impl-trait.stderr
CommitLineData
923072b8
FG
1error: lifetime may not live long enough
2 --> $DIR/trait-object-nested-in-impl-trait.rs:28:9
3 |
4LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
5 | - let's call the lifetime of this reference `'1`
6LL | / Iter {
7LL | |
8LL | | current: None,
9LL | | remaining: self.0.iter(),
10LL | | }
11 | |_________^ returning this value requires that `'1` must outlive `'static`
f035d41b 12 |
2b03887a 13help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'_` lifetime bound
f035d41b
XL
14 |
15LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
94222f64 16 | ++++
f035d41b
XL
17help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
18 |
19LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
94222f64 20 | ++++
f035d41b 21
923072b8
FG
22error: lifetime may not live long enough
23 --> $DIR/trait-object-nested-in-impl-trait.rs:40:9
24 |
25LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
26 | - let's call the lifetime of this reference `'1`
27LL | / Iter {
28LL | |
29LL | | current: None,
30LL | | remaining: self.0.iter(),
31LL | | }
32 | |_________^ returning this value requires that `'1` must outlive `'static`
f035d41b 33 |
f035d41b
XL
34help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
35 |
36LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
94222f64 37 | ++++
f035d41b 38
923072b8
FG
39error: lifetime may not live long enough
40 --> $DIR/trait-object-nested-in-impl-trait.rs:52:9
41 |
42LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
43 | -- lifetime `'a` defined here
44LL | / Iter {
45LL | |
46LL | | current: None,
47LL | | remaining: self.0.iter(),
48LL | | }
49 | |_________^ returning this value requires that `'a` must outlive `'static`
f035d41b 50 |
f035d41b
XL
51help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
52 |
53LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
94222f64 54 | ++++
f035d41b 55
923072b8
FG
56error: lifetime may not live long enough
57 --> $DIR/trait-object-nested-in-impl-trait.rs:64:9
58 |
59LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
60 | -- lifetime `'a` defined here
61LL | / Iter {
62LL | |
63LL | | current: None,
64LL | | remaining: self.0.iter(),
65LL | | }
66 | |_________^ returning this value requires that `'a` must outlive `'static`
f035d41b 67 |
2b03887a 68help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'a` lifetime bound
f035d41b
XL
69 |
70LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
94222f64 71 | ++++
f035d41b
XL
72help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
73 |
74LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
94222f64 75 | ++++
f035d41b
XL
76
77error: aborting due to 4 previous errors
78