2022-08-26 19:01:49 +00:00
|
|
|
error[E0311]: the parameter type `T` may not live long enough
|
2022-12-26 23:43:31 +00:00
|
|
|
--> $DIR/E0311.rs:6:5
|
2022-08-19 10:27:31 +00:00
|
|
|
|
|
2022-08-26 19:01:49 +00:00
|
|
|
LL | with_restriction::<T>(x)
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
2022-08-19 10:27:31 +00:00
|
|
|
|
|
2022-08-26 19:01:49 +00:00
|
|
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
|
2022-12-26 23:43:31 +00:00
|
|
|
--> $DIR/E0311.rs:5:25
|
2022-08-19 10:27:31 +00:00
|
|
|
|
|
2022-08-26 19:01:49 +00:00
|
|
|
LL | fn no_restriction<T>(x: &()) -> &() {
|
|
|
|
| ^^^
|
|
|
|
note: ...so that the type `T` will meet its required lifetime bounds
|
2022-12-26 23:43:31 +00:00
|
|
|
--> $DIR/E0311.rs:6:5
|
2022-08-19 10:27:31 +00:00
|
|
|
|
|
2022-08-26 19:01:49 +00:00
|
|
|
LL | with_restriction::<T>(x)
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
2022-08-19 10:27:31 +00:00
|
|
|
help: consider adding an explicit lifetime bound...
|
|
|
|
|
|
2022-12-26 23:43:31 +00:00
|
|
|
LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
|
|
|
|
| +++ ++++ ++
|
2022-08-19 10:27:31 +00:00
|
|
|
|
2022-08-26 19:01:49 +00:00
|
|
|
error: aborting due to previous error
|
2022-08-19 10:27:31 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0311`.
|