rust/tests/ui/rfcs/type-alias-impl-trait/higher-ranked-regions-basic...

102 lines
4.5 KiB
Plaintext

error[E0792]: expected generic lifetime parameter, found `'a`
--> $DIR/higher-ranked-regions-basic.rs:15:55
|
LL | type Opq<'a> = impl Sized + 'a;
| -- this generic parameter must be used with a generic lifetime parameter
LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq<'a>> {}
| ^^
error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
--> $DIR/higher-ranked-regions-basic.rs:21:58
|
LL | fn test() -> impl for<'a> Trait<'a, Ty = impl Sized> {}
| -- ---------- ^^
| | |
| | opaque type defined here
| hidden type `&'a ()` captures the lifetime `'a` as defined here
error[E0700]: hidden type for `capture_tait::Opq0` captures lifetime that does not appear in bounds
--> $DIR/higher-ranked-regions-basic.rs:30:23
|
LL | type Opq0 = impl Sized;
| ---------- opaque type defined here
LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0>;
| -- hidden type `&'b ()` captures the lifetime `'b` as defined here
LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
LL | fn test() -> Opq2 {}
| ^^
error[E0792]: expected generic lifetime parameter, found `'a`
--> $DIR/higher-ranked-regions-basic.rs:39:23
|
LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'b>>; // <- Note 'b
| -- this generic parameter must be used with a generic lifetime parameter
LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
LL | fn test() -> Opq2 {}
| ^^
error[E0700]: hidden type for `capture_tait_complex_fail::Opq0<'a>` captures lifetime that does not appear in bounds
--> $DIR/higher-ranked-regions-basic.rs:49:23
|
LL | type Opq0<'a> = impl Sized;
| ---------- opaque type defined here
LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a>>; // <- Note 'a
| -- hidden type `&'b ()` captures the lifetime `'b` as defined here
LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
LL | fn test() -> Opq2 {}
| ^^
error[E0792]: non-defining opaque type use in defining scope
--> $DIR/higher-ranked-regions-basic.rs:57:41
|
LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {}
| ^^^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter
|
note: for this opaque type
--> $DIR/higher-ranked-regions-basic.rs:56:25
|
LL | type Opq0<'a, 'b> = impl Sized;
| ^^^^^^^^^^
error[E0792]: expected generic lifetime parameter, found `'a`
--> $DIR/higher-ranked-regions-basic.rs:57:65
|
LL | type Opq0<'a, 'b> = impl Sized;
| -- this generic parameter must be used with a generic lifetime parameter
LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'static>> {}
| ^^
error: non-defining opaque type use in defining scope
--> $DIR/higher-ranked-regions-basic.rs:66:41
|
LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {}
| ^^^^^^^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
--> $DIR/higher-ranked-regions-basic.rs:65:25
|
LL | type Opq0<'a, 'b> = impl Sized;
| ^^^^^^^^^^
error[E0792]: expected generic lifetime parameter, found `'a`
--> $DIR/higher-ranked-regions-basic.rs:66:60
|
LL | type Opq0<'a, 'b> = impl Sized;
| -- this generic parameter must be used with a generic lifetime parameter
LL | fn test() -> impl for<'a> Trait<'a, Ty = Opq0<'a, 'a>> {}
| ^^
error[E0792]: expected generic lifetime parameter, found `'a`
--> $DIR/higher-ranked-regions-basic.rs:76:23
|
LL | type Opq1<'a> = impl for<'b> Trait<'b, Ty = Opq0<'a, 'b>>;
| -- this generic parameter must be used with a generic lifetime parameter
LL | type Opq2 = impl for<'a> Trait<'a, Ty = Opq1<'a>>;
LL | fn test() -> Opq2 {}
| ^^
error: aborting due to 10 previous errors
Some errors have detailed explanations: E0700, E0792.
For more information about an error, try `rustc --explain E0700`.