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
Copy file name to clipboardExpand all lines: src/expressions/method-call-expr.md
+21-1
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,18 @@ Then, for each candidate `T`, add `&T` and `&mut T` to the list immediately afte
23
23
24
24
For instance, if the receiver has type `Box<[i32;2]>`, then the candidate types will be `Box<[i32;2]>`, `&Box<[i32;2]>`, `&mut Box<[i32;2]>`, `[i32; 2]` (by dereferencing), `&[i32; 2]`, `&mut [i32; 2]`, `[i32]` (by unsized coercion), `&[i32]`, and finally `&mut [i32]`.
25
25
26
-
Then, for each candidate type `T`, search for a [visible] method with a receiver of that type in the following places:
26
+
A second - possible more expansive - list is then made of types where we might
27
+
find [visible] methods with a receiver of that type, called the list of
28
+
contributing types. To make this list, follow the exact same process,
29
+
but this time use the `Receiver` trait
30
+
instead of the `Deref` trait for any non-built-in derefences.
31
+
32
+
There is a blanket implementation of `Receiver` for all `T: Deref`, so in many
33
+
cases the lists are identical, but there are rare smart pointers which
34
+
may implement `Receiver` without implementing `Deref`, so this second list of
35
+
types may be longer than the list of candidate types.
36
+
37
+
Then, for each contributing type `T`, search for a [visible] method with a receiver of any candidate type in the following places:
27
38
28
39
1.`T`'s inherent methods (methods implemented directly on `T`).
29
40
1. Any of the methods provided by a [visible] trait implemented by `T`.
@@ -66,6 +77,15 @@ Once a method is looked up, if it can't be called for one (or more) of those rea
0 commit comments