rust/tests/ui/underscore-imports/hygiene-2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
577 B
Rust
Raw Normal View History

2019-09-07 20:22:36 +00:00
// 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::*;
2021-01-05 15:46:50 +00:00
#[allow(noop_method_call)]
2019-09-07 20:22:36 +00:00
(&()).deref();
}