summaryrefslogtreecommitdiffstats
path: root/src/test/ui/underscore-imports/hygiene.rs
blob: c4db65245386f6641c8b6e156d22ba395b14f60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Make sure that underscore imports have the same hygiene considerations as other imports.

// check-pass

#![feature(decl_macro)]

mod x {
    pub use std::ops::Deref as _;
}

macro glob_import() {
    pub use crate::x::*;
}

macro underscore_import() {
    use std::ops::DerefMut as _;
}

mod y {
    crate::glob_import!();
    crate::underscore_import!();
}

macro create_module($y:ident) {
    mod $y {
        crate::glob_import!();
        crate::underscore_import!();
    }
}

create_module!(z);

fn main() {
    use crate::y::*;
    use crate::z::*;
    glob_import!();
    underscore_import!();
    (&()).deref();
    (&mut ()).deref_mut();
}