about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-05-25 17:12:45 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-06-26 12:03:33 +0000
commit37e17803b57877637d4b6b13c8813589bd140452 (patch)
tree1da64862885d151ae363fad53237eae371c457de /compiler
parent481971978fda83aa7cf1f1f3c80cfad822377cf2 (diff)
downloadrust-37e17803b57877637d4b6b13c8813589bd140452.tar.gz
rust-37e17803b57877637d4b6b13c8813589bd140452.zip
Change wording on array_into_iter lint for 1.53 and edition changes.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/array_into_iter.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs
index 14ffbbc35eb..92c6ae35292 100644
--- a/compiler/rustc_lint/src/array_into_iter.rs
+++ b/compiler/rustc_lint/src/array_into_iter.rs
@@ -21,21 +21,15 @@ declare_lint! {
     ///
     /// ### Explanation
     ///
-    /// In the future, it is planned to add an `IntoIter` implementation for
-    /// arrays such that it will iterate over *values* of the array instead of
-    /// references. Due to how method resolution works, this will change
-    /// existing code that uses `into_iter` on arrays. The solution to avoid
-    /// this warning is to use `iter()` instead of `into_iter()`.
-    ///
-    /// This is a [future-incompatible] lint to transition this to a hard error
-    /// in the future. See [issue #66145] for more details and a more thorough
-    /// description of the lint.
-    ///
-    /// [issue #66145]: https://github.com/rust-lang/rust/issues/66145
-    /// [future-incompatible]: ../index.md#future-incompatible-lints
+    /// Since Rust 1.53, arrays implement `IntoIterator`. However, to avoid
+    /// breakage, `array.into_iter()` in Rust 2015 and 2018 code will still
+    /// behave as `(&array).into_iter()`, returning an iterator over
+    /// references, just like in Rust 1.52 and earlier.
+    /// This only applies to the method call syntax `array.into_iter()`, not to
+    /// any other syntax such as `for _ in array` or `IntoIterator::into_iter(array)`.
     pub ARRAY_INTO_ITER,
     Warn,
-    "detects calling `into_iter` on arrays",
+    "detects calling `into_iter` on arrays in Rust 2015 and 2018",
     @future_incompatible = FutureIncompatibleInfo {
         reference: "issue #66145 <https://github.com/rust-lang/rust/issues/66145>",
         reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021),
@@ -105,10 +99,10 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
             };
             cx.struct_span_lint(ARRAY_INTO_ITER, *span, |lint| {
                 lint.build(&format!(
-                "this method call currently resolves to `<&{} as IntoIterator>::into_iter` (due \
-                    to autoref coercions), but that might change in the future when \
-                    `IntoIterator` impls for arrays are added.",
-                target,
+                    "this method call resolves to `<&{} as IntoIterator>::into_iter` \
+                    (due to backwards compatibility), \
+                    but will resolve to <{} as IntoIterator>::into_iter in Rust 2021.",
+                    target, target,
                 ))
                 .span_suggestion(
                     call.ident.span,