rust/tests/ui/type-alias-impl-trait/equal-lifetime-params-not-o...

60 lines
2.1 KiB
Plaintext

error: non-defining opaque type use in defining scope
--> $DIR/equal-lifetime-params-not-ok.rs:10:22
|
LL | fn test<'a>() -> Opaque<'a, 'a> {}
| ^^^^^^^^^^^^^^ generic argument `'a` used twice
|
note: for this opaque type
--> $DIR/equal-lifetime-params-not-ok.rs:9:27
|
LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: non-defining opaque type use in defining scope
--> $DIR/equal-lifetime-params-not-ok.rs:10:37
|
LL | fn test<'a>() -> Opaque<'a, 'a> {}
| ^^
|
note: lifetime used multiple times
--> $DIR/equal-lifetime-params-not-ok.rs:9:17
|
LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
| ^^ ^^
error: non-defining opaque type use in defining scope
--> $DIR/equal-lifetime-params-not-ok.rs:17:49
|
LL | fn test<'a: 'b, 'b: 'a>() -> Opaque<'a, 'b> {}
| ^^
|
note: lifetime used multiple times
--> $DIR/equal-lifetime-params-not-ok.rs:16:17
|
LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
| ^^ ^^
error: non-defining opaque type use in defining scope
--> $DIR/equal-lifetime-params-not-ok.rs:23:61
|
LL | fn test<'a: 'b, 'b: 'a>(a: &'a str) -> Opaque<'a, 'b> { a }
| ^
|
note: lifetime used multiple times
--> $DIR/equal-lifetime-params-not-ok.rs:22:17
|
LL | type Opaque<'a, 'b> = impl super::Trait<'a, 'b>;
| ^^ ^^
error[E0792]: expected generic lifetime parameter, found `'static`
--> $DIR/equal-lifetime-params-not-ok.rs:33:42
|
LL | type Opaque<'a> = impl super::Trait<'a, 'a>;
| -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type
LL | fn test<'a: 'static>() -> Opaque<'a> {}
| ^^
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0792`.