rust/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.stderr

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

32 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-03-22 03:02:12 -05:00
error[E0792]: expected generic lifetime parameter, found `'static`
--> $DIR/non-defining-use-lifetimes.rs:13:16
|
2024-03-22 03:02:12 -05:00
LL | fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a {
| -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
LL | let _: () = foo(Lt::<'static>::None);
| ^^
2024-03-18 11:03:18 -05:00
error[E0792]: expected generic lifetime parameter, found `'_`
--> $DIR/non-defining-use-lifetimes.rs:22:16
2024-03-18 11:03:18 -05:00
|
LL | fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a {
| -- this generic parameter must be used with a generic lifetime parameter
LL | let _: () = foo(Lt::<'_>::None);
| ^^
2024-03-22 03:02:12 -05:00
error: non-defining opaque type use in defining scope
--> $DIR/non-defining-use-lifetimes.rs:32:16
|
LL | let _: () = foo(Lt::<'a>::None, Lt::<'a>::None);
| ^^
2024-03-22 03:02:12 -05:00
|
note: lifetime used multiple times
--> $DIR/non-defining-use-lifetimes.rs:31:58
2024-03-22 03:02:12 -05:00
|
LL | fn foo<'a, 'b>(_: Lt<'a>, _: Lt<'b>) -> impl Sized + 'a + 'b {
| ^^ ^^
2024-03-18 11:03:18 -05:00
error: aborting due to 3 previous errors
2024-03-18 11:03:18 -05:00
For more information about this error, try `rustc --explain E0792`.