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 | with_restriction::<T>(x)
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
note: the parameter type `T` must be valid for the anonymous lifetime defined here...
|
2022-12-26 17:43:31 -06:00
|
|
|
--> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:5:25
|
2022-09-05 05:45:53 -05:00
|
|
|
|
|
|
|
|
LL | fn no_restriction<T>(x: &()) -> &() {
|
|
|
|
| ^^^
|
|
|
|
note: ...so that the type `T` will meet its required lifetime bounds
|
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 | with_restriction::<T>(x)
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
help: consider adding an explicit lifetime bound...
|
|
|
|
|
|
2022-12-26 17:43:31 -06:00
|
|
|
LL | fn no_restriction<'a, T: 'a>(x: &'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`.
|