]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rust-2021/future-prelude-collision-shadow.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / ui / rust-2021 / future-prelude-collision-shadow.rs
1 // edition:2018
2 #![warn(rust_2021_prelude_collisions)]
3 #![allow(dead_code)]
4 #![allow(unused_imports)]
5
6 mod m {
7     pub trait TryIntoU32 {
8         fn try_into(self) -> Result<u32, ()>;
9     }
10
11     impl TryIntoU32 for u8 {
12         fn try_into(self) -> Result<u32, ()> {
13             Ok(self as u32)
14         }
15     }
16
17     pub trait AnotherTrick {}
18 }
19
20 mod d {
21     use crate::m::AnotherTrick as TryIntoU32;
22     use crate::m::*;
23
24     fn main() {
25         // Here, `TryIntoU32` is imported but shadowed, but in that case we don't permit its methods
26         // to be available.
27         let _: u32 = 3u8.try_into().unwrap();
28         //~^ ERROR no method named `try_into` found for type `u8` in the current scope
29     }
30 }
31
32 fn main() {}