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 {
try_into(self) -> Result<u32, ()>8         fn try_into(self) -> Result<u32, ()>;
9     }
10 
11     impl TryIntoU32 for u8 {
try_into(self) -> Result<u32, ()>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 
main()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 
main()32 fn main() {}
33