Closed
Description
Associated type defaults seem broken in the following case: (play)
#![feature(associated_type_defaults)]
pub struct Foo;
pub trait Bar: From<<Self as Bar>::Input> {
type Input = Self;
}
impl Bar for Foo {
// Will compile with explicit type:
// type Input = Self;
}
fn main() {}
Compile error:
error[E0277]: the trait bound `Foo: std::convert::From<<Foo as Bar>::Input>` is not satisfied
--> src/main.rs:9:6
|
9 | impl Bar for Foo {
| ^^^ the trait `std::convert::From<<Foo as Bar>::Input>` is not implemented for `Foo`
However if I uncomment type Input = Self
in impl, it will work. It is confusing, because Input
should be already set to Self
in the default case.