-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.P-mediumMedium priorityMedium priority
Description
The following compiles without issue, even though the impl of Trait2
is missing a trait bound that T
implements Bound
:
pub trait Bound { }
pub struct Foo<T: Bound>;
pub trait Trait1 { }
impl<T: Bound> Trait1 for Foo<T> { }
pub trait Trait2 { }
impl<T> Trait2 for Foo<T> { }
fn main() { }
However, if you switch the order of the impls...
pub trait Bound { }
pub struct Foo<T: Bound>;
pub trait Trait2 { }
impl<T> Trait2 for Foo<T> { }
pub trait Trait1 { }
impl<T: Bound> Trait1 for Foo<T> { }
fn main() { }
You suddenly start getting this error:
error: the trait `Bound` is not implemented for the type `T` [E0277]
impl<T> Trait2 for Foo<T> { }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
I did not expect the ordering of the impls to matter here. I'm using rustc 1.0.0-nightly (1d00c545e 2015-01-30 19:56:34 +0000)
.
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.P-mediumMedium priorityMedium priority