@@ -38,12 +38,14 @@ impl TryIntoU32 for *const u16 {
38
38
39
39
trait FromByteIterator {
40
40
fn from_iter<T>(iter: T) -> Self
41
- where T: Iterator<Item = u8>;
41
+ where
42
+ T: Iterator<Item = u8>;
42
43
}
43
44
44
45
impl FromByteIterator for Vec<u8> {
45
46
fn from_iter<T>(iter: T) -> Self
46
- where T: Iterator<Item = u8>
47
+ where
48
+ T: Iterator<Item = u8>,
47
49
{
48
50
iter.collect()
49
51
}
@@ -53,44 +55,44 @@ fn main() {
53
55
// test dot-call that will break in 2021 edition
54
56
let _: u32 = TryIntoU32::try_into(3u8).unwrap();
55
57
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
56
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
58
+ //~^^ WARNING this is accepted in the current edition
57
59
58
60
// test associated function call that will break in 2021 edition
59
61
let _ = <u32 as TryFromU8>::try_from(3u8).unwrap();
60
62
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
61
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
63
+ //~^^ WARNING this is accepted in the current edition
62
64
63
65
// test reverse turbofish too
64
66
let _ = <Vec<u8> as FromByteIterator>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter());
65
67
//~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
66
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
68
+ //~^^ WARNING this is accepted in the current edition
67
69
68
70
// negative testing lint (this line should *not* emit a warning)
69
71
let _: u32 = TryFromU8::try_from(3u8).unwrap();
70
72
71
73
// test type omission
72
74
let _: u32 = <_ as TryFromU8>::try_from(3u8).unwrap();
73
75
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
74
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
76
+ //~^^ WARNING this is accepted in the current edition
75
77
76
78
// test autoderef
77
79
let _: u32 = TryIntoU32::try_into(*(&3u8)).unwrap();
78
80
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
79
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
81
+ //~^^ WARNING this is accepted in the current edition
80
82
81
83
// test autoref
82
84
let _: u32 = TryIntoU32::try_into(&3.0).unwrap();
83
85
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
84
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
86
+ //~^^ WARNING this is accepted in the current edition
85
87
86
88
let mut data = 3u16;
87
89
let mut_ptr = std::ptr::addr_of_mut!(data);
88
90
let _: u32 = TryIntoU32::try_into(mut_ptr as *const _).unwrap();
89
91
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
90
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
92
+ //~^^ WARNING this is accepted in the current edition
91
93
92
94
type U32Alias = u32;
93
95
let _ = <U32Alias as TryFromU8>::try_from(3u8).unwrap();
94
96
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
95
- //~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
97
+ //~^^ WARNING this is accepted in the current edition
96
98
}
0 commit comments