Partial substitution of trait associated types results in compiltion failure
add1623
Opened by Alexander Bulaev at
Consider a following playground:
#![crate_type = "lib"]
trait A<X> {
}
trait B {
type X;
type A: A<Self::X>;
}
fn oops<T: B<X=String>>(_: &T) {
}
It fails to compile with
Compiling playground v0.0.1 (file:///playground)
error[E0277]: the trait bound `<T as B>::A: A<std::string::String>` is not satisfied
--> src/lib.rs:11:1
|
11 | / fn oops<T: B<X=String>>(_: &T) {
12 | | }
| |_^ the trait `A<std::string::String>` is not implemented for `<T as B>::A`
|
= help: consider adding a `where <T as B>::A: A<std::string::String>` bound
= note: required by `B`
error: aborting due to previous error
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
cc @nikomatsakis (or I don't know exactly who might help with this)
Alexander Bulaev at 2018-02-20 16:09:12
This is a normalization failure. I think the best way to fix this is moving towards lazy normalization (a move that is very much in progress).
Niko Matsakis at 2018-02-20 20:41:48
Triage: no change directly, this still fails to compile. I believe the lazy normalization work is ongoing.
Steve Klabnik at 2020-04-28 13:08:58