Closed
Description
Default methods interact surprisingly with Auto-dereference
The first version (method provided by trait impl) auto-dereferences and works.
trait A { fn a(&self); }
impl A for int { fn a(&self) {} };
let s = &1i; s.a()
Moving the method implementation to a default method, does not resolve any more:
trait A { fn a(&self) { } }
impl A for int { } ;
let s = &1i; s.a()
<anon>:22:0: 22:6 error: type `&<VI0>` does not implement any method in scope named `a`
cc @msullivan
Relevant to issue #6246
First discovered this issue with Newtypes. But it also applies to simple &T auto-deref! Edited to simplify the testcase.
Metadata
Metadata
Assignees
Labels
No labels