You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#85682 - m-ou-se:array-into-iter-2, r=nikomatsakis
Update array_into_iter lint for 1.53 and edition changes.
This updates the array_into_iter lint for Rust 1.53 and the edition changes.
See rust-lang#84513
r? `@estebank`
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
1
+
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
2
--> $DIR/into-iter-on-arrays-2018.rs:14:34
3
3
|
4
4
LL | let _: Iter<'_, i32> = array.into_iter();
5
-
| ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
5
+
| ^^^^^^^^^
6
6
|
7
7
= note: `#[warn(array_into_iter)]` on by default
8
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9
-
= note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
8
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
9
+
|
10
+
LL | let _: Iter<'_, i32> = array.iter();
11
+
| ^^^^
12
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
13
+
|
14
+
LL | let _: Iter<'_, i32> = IntoIterator::into_iter(array);
15
+
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
10
16
11
-
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
12
-
--> $DIR/into-iter-on-arrays-2018.rs:18:44
17
+
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.
18
+
--> $DIR/into-iter-on-arrays-2018.rs:17:44
13
19
|
14
20
LL | let _: Iter<'_, i32> = Box::new(array).into_iter();
15
-
| ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
21
+
| ^^^^^^^^^
16
22
|
17
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
18
-
= note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
24
-
--> $DIR/into-iter-on-arrays-2018.rs:14:34
23
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
25
24
|
26
-
LL | let _: Iter<'_, i32> = array.into_iter();
27
-
| ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
25
+
LL | let _: Iter<'_, i32> = Box::new(array).iter();
26
+
| ^^^^
27
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
28
28
|
29
-
= note: `#[warn(array_into_iter)]` on by default
30
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
31
-
= note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
29
+
LL | let _: Iter<'_, i32> = IntoIterator::into_iter(Box::new(array));
30
+
| ^^^^^^^^^^^^^^^^^^^^^^^^ ^
32
31
33
-
Future breakage date: None, diagnostic:
34
-
warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added.
35
-
--> $DIR/into-iter-on-arrays-2018.rs:18:44
32
+
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.
33
+
--> $DIR/into-iter-on-arrays-2018.rs:27:24
36
34
|
37
-
LL | let _: Iter<'_, i32> = Box::new(array).into_iter();
38
-
| ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
35
+
LL | for _ in [1, 2, 3].into_iter() {}
36
+
| ^^^^^^^^^
37
+
|
38
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
39
39
|
40
-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
41
-
= note: for more information, see issue #66145 <https://github.com/rust-lang/rust/issues/66145>
40
+
LL | for _ in [1, 2, 3].iter() {}
41
+
| ^^^^
42
+
help: or remove `.into_iter()` to iterate by value
0 commit comments