Skip to content

Commit f1a7dd7

Browse files
committed
Document incoherence.
1 parent fb49894 commit f1a7dd7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/expressions/method-call-expr.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ then the candidate types would be `&SmartPtr<Foo>`, `SmartPtr<Foo>` and `Foo`.
6262
This list of candidate types is then converted to a list of candidate methods.
6363
For each step, the candidate type is used to determine what searches to perform:
6464

65-
* For a struct, enum, or foreign type, there is a search for inherent
66-
impl candidates for the type.
65+
* For a struct, enum, foreign type, or various simpler types (listed below)
66+
there is a search for inherent impl candidates for the type.
6767
* For a type param, there's a search for inherent candidates on the param.
6868
* For a trait object, there is first a search for inherent candidates for
6969
the trait (for example in `impl Trait` blocks), then inherent impl
7070
candidates for the trait object itself (for example found in `impl dyn Trait`
71-
blocks)
72-
* For various simpler types (listed below) there's a search for inherent
73-
candidates for the incoherent type.
71+
blocks).
7472

7573
After these occur, there's a further search for extension candidates for
7674
traits in scope.
@@ -146,9 +144,10 @@ only the `Receiver` chain.
146144

147145
There are a few details not considered in this overview:
148146

149-
* The search for candidate methods will also consider searches for
150-
incoherent types if `rustc_has_incoherent_inherent_impls` is active for
151-
a `dyn`, struct, enum, or foreign type.
147+
* The search for candidate methods will search more widely (potentially
148+
across crates) for certain [incoherent] types: that includes any of
149+
the "various simpler types" listed above, and a `dyn`, struct, enum, or
150+
foreign type if `rustc_has_incoherent_inherent_impls` is active.
152151
* If there are multiple candidates from traits, they may in fact be
153152
identical, and the picking operation collapses them to a single pick to avoid
154153
reporting conflicts.
@@ -228,3 +227,4 @@ There are a few details not considered in this overview:
228227
[`IntoIterator`]: std::iter::IntoIterator
229228
[inherent]: ../items/implementations.md#inherent-implementations
230229
[methods on traits]: ../items/implementations.md#trait-implementations
230+
[incoherent]: ../items/implementations.md#trait-implementation-coherence

0 commit comments

Comments
 (0)