-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationA-semverArea: semver specifications, version matching, etc.Area: semver specifications, version matching, etc.C-enhancementCategory: enhancementCategory: enhancementS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.
Description
Relaxing a supertrait is a breaking change not listed in the book's section on SemVer, because other crates may rely on supertraits for generic code. Note that this also applies to trait bounds on associated types:
trait Foo: Default {}
fn make_a_foo<A: Foo>() -> A {
A::default()
}
trait Bar {
type Baz: Default;
}
fn make_a_baz<A: Bar>() -> A::Baz {
A::Baz::default()
}
That code fails to compile if either Default is removed. Playground
Metadata
Metadata
Assignees
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationA-semverArea: semver specifications, version matching, etc.Area: semver specifications, version matching, etc.C-enhancementCategory: enhancementCategory: enhancementS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.