Fix array-into-iter tests.

This commit is contained in:
Mara Bos 2021-06-25 17:26:31 +00:00
parent c685292fba
commit dbdf7c7963
5 changed files with 18 additions and 13 deletions

View File

@ -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.

View File

@ -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 <https://github.com/rust-lang/rust/issues/66145>
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
|
LL | for _ in [1, 2, 3].iter() {}

View File

@ -1,5 +1,6 @@
// run-pass
// run-rustfix
// rustfix-only-machine-applicable
fn main() {
let small = [1, 2];

View File

@ -1,5 +1,6 @@
// run-pass
// run-rustfix
// rustfix-only-machine-applicable
fn main() {
let small = [1, 2];

View File

@ -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();
| ^^^^^^^^^