Open
Description
struct Foo;
trait Bar: TryFrom<(), Error = i32> {}
impl Bar for Foo {}
impl TryFrom<()> for Foo {
type Error = ();
fn try_from(_: ()) -> Result<Self, Self::Error> {
todo!()
}
}
Current output:
error[E0271]: type mismatch resolving `<Foo as TryFrom<()>>::Error == i32`
--> src/lib.rs:4:14
|
4 | impl Bar for Foo {}
| ^^^ expected `i32`, found `()`
|
note: required by a bound in `Bar`
--> src/lib.rs:2:24
|
2 | trait Bar: TryFrom<(), Error = i32> {}
| ^^^^^^^^^^^ required by this bound in `Bar`
Desired output:
error[E0271]: type mismatch resolving `<Foo as TryFrom<()>>::Error == i32`
--> src/lib.rs:4:14
|
6 | type Error = ();
| ^^ expected `i32`, found `()`
|
note: required by a bound in `Bar`
--> src/lib.rs:2:24
|
2 | trait Bar: TryFrom<(), Error = i32> {}
| ^^^^^^^^^^^ required by this bound in `Bar`
note: required for this impl
--> src/lib.rs:4:14
|
4 | impl Bar for Foo {}
| ^^^^^^^^^^^^^^^^
|
Similar:
struct Foo;
trait Bar: TryFrom<(), Error = i32> {}
impl Bar for Foo {}
error[E0271]: type mismatch resolving `<Foo as TryFrom<()>>::Error == i32`
--> src/lib.rs:4:14
|
4 | impl Bar for Foo {}
| ^^^ expected `i32`, found `Infallible`
|
note: required by a bound in `Bar`
--> src/lib.rs:2:24
|
2 | trait Bar: TryFrom<(), Error = i32> {}
| ^^^^^^^^^^^ required by this bound in `Bar`
error[E0277]: the trait bound `Foo: TryFrom<()>` is not satisfied
--> src/lib.rs:4:14
|
4 | impl Bar for Foo {}
| ^^^ the trait `From<()>` is not implemented for `Foo`
|
= note: required for `()` to implement `Into<Foo>`
= note: required for `Foo` to implement `TryFrom<()>`
note: required by a bound in `Bar`
--> src/lib.rs:2:12
|
2 | trait Bar: TryFrom<(), Error = i32> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Bar`
E0271 should probably be dropped in favor of E0277 here.
@rustbot label +A-diagnostics +A-associated-items +T-compiler +D-imprecise-spans