@@ -62,11 +62,11 @@ then the candidate types would be `&SmartPtr<Foo>`, `SmartPtr<Foo>` and `Foo`.
6262This list of candidate types is then converted to a list of candidate methods.
6363For each step, the candidate type is used to determine what searches to perform:
6464
65- * For a trait object, there is first a search for inherent candidates for
66- the object, then inherent impl candidates for the type.
6765* For a struct, enum, or foreign type, there is a search for inherent
6866 impl candidates for the type.
6967* For a type param, there's a search for inherent candidates on the param.
68+ * For a trait object, there is first a search for inherent candidates for
69+ the object, then inherent impl candidates for the type.
7070* For various simpler types (listed below) there's a search for inherent
7171 candidates for the incoherent type.
7272
@@ -76,10 +76,14 @@ traits in scope.
7676"Various simpler types" currently means bool, char, all numbers, str, array,
7777slices, raw pointers, references, never and tuple.
7878
79+ "Inherent" means a candidate method that can be identified just from
80+ the signature. For example, the ` impl ` blocks corresponding to a struct
81+ or a trait. "Extension" means a candidate gathered by considering the
82+ traits in scope.
83+
7984These searches contribute to list of all the candidate methods found;
80- separate lists are maintained for inherent and extension candidates
81- (that is, applicable candidates from traits). Only [ visible] candidates
82- are included.
85+ separate lists are maintained for the inherent and extension candidates.
86+ Only [ visible] candidates are included.
8387
8488## Picking a method from the candidates
8589
@@ -95,21 +99,21 @@ For each step, picking is attempted in this order:
9599
96100* First, a by-value method, where the ` self ` type precisely matches
97101 * First for inherent methods
98- * Then for extension (trait) methods
102+ * Then for extension methods
99103* Then, a method where ` self ` is received by immutable reference (` &T ` )
100104 * First for inherent methods
101- * Then for extension (trait) methods
105+ * Then for extension methods
102106* Then, a method where ` self ` is received by mutable reference (` &mut T ` )
103107 * First for inherent methods
104- * Then for extension (trait) methods
108+ * Then for extension methods
105109* Then, a method where the ` self ` type is a ` *const T ` - this is only considered
106110 if the self type is ` *mut T `
107111 * First for inherent methods
108- * Then for extension (trait) methods
112+ * Then for extension methods
109113* And finally, a method with a ` Pin ` that's reborrowed, if the ` pin_ergonomics `
110114 feature is enabled.
111115 * First for inherent methods
112- * Then for extension (trait) methods
116+ * Then for extension methods
113117
114118For each of those searches, if exactly one candidate is identified,
115119it's picked, and the search stops. If this results in multiple possible candidates,
0 commit comments