From dbdf7c7963c8d637c11cac2940161813cd61b8c0 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Fri, 25 Jun 2021 17:26:31 +0000 Subject: [PATCH] Fix array-into-iter tests. --- .../ui/iterators/into-iter-on-arrays-2018.rs | 1 + .../iterators/into-iter-on-arrays-2018.stderr | 4 +++- .../iterators/into-iter-on-arrays-lint.fixed | 1 + .../ui/iterators/into-iter-on-arrays-lint.rs | 1 + .../iterators/into-iter-on-arrays-lint.stderr | 24 +++++++++---------- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.rs b/src/test/ui/iterators/into-iter-on-arrays-2018.rs index e2b75610fefc4..e56c2956a697e 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.rs @@ -28,6 +28,7 @@ fn main() { for _ in [1, 2, 3].into_iter() {} //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning } /// User type that dereferences to an array. diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr index daa8a388366c3..3bd3ca6e875a1 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr @@ -34,11 +34,13 @@ LL | let _: Iter<'_, i32> = IntoIterator::into_iter(Box::new(array)); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-2018.rs:27:24 + --> $DIR/into-iter-on-arrays-2018.rs:29:24 | LL | for _ in [1, 2, 3].into_iter() {} | ^^^^^^^^^ | + = warning: this changes meaning in Rust 2021 + = note: for more information, see issue #66145 help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL | for _ in [1, 2, 3].iter() {} diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed index f206134d83fdb..0055758a6a442 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed @@ -1,5 +1,6 @@ // run-pass // run-rustfix +// rustfix-only-machine-applicable fn main() { let small = [1, 2]; diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.rs b/src/test/ui/iterators/into-iter-on-arrays-lint.rs index a43a7ea797f42..01857c78a730c 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.rs @@ -1,5 +1,6 @@ // run-pass // run-rustfix +// rustfix-only-machine-applicable fn main() { let small = [1, 2]; diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr index fb34384b4e53e..01789e0e25748 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr @@ -1,5 +1,5 @@ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:9:11 + --> $DIR/into-iter-on-arrays-lint.rs:10:11 | LL | small.into_iter(); | ^^^^^^^^^ @@ -17,7 +17,7 @@ LL | IntoIterator::into_iter(small); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:12:12 + --> $DIR/into-iter-on-arrays-lint.rs:13:12 | LL | [1, 2].into_iter(); | ^^^^^^^^^ @@ -34,7 +34,7 @@ LL | IntoIterator::into_iter([1, 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:15:9 + --> $DIR/into-iter-on-arrays-lint.rs:16:9 | LL | big.into_iter(); | ^^^^^^^^^ @@ -51,7 +51,7 @@ LL | IntoIterator::into_iter(big); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:18:15 + --> $DIR/into-iter-on-arrays-lint.rs:19:15 | LL | [0u8; 33].into_iter(); | ^^^^^^^^^ @@ -68,7 +68,7 @@ LL | IntoIterator::into_iter([0u8; 33]); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:22:21 + --> $DIR/into-iter-on-arrays-lint.rs:23:21 | LL | Box::new(small).into_iter(); | ^^^^^^^^^ @@ -85,7 +85,7 @@ LL | IntoIterator::into_iter(Box::new(small)); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:25:22 + --> $DIR/into-iter-on-arrays-lint.rs:26:22 | LL | Box::new([1, 2]).into_iter(); | ^^^^^^^^^ @@ -102,7 +102,7 @@ LL | IntoIterator::into_iter(Box::new([1, 2])); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:28:19 + --> $DIR/into-iter-on-arrays-lint.rs:29:19 | LL | Box::new(big).into_iter(); | ^^^^^^^^^ @@ -119,7 +119,7 @@ LL | IntoIterator::into_iter(Box::new(big)); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:31:25 + --> $DIR/into-iter-on-arrays-lint.rs:32:25 | LL | Box::new([0u8; 33]).into_iter(); | ^^^^^^^^^ @@ -136,7 +136,7 @@ LL | IntoIterator::into_iter(Box::new([0u8; 33])); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:35:31 + --> $DIR/into-iter-on-arrays-lint.rs:36:31 | LL | Box::new(Box::new(small)).into_iter(); | ^^^^^^^^^ @@ -153,7 +153,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new(small))); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:38:32 + --> $DIR/into-iter-on-arrays-lint.rs:39:32 | LL | Box::new(Box::new([1, 2])).into_iter(); | ^^^^^^^^^ @@ -170,7 +170,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new([1, 2]))); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:41:29 + --> $DIR/into-iter-on-arrays-lint.rs:42:29 | LL | Box::new(Box::new(big)).into_iter(); | ^^^^^^^^^ @@ -187,7 +187,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new(big))); | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-lint.rs:44:35 + --> $DIR/into-iter-on-arrays-lint.rs:45:35 | LL | Box::new(Box::new([0u8; 33])).into_iter(); | ^^^^^^^^^