fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
2.9 KiB58 linesraw
1// run-pass
2// run-rustfix
3
4fn main() {
5    let small = [1, 2];
6    let big = [0u8; 33];
7
8    // Expressions that should trigger the lint
9    small.iter();
10    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
11    //~| WARNING this was previously accepted by the compiler but is being phased out
12    [1, 2].iter();
13    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
14    //~| WARNING this was previously accepted by the compiler but is being phased out
15    big.iter();
16    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
17    //~| WARNING this was previously accepted by the compiler but is being phased out
18    [0u8; 33].iter();
19    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
20    //~| WARNING this was previously accepted by the compiler but is being phased out
21
22    Box::new(small).iter();
23    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
24    //~| WARNING this was previously accepted by the compiler but is being phased out
25    Box::new([1, 2]).iter();
26    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
27    //~| WARNING this was previously accepted by the compiler but is being phased out
28    Box::new(big).iter();
29    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
30    //~| WARNING this was previously accepted by the compiler but is being phased out
31    Box::new([0u8; 33]).iter();
32    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
33    //~| WARNING this was previously accepted by the compiler but is being phased out
34
35    Box::new(Box::new(small)).iter();
36    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
37    //~| WARNING this was previously accepted by the compiler but is being phased out
38    Box::new(Box::new([1, 2])).iter();
39    //~^ WARNING this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter`
40    //~| WARNING this was previously accepted by the compiler but is being phased out
41    Box::new(Box::new(big)).iter();
42    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
43    //~| WARNING this was previously accepted by the compiler but is being phased out
44    Box::new(Box::new([0u8; 33])).iter();
45    //~^ WARNING this method call currently resolves to `<&[T] as IntoIterator>::into_iter`
46    //~| WARNING this was previously accepted by the compiler but is being phased out
47
48    // Expressions that should not
49    (&[1, 2]).into_iter();
50    (&small).into_iter();
51    (&[0u8; 33]).into_iter();
52    (&big).into_iter();
53
54    for _ in &[1, 2] {}
55    (&small as &[_]).into_iter();
56    small[..].into_iter();
57    std::iter::IntoIterator::into_iter(&[1, 2]);
58}