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