rust/tests/ui/type-alias-impl-trait/impl_trait_in_trait_defined...

42 lines
1.5 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/impl_trait_in_trait_defined_outside_trait.rs:15:30
|
LL | type Assoc = impl std::fmt::Debug;
| -------------------- the expected opaque type
LL | fn foo() {
LL | let x: Self::Assoc = 42;
| ----------- ^^ expected opaque type, found integer
| |
| expected due to this
|
= note: expected opaque type `<() as Trait>::Assoc`
found type `{integer}`
note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/impl_trait_in_trait_defined_outside_trait.rs:14:8
|
LL | fn foo() {
| ^^^
error[E0308]: mismatched types
--> $DIR/impl_trait_in_trait_defined_outside_trait.rs:31:30
|
LL | type Assoc = impl std::fmt::Debug;
| -------------------- the expected opaque type
LL | const FOO: () = {
LL | let x: Self::Assoc = 42;
| ----------- ^^ expected opaque type, found integer
| |
| expected due to this
|
= note: expected opaque type `<() as Trait2>::Assoc`
found type `{integer}`
note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/impl_trait_in_trait_defined_outside_trait.rs:30:11
|
LL | const FOO: () = {
| ^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.