Skip to content

Commit dbdf7c7

Browse files
committed
Fix array-into-iter tests.
1 parent c685292 commit dbdf7c7

5 files changed

+18
-13
lines changed

src/test/ui/iterators/into-iter-on-arrays-2018.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828

2929
for _ in [1, 2, 3].into_iter() {}
3030
//~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter`
31+
//~| WARNING this changes meaning
3132
}
3233

3334
/// User type that dereferences to an array.

src/test/ui/iterators/into-iter-on-arrays-2018.stderr

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ LL | let _: Iter<'_, i32> = IntoIterator::into_iter(Box::new(array));
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
3535

3636
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.
37-
--> $DIR/into-iter-on-arrays-2018.rs:27:24
37+
--> $DIR/into-iter-on-arrays-2018.rs:29:24
3838
|
3939
LL | for _ in [1, 2, 3].into_iter() {}
4040
| ^^^^^^^^^
4141
|
42+
= warning: this changes meaning in Rust 2021
43+
= note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
4244
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
4345
|
4446
LL | for _ in [1, 2, 3].iter() {}

src/test/ui/iterators/into-iter-on-arrays-lint.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22
// run-rustfix
3+
// rustfix-only-machine-applicable
34

45
fn main() {
56
let small = [1, 2];

src/test/ui/iterators/into-iter-on-arrays-lint.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22
// run-rustfix
3+
// rustfix-only-machine-applicable
34

45
fn main() {
56
let small = [1, 2];

src/test/ui/iterators/into-iter-on-arrays-lint.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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.
2-
--> $DIR/into-iter-on-arrays-lint.rs:9:11
2+
--> $DIR/into-iter-on-arrays-lint.rs:10:11
33
|
44
LL | small.into_iter();
55
| ^^^^^^^^^
@@ -17,7 +17,7 @@ LL | IntoIterator::into_iter(small);
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
1818

1919
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.
20-
--> $DIR/into-iter-on-arrays-lint.rs:12:12
20+
--> $DIR/into-iter-on-arrays-lint.rs:13:12
2121
|
2222
LL | [1, 2].into_iter();
2323
| ^^^^^^^^^
@@ -34,7 +34,7 @@ LL | IntoIterator::into_iter([1, 2]);
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
3535

3636
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.
37-
--> $DIR/into-iter-on-arrays-lint.rs:15:9
37+
--> $DIR/into-iter-on-arrays-lint.rs:16:9
3838
|
3939
LL | big.into_iter();
4040
| ^^^^^^^^^
@@ -51,7 +51,7 @@ LL | IntoIterator::into_iter(big);
5151
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
5252

5353
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.
54-
--> $DIR/into-iter-on-arrays-lint.rs:18:15
54+
--> $DIR/into-iter-on-arrays-lint.rs:19:15
5555
|
5656
LL | [0u8; 33].into_iter();
5757
| ^^^^^^^^^
@@ -68,7 +68,7 @@ LL | IntoIterator::into_iter([0u8; 33]);
6868
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
6969

7070
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.
71-
--> $DIR/into-iter-on-arrays-lint.rs:22:21
71+
--> $DIR/into-iter-on-arrays-lint.rs:23:21
7272
|
7373
LL | Box::new(small).into_iter();
7474
| ^^^^^^^^^
@@ -85,7 +85,7 @@ LL | IntoIterator::into_iter(Box::new(small));
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
8686

8787
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.
88-
--> $DIR/into-iter-on-arrays-lint.rs:25:22
88+
--> $DIR/into-iter-on-arrays-lint.rs:26:22
8989
|
9090
LL | Box::new([1, 2]).into_iter();
9191
| ^^^^^^^^^
@@ -102,7 +102,7 @@ LL | IntoIterator::into_iter(Box::new([1, 2]));
102102
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
103103

104104
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.
105-
--> $DIR/into-iter-on-arrays-lint.rs:28:19
105+
--> $DIR/into-iter-on-arrays-lint.rs:29:19
106106
|
107107
LL | Box::new(big).into_iter();
108108
| ^^^^^^^^^
@@ -119,7 +119,7 @@ LL | IntoIterator::into_iter(Box::new(big));
119119
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
120120

121121
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.
122-
--> $DIR/into-iter-on-arrays-lint.rs:31:25
122+
--> $DIR/into-iter-on-arrays-lint.rs:32:25
123123
|
124124
LL | Box::new([0u8; 33]).into_iter();
125125
| ^^^^^^^^^
@@ -136,7 +136,7 @@ LL | IntoIterator::into_iter(Box::new([0u8; 33]));
136136
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
137137

138138
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.
139-
--> $DIR/into-iter-on-arrays-lint.rs:35:31
139+
--> $DIR/into-iter-on-arrays-lint.rs:36:31
140140
|
141141
LL | Box::new(Box::new(small)).into_iter();
142142
| ^^^^^^^^^
@@ -153,7 +153,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new(small)));
153153
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
154154

155155
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.
156-
--> $DIR/into-iter-on-arrays-lint.rs:38:32
156+
--> $DIR/into-iter-on-arrays-lint.rs:39:32
157157
|
158158
LL | Box::new(Box::new([1, 2])).into_iter();
159159
| ^^^^^^^^^
@@ -170,7 +170,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new([1, 2])));
170170
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
171171

172172
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.
173-
--> $DIR/into-iter-on-arrays-lint.rs:41:29
173+
--> $DIR/into-iter-on-arrays-lint.rs:42:29
174174
|
175175
LL | Box::new(Box::new(big)).into_iter();
176176
| ^^^^^^^^^
@@ -187,7 +187,7 @@ LL | IntoIterator::into_iter(Box::new(Box::new(big)));
187187
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
188188

189189
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.
190-
--> $DIR/into-iter-on-arrays-lint.rs:44:35
190+
--> $DIR/into-iter-on-arrays-lint.rs:45:35
191191
|
192192
LL | Box::new(Box::new([0u8; 33])).into_iter();
193193
| ^^^^^^^^^

0 commit comments

Comments
 (0)