Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTrait bounds on struct type parameters aren't always enforced (depending on the order of impls) #21837
Comments
kmcallister
added
A-typesystem
I-nominated
labels
Feb 2, 2015
This comment has been minimized.
This comment has been minimized.
|
P-high, not 1.0. (But definitely a weird bug that we would like to fix.) |
pnkfelix
added
P-medium
and removed
I-nominated
labels
Feb 5, 2015
This comment has been minimized.
This comment has been minimized.
|
cc me |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis, @pnkfelix: should this be P-backcompat-lang since the compiler accepts code that it should not? |
This comment has been minimized.
This comment has been minimized.
|
@SSheldon I think we decided this is one of those edge cases where the amount of breakage (that fixing this is expected to incur) was deemed acceptable for fixing post 1.0. At the time this was last triaged, there was a general rule that if something was tagged P-backcompat-lang, then it must also be set for the 1.0 milestone (at the latest). However, since then during recent triage meetings, we have been more willing to tag things as P-backcompat-lang even if they were not attached to the 1.0 milestone. So, with that in mind: triage: P-backcompat-lang, not P-high |
rust-highfive
added
P-backcompat-lang
and removed
P-medium
labels
Apr 4, 2015
brson
added
P-high
and removed
P-backcompat-lang
labels
Apr 29, 2015
pnkfelix
self-assigned this
Apr 30, 2015
Stebalien
referenced this issue
Sep 30, 2015
Open
Projections, lifetimes, and WF tracking issue (RFC 1214) #27579
This comment has been minimized.
This comment has been minimized.
|
This causes an RFC1214 warning in 1.4+. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium Looks like this is already fixed by RFC 1214, as @arielb1 reports. |
rust-highfive
added
P-medium
and removed
P-high
labels
Oct 29, 2015
nikomatsakis
added
the
E-needstest
label
Oct 29, 2015
This comment has been minimized.
This comment has been minimized.
|
Tagging as E-needstest, since we should be able to add a test with |
nikomatsakis
added
the
E-mentor
label
Oct 29, 2015
This comment has been minimized.
This comment has been minimized.
|
Tagging as mentor just because I can give advice on how to craft a suitable test ( |
This comment has been minimized.
This comment has been minimized.
|
Triaging: Both examples causes error on nightly
@nikomatsakis I would like to help with the test if you don't mind giving initial directions. |
This comment has been minimized.
This comment has been minimized.
|
@bltavares, that repro case was from pre-1.0, here's the updated repro case: pub trait Bound { }
pub struct Foo<T: Bound>(T);
pub trait Trait1 { }
impl<T: Bound> Trait1 for Foo<T> { }
pub trait Trait2 { }
impl<T> Trait2 for Foo<T> { }
fn main() { }That code will compile with |
This comment has been minimized.
This comment has been minimized.
|
@arielb1 This seems to have been fixed by RFC 1214. Can it be closed? |
This comment has been minimized.
This comment has been minimized.
|
@brson I think it needs a test. I probably should not be assigned to it since I don't plan to spend time making a test. |
pnkfelix
removed their assignment
Jul 20, 2016
brson
added
the
E-easy
label
Jul 30, 2016
This comment has been minimized.
This comment has been minimized.
|
So all there is to do is add a test which checks that Ssheldons code does not compile? |
martinhath
added a commit
to martinhath/rust
that referenced
this issue
Oct 3, 2016
This comment has been minimized.
This comment has been minimized.
|
@martinhath yes :) |
martinhath
added a commit
to martinhath/rust
that referenced
this issue
Oct 3, 2016
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Oct 4, 2016
This comment has been minimized.
This comment has been minimized.
|
Fixed now with a test merged in #36941 |
SSheldon commentedFeb 1, 2015
The following compiles without issue, even though the impl of
Trait2is missing a trait bound thatTimplementsBound:However, if you switch the order of the impls...
You suddenly start getting this 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).