@@ -3,7 +3,6 @@ use rustc_errors::Applicability;
33use rustc_hir as hir;
44use rustc_middle:: ty;
55use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment } ;
6- use rustc_session:: lint:: FutureBreakage ;
76use rustc_span:: symbol:: sym;
87
98declare_lint ! {
@@ -20,28 +19,15 @@ declare_lint! {
2019 ///
2120 /// ### Explanation
2221 ///
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)`.
3528 pub ARRAY_INTO_ITER ,
3629 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" ,
4531}
4632
4733declare_lint_pass ! (
@@ -107,10 +93,10 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
10793 } ;
10894 cx. struct_span_lint ( ARRAY_INTO_ITER , * span, |lint| {
10995 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,
114100 ) )
115101 . span_suggestion (
116102 call. ident . span ,
0 commit comments