-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
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.
Description
Testcase: https://gist.github.com/jdm/9936609
Note how AddChild is resolved, since it's defined in an impl for JSRef itself, whereas RemoveChild is not resolved since it's a trait method.
RUST_LOG=rustc::middle::typeck::check::method
output: https://gist.github.com/jdm/9936635
Metadata
Metadata
Assignees
Labels
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.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
alexcrichton commentedon Apr 2, 2014
Compiling your example, I get:
Which I believe is working as intended. Currently inherent methods shadow trait methods.
jdm commentedon Apr 2, 2014
@alexcrichton If I comment out the Deref impl, it compiles without issue.
alexcrichton commentedon Apr 2, 2014
Ah, don't mind me, I think I see what's going on.
jdm commentedon Apr 2, 2014
nikomatsakis commentedon Apr 2, 2014
The reason for this rule is to permit impls like
impl Trait for ~Trait { ... }
, since otherwise they result in infinite recursion cycles.ghost commentedon Nov 11, 2014
Updated test case:
E-needstest.
nikomatsakis commentedon Nov 11, 2014
For more context: we changed the priorities so that inherent methods only override extension methods at a given autoderef level, which I think is close enough to the behavior that @jdm wanted for this test case.
rollup merge of rust-lang#19780: jakub-/e-needstest
rollup merge of rust-lang#19780: jakub-/e-needstest
Auto merge of rust-lang#13264 - lowr:patch/no-dyn-without-trait, r=Ve…