-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inherent impl blocks on trait objects don't check for coherence or overlapping impls until called #38967
Labels
A-trait-system
Area: Trait system
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
3 tasks
Here's a minimal test case. The following should trigger the trait C {}
impl C { fn f() {} }
impl C { fn f() {} } |
CC #22889 |
arielb1
added
I-nominated
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jan 11, 2017
Hmm, seems like a bug, for sure. For example, this code https://is.gd/YSKjuW using structs does error. cc @aturon, who wrote the lint I think. |
triage: P-medium |
The source of the bug looks pretty simple. I'll open a PR. |
Pending fix in #39143 |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 20, 2017
check inherent impls of traits for overlap as well Simple oversight. Fixes rust-lang#38967. r? @eddyb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-trait-system
Area: Trait system
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider the following snippet:
When
asdf.asdf()
is called, which impl should be used? Is it possible to select one impl or the other?When discussing this in #rust, @mbrubeck also found that impls on trait objects don't check for overlap at all:
In both of these examples, taking out the call to
asdf()
makes the sample compile, meaning that it's only upon method resolution that this conflict is found. The former can be ruled out as a coherence issue, and the latter is directly an overlapping impl, that wouldn't be allowed on a regular struct/enum.cc #36889, per talchas in #rust
The text was updated successfully, but these errors were encountered: