@@ -67,18 +67,18 @@ For each step, the candidate type is used to determine what searches to perform:
67
67
* For a struct, enum, or foreign type, there is a search for inherent
68
68
impl candidates for the type.
69
69
* 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.
72
72
* After any of these, there's a further search for extension candidates for
73
73
traits in scope.
74
74
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.
78
77
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.
82
82
83
83
## Picking a method from the candidates
84
84
@@ -94,21 +94,21 @@ For each step, picking is attempted in this order:
94
94
95
95
* First, a by-value method, where the ` self ` type precisely matches
96
96
* First for inherent methods
97
- * Then for extension methods
97
+ * Then for extension (trait) methods
98
98
* Then, a method where ` self ` is received by immutable reference (` &T ` )
99
99
* First for inherent methods
100
- * Then for extension methods
100
+ * Then for extension (trait) methods
101
101
* Then, a method where ` self ` is received by mutable reference (` &mut T ` )
102
102
* First for inherent methods
103
- * Then for extension methods
103
+ * Then for extension (trait) methods
104
104
* Then, a method where the ` self ` type is a ` *const T ` - this is only considered
105
105
if the self type is ` *mut T `
106
106
* First for inherent methods
107
- * Then for extension methods
107
+ * Then for extension (trait) methods
108
108
* And finally, a method with a ` Pin ` that's reborrowed, if the ` pin_ergonomics `
109
109
feature is enabled.
110
110
* First for inherent methods
111
- * Then for extension methods
111
+ * Then for extension (trait) methods
112
112
113
113
For each of those searches, if exactly one candidate is identified,
114
114
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:
160
160
a mutable pointer to a constant pointer, or a pin reborrow.
161
161
* Extra lists are maintained for diagnostic purposes:
162
162
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.
163
166
164
167
## Net results
165
168
0 commit comments