rust/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
693 B
Plaintext
Raw Normal View History

error[E0311]: the parameter type `T` may not live long enough
--> $DIR/suggest-introducing-and-adding-missing-lifetime.rs:6:5
|
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...
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
|
LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
| +++ ++++ ++ ++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0311`.