2022-09-05 05:45:53 -05:00
|
|
|
error[E0311]: the parameter type `T` may not live long enough
|
2022-12-26 17:43:31 -06:00
|
|
|
--> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
|
2022-09-05 05:45:53 -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-09-05 05:45:53 -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-09-05 05:45:53 -05:00
|
|
|
|
|
2023-09-07 20:35:51 -05:00
|
|
|
LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
|
|
|
|
| +++ ++++ ++ ++
|
2022-09-05 05:45:53 -05:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2022-09-26 19:50:33 -05:00
|
|
|
For more information about this error, try `rustc --explain E0311`.
|