rust/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr

50 lines
1.7 KiB
Plaintext
Raw Normal View History

error[E0309]: the parameter type `T` may not live long enough
2018-12-25 08:56:47 -07:00
--> $DIR/regions-struct-not-wf.rs:13:5
|
LL | impl<'a, T> Trait<'a, T> for usize {
| - help: consider adding an explicit lifetime bound `T: 'a`...
2019-03-09 15:03:44 +03:00
LL | type Out = &'a T;
| ^^^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'a T` does not outlive the data it points at
2018-12-25 08:56:47 -07:00
--> $DIR/regions-struct-not-wf.rs:13:5
|
2019-03-09 15:03:44 +03:00
LL | type Out = &'a T;
| ^^^^^^^^^^^^^^^^^
error[E0309]: the parameter type `T` may not live long enough
2018-12-25 08:56:47 -07:00
--> $DIR/regions-struct-not-wf.rs:21:5
|
LL | impl<'a, T> Trait<'a, T> for u32 {
| - help: consider adding an explicit lifetime bound `T: 'a`...
2019-03-09 15:03:44 +03:00
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...so that the type `T` will meet its required lifetime bounds
2018-12-25 08:56:47 -07:00
--> $DIR/regions-struct-not-wf.rs:21:5
|
2019-03-09 15:03:44 +03:00
LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
2018-12-25 08:56:47 -07:00
--> $DIR/regions-struct-not-wf.rs:25:5
|
2019-03-09 15:03:44 +03:00
LL | type Out = &'a &'b T;
| ^^^^^^^^^^^^^^^^^^^^^
|
2018-12-25 08:56:47 -07:00
note: the pointer is valid for the lifetime 'a as defined on the impl at 24:6
--> $DIR/regions-struct-not-wf.rs:24:6
|
LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 {
| ^^
2018-12-25 08:56:47 -07:00
note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 24:10
--> $DIR/regions-struct-not-wf.rs:24:10
|
LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 {
| ^^
error: aborting due to 3 previous errors
Some errors occurred: E0309, E0491.
For more information about an error, try `rustc --explain E0309`.