about summary refs log tree commit diff
path: root/tests/ui/underscore-imports/hygiene.rs
blob: 3c0654a327e698bd97103a4616e9dce2af66d414 (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
41
// Make sure that underscore imports have the same hygiene considerations as other imports.

//@ check-pass

#![feature(decl_macro)]
#![allow(noop_method_call)]

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();
}