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
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 on T).
[...]
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 typeT, not methods in an impl block for T. And those two types can obviously be different.
implFoo{fnby_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?
The text was updated successfully, but these errors were encountered:
Yes, exactly. I assume the author just wanted to explain that "inherent method" means that the method does not belong to a trait but is implemented on a type directly. But using T in that explanation is confusing I think (because, as you said, one could interpret this in two ways).
Here it says:
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 typeT
, not methods in an impl block forT
. And those two types can obviously be different.Suppose our candidate type
T
is&Foo
, thenby_ref
would be a "visible method with a receiver of that type". However, the methodby_ref
is not implemented on&Foo
, but onFoo
. In other words:Self
in that method isFoo
, 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?
The text was updated successfully, but these errors were encountered: