Skip to content

Commit b007006

Browse files
committed
Document pre-Rust-2021 special case for IntoIterator method lookup
This is the #[rustc_skip_array_during_method_dispatch] special case.
1 parent 2aec62f commit b007006

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/expressions/method-call-expr.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ Once a method is looked up, if it can't be called for one (or more) of those rea
6666
If a step is reached where there is more than one possible method, such as where generic methods or traits are considered the same, then it is a compiler error.
6767
These cases require a [disambiguating function call syntax] for method and function invocation.
6868
69+
> **Edition Differences**: Before the 2021 edition, during the search for visible methods, if the candidate receiver type is an [array type], methods provided by the standard library [`IntoIterator`] trait are ignored.
70+
>
71+
> The edition used for this purpose is determined by the token representing the method name.
72+
73+
6974
<div class="warning">
7075
7176
***Warning:*** For [trait objects], if there is an inherent method of the same name as a trait method, it will give a compiler error when trying to call the method in a method call expression.
@@ -79,9 +84,11 @@ Just don't define inherent methods on trait objects with the same name as a trai
7984
[_Expression_]: ../expressions.md
8085
[_PathExprSegment_]: ../paths.md#paths-in-expressions
8186
[visible]: ../visibility-and-privacy.md
87+
[array type]: ../types/array.md
8288
[trait objects]: ../types/trait-object.md
8389
[disambiguate call]: call-expr.md#disambiguating-function-calls
8490
[disambiguating function call syntax]: call-expr.md#disambiguating-function-calls
8591
[dereference]: operator-expr.md#the-dereference-operator
8692
[methods]: ../items/associated-items.md#methods
8793
[unsized coercion]: ../type-coercions.md#unsized-coercions
94+
[`IntoIterator`]: ../../std/iter/trait.IntoIterator.html

0 commit comments

Comments
 (0)