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> { try_into(self, _: u8)15 fn try_into(self, _: u8); 16 } 17 18 struct S; 19 20 impl MyTry<i32> for S { try_into(self, _: u8)21 fn try_into(self, _: u8) {} 22 } 23 24 trait TryFromU8: Sized { try_from(_: u8)25 fn try_from(_: u8); 26 } 27 28 impl TryFromU8 for u32 { try_from(_: u8)29 fn try_from(_: u8) {} 30 } 31 32 macro_rules! bar { 33 () => { 34 u32 35 }; 36 } 37 main()38fn main() { 39 foo!().try_into(todo!()); 40 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021 41 //~| WARNING this is accepted in the current edition 42 <bar!()>::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 } 46