4 #![warn(rust_2021_prelude_collisions)]
6 #![allow(unused_imports)]
10 fn try_into(self) -> Result<u32, ()>;
13 impl TryIntoU32 for u8 {
14 fn try_into(self) -> Result<u32, ()> {
19 pub trait AnotherTrick {}
23 use crate::m::TryIntoU32;
26 // In this case, we can just use `TryIntoU32`
27 let _: u32 = TryIntoU32::try_into(3u8).unwrap();
28 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
29 //~^^ WARNING this is accepted in the current edition
34 use crate::m::AnotherTrick as TryIntoU32;
35 use crate::m::TryIntoU32 as _;
38 // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use
39 // the path `crate::m::TryIntoU32` (with which it was imported).
40 let _: u32 = crate::m::TryIntoU32::try_into(3u8).unwrap();
41 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
42 //~^^ WARNING this is accepted in the current edition
47 use super::m::TryIntoU32 as _;
48 use crate::m::AnotherTrick as TryIntoU32;
51 // In this case, a `TryIntoU32::try_into` rewrite will not work, and we need to use
52 // the path `super::m::TryIntoU32` (with which it was imported).
53 let _: u32 = super::m::TryIntoU32::try_into(3u8).unwrap();
54 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
55 //~^^ WARNING this is accepted in the current edition
63 // See https://github.com/rust-lang/rust/issues/88471
64 let _: u32 = TryIntoU32::try_into(3u8).unwrap();
65 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
66 //~^^ WARNING this is accepted in the current edition