1 // See https://github.com/rust-lang/rust/issues/88442
6 #![warn(rust_2021_prelude_collisions)]
8 trait AnnotatableTryInto {
9 fn try_into<T>(self) -> Result<T, Self::Error>
10 where Self: std::convert::TryInto<T> {
11 std::convert::TryInto::try_into(self)
15 impl<T> AnnotatableTryInto for T where T: From<u8> {}
17 fn main() -> Result<(), &'static str> {
19 AnnotatableTryInto::try_into::<usize>(x).or(Err("foo"))?.checked_sub(1);
20 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
21 //~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
23 AnnotatableTryInto::try_into::<usize>(x).or(Err("foo"))?;
24 //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
25 //~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!