rust/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr

64 lines
2.1 KiB
Plaintext
Raw Normal View History

error[E0309]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:18:5
|
17 | struct List<'a, T: ListItem<'a>> {
| -- help: consider adding an explicit lifetime bound `T: 'a`...
18 | slice: &'a [T]
| ^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'a [T]` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:18:5
|
18 | slice: &'a [T]
| ^^^^^^^^^^^^^^
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
|
27 | struct Foo<T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
28 | foo: &'static T
| ^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'static T` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
|
28 | foo: &'static T
| ^^^^^^^^^^^^^^^
error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:35:5
|
34 | impl<K> Nested<K> {
| - help: consider adding an explicit lifetime bound `K: 'a`...
35 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
36 | | }
| |_____^
|
note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:35:5
|
35 | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
36 | | }
| |_____^
error[E0309]: the parameter type `M` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:37:5
|
37 | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
| ^ -- help: consider adding an explicit lifetime bound `M: 'a`...
| _____|
| |
38 | | }
| |_____^
|
note: ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:37:5
|
37 | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
38 | | }
| |_____^
error: aborting due to 4 previous errors