@@ -21,21 +21,15 @@ declare_lint! {
21
21
///
22
22
/// ### Explanation
23
23
///
24
- /// In the future, it is planned to add an `IntoIter` implementation for
25
- /// arrays such that it will iterate over *values* of the array instead of
26
- /// references. Due to how method resolution works, this will change
27
- /// existing code that uses `into_iter` on arrays. The solution to avoid
28
- /// this warning is to use `iter()` instead of `into_iter()`.
29
- ///
30
- /// This is a [future-incompatible] lint to transition this to a hard error
31
- /// in the future. See [issue #66145] for more details and a more thorough
32
- /// description of the lint.
33
- ///
34
- /// [issue #66145]: https://github.com/rust-lang/rust/issues/66145
35
- /// [future-incompatible]: ../index.md#future-incompatible-lints
24
+ /// Since Rust 1.53, arrays implement `IntoIterator`. However, to avoid
25
+ /// breakage, `array.into_iter()` in Rust 2015 and 2018 code will still
26
+ /// behave as `(&array).into_iter()`, returning an iterator over
27
+ /// references, just like in Rust 1.52 and earlier.
28
+ /// This only applies to the method call syntax `array.into_iter()`, not to
29
+ /// any other syntax such as `for _ in array` or `IntoIterator::into_iter(array)`.
36
30
pub ARRAY_INTO_ITER ,
37
31
Warn ,
38
- "detects calling `into_iter` on arrays" ,
32
+ "detects calling `into_iter` on arrays in Rust 2015 and 2018 " ,
39
33
@future_incompatible = FutureIncompatibleInfo {
40
34
reference: "issue #66145 <https://github.com/rust-lang/rust/issues/66145>" ,
41
35
reason: FutureIncompatibilityReason :: EditionSemanticsChange ( Edition :: Edition2021 ) ,
@@ -105,10 +99,10 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
105
99
} ;
106
100
cx. struct_span_lint ( ARRAY_INTO_ITER , * span, |lint| {
107
101
lint. build ( & format ! (
108
- "this method call currently resolves to `<&{} as IntoIterator>::into_iter` (due \
109
- to autoref coercions), but that might change in the future when \
110
- `IntoIterator` impls for arrays are added .",
111
- target,
102
+ "this method call resolves to `<&{} as IntoIterator>::into_iter` \
103
+ (due to backwards compatibility), \
104
+ but will resolve to <{} as IntoIterator>::into_iter in Rust 2021 .",
105
+ target , target,
112
106
) )
113
107
. span_suggestion (
114
108
call. ident . span ,
0 commit comments