Closed
Description
I think I found a bug with associated type bounds! #52662
#![feature(associated_type_bounds)]
trait Foo {
type Bar;
}
fn works<F: Foo>() where F::Bar: Copy {}
// This should be fine, but I get `error[E0221]` instead
fn breaks<F: Foo<Bar: Foo>>() where F::Bar: Copy {}
This is the exact same error you get when you do this
trait Foo<T> {
type Bar;
}
fn breaks<F: Foo<String> + Foo<u32>>() where F::Bar: Copy {}
Because Rust can't tell which Foo::<_>::Bar
you mean, but in the case of associated_type_bounds
, there is no ambiguity, which makes this error confusing.