]> git.lizzy.rs Git - rust.git/blob - tests/ui/rust-2021/future-prelude-collision-generic-trait.rs
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=GuillaumeGomez
[rust.git] / tests / ui / rust-2021 / future-prelude-collision-generic-trait.rs
1 // See https://github.com/rust-lang/rust/issues/88470
2 // run-rustfix
3 // edition:2018
4 // check-pass
5 #![warn(rust_2021_prelude_collisions)]
6 #![allow(dead_code)]
7 #![allow(unused_imports)]
8
9 pub trait PyTryFrom<'v, T>: Sized {
10     fn try_from<V>(value: V) -> Result<&'v Self, T>;
11 }
12
13 pub trait PyTryInto<T>: Sized {
14     fn try_into(&self) -> Result<&T, i32>;
15 }
16
17 struct Foo;
18
19 impl<U> PyTryInto<U> for Foo
20 where
21     U: for<'v> PyTryFrom<'v, i32>,
22 {
23     fn try_into(&self) -> Result<&U, i32> {
24         U::try_from(self)
25         //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
26         //~| this is accepted in the current edition (Rust 2018)
27     }
28 }
29
30 fn main() {}