Skip to content

Commit b828a41

Browse files
committed
Document incoherence.
1 parent fb49894 commit b828a41

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/expressions/method-call-expr.md

+7-7
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.
@@ -147,8 +145,9 @@ only the `Receiver` chain.
147145
There are a few details not considered in this overview:
148146

149147
* 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.
148+
[incoherent] types if `rustc_has_incoherent_inherent_impls` is active for
149+
a `dyn`, struct, enum, or foreign type. (The search for candidates for
150+
"various simpler types" also considers incoherent implementations.)
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)