-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.
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);
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.