Closed
Description
This compiles:
struct Foo<T:Copy=String>(T);
fn main() { }
This does not:
struct Foo<T:Copy=String>(T);
fn main() {
let a: Foo;
}
Even though it's stable, we should probably phase out writing badly formed defaults in declarations.
We also don't check that a dependent default actually implements a given trait when using associated items:
struct Bar<A, T=<A as Iterator>::Item>(A, T);
Will compile. The default being applied is conditional on A
implementing Iterator
. May be useful for some hacks but seems bogus.
Edit:
We don't even check totally bogus stuff such as:
struct Foo<T, U: FromIterator<T>>(T, U);
struct Bar<Z = Foo<i32, i32>>(Z);