Description
Here it says:
Then, for each candidate type
T
, search for a visible method with a receiver of that type in the following places:
T
's inherent methods (methods implemented directly onT
).- [...]
The part "methods implemented directly on T
" is not completely correct, I think. As first sentence already says, we are searching for methods with the receiver type T
, not methods in an impl block for T
. And those two types can obviously be different.
impl Foo {
fn by_ref(&self) {}
}
Suppose our candidate type T
is &Foo
, then by_ref
would be a "visible method with a receiver of that type". However, the method by_ref
is not implemented on &Foo
, but on Foo
. In other words: Self
in that method is Foo
, not &Foo
.
To fix this, I would replace "methods implemented directly on T
" with: "methods that belong to a type and not to a trait". Or something like that.
Am I correct that the current phrasing is wrong/very misleading? Or am I missing something?