Skip to content

Commit

Permalink
Fix array-into-iter tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Jun 26, 2021
1 parent c685292 commit dbdf7c7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/test/ui/iterators/into-iter-on-arrays-2018.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/iterators/into-iter-on-arrays-2018.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/iterators/into-iter-on-arrays-lint.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass
// run-rustfix
// rustfix-only-machine-applicable

fn main() {
let small = [1, 2];
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/iterators/into-iter-on-arrays-lint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-pass
// run-rustfix
// rustfix-only-machine-applicable

fn main() {
let small = [1, 2];
Expand Down
24 changes: 12 additions & 12 deletions src/test/ui/iterators/into-iter-on-arrays-lint.stderr
Original file line number Diff line number Diff line change
@@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand All @@ -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();
| ^^^^^^^^^
Expand Down

0 comments on commit dbdf7c7

Please sign in to comment.