Skip to content

Commit 8e682a6

Browse files
committed
Various code review comments.
1 parent f545a85 commit 8e682a6

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/expressions/method-call-expr.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ For each step, the candidate type is used to determine what searches to perform:
6767
* For a struct, enum, or foreign type, there is a search for inherent
6868
impl candidates for the type.
6969
* For a type param, there's a search for for inherent candidates on the param.
70-
* For other tyings (e.g. bools, chars) there's a search for inherent candidates
71-
for the incoherent type.
70+
* For various simpler types (listed below) there's a search for inherent
71+
candidates for the incoherent type.
7272
* After any of these, there's a further search for extension candidates for
7373
traits in scope.
7474

75-
These searches contribute to list of all the candidate methods found;
76-
separate lists are maintained for inherent and extension candidates. Only
77-
[visible] candidates are included.
75+
"Various simpler types" currently means bool, char, all numbers, str, array,
76+
slices, raw pointers, references, never and tuple.
7877

79-
(For diagnostic purposes, the search may be performed slightly differently, for
80-
instance searching all traits not just those in scope, or also noting
81-
inaccessible candidates.)
78+
These searches contribute to list of all the candidate methods found;
79+
separate lists are maintained for inherent and extension candidates
80+
(that is, applicable candidates from traits). Only [visible] candidates
81+
are included.
8282

8383
## Picking a method from the candidates
8484

@@ -94,21 +94,21 @@ For each step, picking is attempted in this order:
9494

9595
* First, a by-value method, where the `self` type precisely matches
9696
* First for inherent methods
97-
* Then for extension methods
97+
* Then for extension (trait) methods
9898
* Then, a method where `self` is received by immutable reference (`&T`)
9999
* First for inherent methods
100-
* Then for extension methods
100+
* Then for extension (trait) methods
101101
* Then, a method where `self` is received by mutable reference (`&mut T`)
102102
* First for inherent methods
103-
* Then for extension methods
103+
* Then for extension (trait) methods
104104
* Then, a method where the `self` type is a `*const T` - this is only considered
105105
if the self type is `*mut T`
106106
* First for inherent methods
107-
* Then for extension methods
107+
* Then for extension (trait) methods
108108
* And finally, a method with a `Pin` that's reborrowed, if the `pin_ergonomics`
109109
feature is enabled.
110110
* First for inherent methods
111-
* Then for extension methods
111+
* Then for extension (trait) methods
112112

113113
For each of those searches, if exactly one candidate is identified,
114114
it's picked, and the search stops. If this results in multiple possible candidates,
@@ -160,6 +160,9 @@ There are a few details not considered in this overview:
160160
a mutable pointer to a constant pointer, or a pin reborrow.
161161
* Extra lists are maintained for diagnostic purposes:
162162
unstable candidates, unsatisfied predicates, and static candidates.
163+
* For diagnostic purposes, the search may be performed slightly differently,
164+
for instance searching all traits not just those in scope, or also noting
165+
inaccessible candidates.
163166

164167
## Net results
165168

0 commit comments

Comments
 (0)