fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
713 B30 linesraw
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
9pub trait PyTryFrom<'v, T>: Sized {
10    fn try_from<V>(value: V) -> Result<&'v Self, T>;
11}
12
13pub trait PyTryInto<T>: Sized {
14    fn try_into(&self) -> Result<&T, i32>;
15}
16
17struct Foo;
18
19impl<U> PyTryInto<U> for Foo
20where
21    U: for<'v> PyTryFrom<'v, i32>,
22{
23    fn try_into(&self) -> Result<&U, i32> {
24        <U as PyTryFrom<'_, _>>::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
30fn main() {}