rust/tests/ui/impl-trait/in-assoc-type-unconstrained...

60 lines
2.2 KiB
Plaintext

error[E0271]: type mismatch resolving `<Option<<() as Trait>::Ty::{opaque#0}> as IntoIterator>::Item == ()`
--> $DIR/in-assoc-type-unconstrained.rs:8:19
|
LL | type Ty = Option<impl Sized>;
| ^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
|
= note: expected unit type `()`
found opaque type `<() as compare_ty::Trait>::Ty::{opaque#0}`
note: required by a bound in `compare_ty::Trait::Ty`
--> $DIR/in-assoc-type-unconstrained.rs:5:31
|
LL | type Ty: IntoIterator<Item = ()>;
| ^^^^^^^^^ required by this bound in `Trait::Ty`
error: unconstrained opaque type
--> $DIR/in-assoc-type-unconstrained.rs:8:26
|
LL | type Ty = Option<impl Sized>;
| ^^^^^^^^^^
|
= note: `Ty` must be used in combination with a concrete type within the same impl
error[E0053]: method `method` has an incompatible type for trait
--> $DIR/in-assoc-type-unconstrained.rs:22:24
|
LL | type Ty = impl Sized;
| ---------- the expected opaque type
LL |
LL | fn method() -> () {}
| ^^
| |
| expected opaque type, found `()`
| help: change the output type to match the trait: `<() as compare_method::Trait>::Ty`
|
note: type in trait
--> $DIR/in-assoc-type-unconstrained.rs:17:24
|
LL | fn method() -> Self::Ty;
| ^^^^^^^^
= note: expected signature `fn() -> <() as compare_method::Trait>::Ty`
found signature `fn()`
note: this item must have the opaque type in its signature in order to be able to register hidden types
--> $DIR/in-assoc-type-unconstrained.rs:22:12
|
LL | fn method() -> () {}
| ^^^^^^
error: unconstrained opaque type
--> $DIR/in-assoc-type-unconstrained.rs:20:19
|
LL | type Ty = impl Sized;
| ^^^^^^^^^^
|
= note: `Ty` must be used in combination with a concrete type within the same impl
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0053, E0271.
For more information about an error, try `rustc --explain E0053`.