summaryrefslogtreecommitdiffstats
path: root/src/test/ui/underscore-imports/hygiene-2.rs
blob: 510d91d0d462487ee91e4cbfc18739f919b0448d (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
// Make sure that underscore imports with different contexts can exist in the
// same scope.

// check-pass

#![feature(decl_macro)]

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

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

#[macro_export]
macro_rules! p {
    () => { pub use crate::x::*; }
}

macro m($y:ident) {
    mod $y {
        crate::n!(); // Reexport of `Deref` should not be imported in `main`
        crate::p!(); // Reexport of `Deref` should be imported into `main`
    }
}

m!(y);

fn main() {
    use crate::y::*;
    #[allow(noop_method_call)]
    (&()).deref();
}