@@ -3,7 +3,6 @@ use rustc_errors::Applicability;
3
3
use rustc_hir as hir;
4
4
use rustc_middle:: ty;
5
5
use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment } ;
6
- use rustc_session:: lint:: FutureBreakage ;
7
6
use rustc_span:: symbol:: sym;
8
7
9
8
declare_lint ! {
@@ -20,28 +19,15 @@ declare_lint! {
20
19
///
21
20
/// ### Explanation
22
21
///
23
- /// In the future, it is planned to add an `IntoIter` implementation for
24
- /// arrays such that it will iterate over *values* of the array instead of
25
- /// references. Due to how method resolution works, this will change
26
- /// existing code that uses `into_iter` on arrays. The solution to avoid
27
- /// this warning is to use `iter()` instead of `into_iter()`.
28
- ///
29
- /// This is a [future-incompatible] lint to transition this to a hard error
30
- /// in the future. See [issue #66145] for more details and a more thorough
31
- /// description of the lint.
32
- ///
33
- /// [issue #66145]: https://github.com/rust-lang/rust/issues/66145
34
- /// [future-incompatible]: ../index.md#future-incompatible-lints
22
+ /// Since Rust 1.53, arrays implement `IntoIterator`. However, to avoid
23
+ /// breakage, `array.into_iter()` in Rust 2015 and 2018 code will still
24
+ /// behave as `(&array).into_iter()`, returning an iterator over
25
+ /// references, just like in Rust 1.52 and earlier.
26
+ /// This only applies to the method call syntax `array.into_iter()`, not to
27
+ /// any other syntax such as `for _ in array` or `IntoIterator::into_iter(array)`.
35
28
pub ARRAY_INTO_ITER ,
36
29
Warn ,
37
- "detects calling `into_iter` on arrays" ,
38
- @future_incompatible = FutureIncompatibleInfo {
39
- reference: "issue #66145 <https://github.com/rust-lang/rust/issues/66145>" ,
40
- edition: None ,
41
- future_breakage: Some ( FutureBreakage {
42
- date: None
43
- } )
44
- } ;
30
+ "detects calling `into_iter` on arrays in Rust 2015 and 2018" ,
45
31
}
46
32
47
33
declare_lint_pass ! (
@@ -107,10 +93,10 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
107
93
} ;
108
94
cx. struct_span_lint ( ARRAY_INTO_ITER , * span, |lint| {
109
95
lint. build ( & format ! (
110
- "this method call currently resolves to `<&{} as IntoIterator>::into_iter` (due \
111
- to autoref coercions), but that might change in the future when \
112
- `IntoIterator` impls for arrays are added .",
113
- target,
96
+ "this method call resolves to `<&{} as IntoIterator>::into_iter` \
97
+ (due to backwards compatibility), \
98
+ but will resolve to <{} as IntoIterator>::into_iter in Rust 2021 .",
99
+ target , target,
114
100
) )
115
101
. span_suggestion (
116
102
call. ident . span ,
0 commit comments