You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inherent impl blocks on trait objects don't check for coherence or overlapping impls until called #38967
traitC<T>{}impl<T>C<T>{fnasdf(&self){}}impl<T>C<T>{fnasdf(&self){}}structW{}impl<T>C<T>forW{}fnmain(){let b = Box::new(W{})asBox<C<()>>;
b.asdf();}
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.
Activity
mbrubeck commentedon Jan 10, 2017
Here's a minimal test case. The following should trigger the
overlapping_inherent_implslint but does not:apasel422 commentedon Jan 10, 2017
CC #22889
nikomatsakis commentedon Jan 12, 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.
nikomatsakis commentedon Jan 12, 2017
triage: P-medium
nikomatsakis commentedon Jan 17, 2017
The source of the bug looks pretty simple. I'll open a PR.
nikomatsakis commentedon Jan 17, 2017
Pending fix in #39143