fork/rust

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

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

master
829 B45 linesraw
1// run-rustfix
2// edition:2018
3// check-pass
4#![warn(rust_2021_prelude_collisions)]
5#![allow(unreachable_code)]
6
7macro_rules! foo {
8    () => {{
9        123;
10        S
11    }};
12}
13
14trait MyTry<T> {
15    fn try_into(self, _: u8);
16}
17
18struct S;
19
20impl MyTry<i32> for S {
21    fn try_into(self, _: u8) {}
22}
23
24trait TryFromU8: Sized {
25    fn try_from(_: u8);
26}
27
28impl TryFromU8 for u32 {
29    fn try_from(_: u8) {}
30}
31
32macro_rules! bar {
33    () => {
34        u32
35    };
36}
37
38fn main() {
39    MyTry::try_into(foo!(), todo!());
40    //~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
41    //~| WARNING this is accepted in the current edition
42    <bar!() as TryFromU8>::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}