]>
Commit | Line | Data |
---|---|---|
94222f64 XL |
1 | // run-rustfix |
2 | // edition:2018 | |
3 | // check-pass | |
4 | #![warn(rust_2021_prelude_collisions)] | |
5 | #![allow(unreachable_code)] | |
6 | ||
7 | macro_rules! foo { | |
8 | () => {{ | |
9 | 123; | |
10 | S | |
11 | }}; | |
12 | } | |
13 | ||
14 | trait MyTry<T> { | |
15 | fn try_into(self, _: u8); | |
16 | } | |
17 | ||
18 | struct S; | |
19 | ||
20 | impl MyTry<i32> for S { | |
21 | fn try_into(self, _: u8) {} | |
22 | } | |
23 | ||
24 | trait TryFromU8: Sized { | |
25 | fn try_from(_: u8); | |
26 | } | |
27 | ||
28 | impl TryFromU8 for u32 { | |
29 | fn try_from(_: u8) {} | |
30 | } | |
31 | ||
32 | macro_rules! bar { | |
33 | () => { | |
34 | u32 | |
35 | }; | |
36 | } | |
37 | ||
38 | fn main() { | |
39 | MyTry::try_into(foo!(), todo!()); | |
40 | //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 | |
41 | //~| WARNING this is accepted in the current edition | |
42 | <bar!() as TryFromU8>::try_from(0); | |
43 | //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 | |
44 | //~| WARNING this is accepted in the current edition | |
45 | } |