-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-bugCategory: This is a bug.Category: This is a bug.F-associated_type_defaults`#![feature(associated_type_defaults)]``#![feature(associated_type_defaults)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.