]> git.lizzy.rs Git - rust.git/blob - src/test/ui/underscore-imports/hygiene.rs
Rollup merge of #68059 - jethrogb:jb/target-llvm-args, r=alexcrichton
[rust.git] / src / test / ui / underscore-imports / hygiene.rs
1 // Make sure that underscore imports have the same hygiene considerations as
2 // other imports.
3
4 #![feature(decl_macro)]
5
6 mod x {
7     pub use std::ops::Deref as _;
8 }
9
10
11 macro glob_import() {
12     pub use crate::x::*;
13 }
14
15 macro underscore_import() {
16     use std::ops::DerefMut as _;
17 }
18
19 mod y {
20     crate::glob_import!();
21     crate::underscore_import!();
22 }
23
24 macro create_module($y:ident) {
25     mod $y {
26         crate::glob_import!();
27         crate::underscore_import!();
28     }
29 }
30
31 create_module!(z);
32
33 fn main() {
34     use crate::y::*;
35     use crate::z::*;
36     glob_import!();
37     underscore_import!();
38     (&()).deref();              //~ ERROR no method named `deref`
39     (&mut ()).deref_mut();      //~ ERROR no method named `deref_mut`
40 }