summaryrefslogtreecommitdiffstats
path: root/src/test/ui/underscore-imports/hygiene-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/underscore-imports/hygiene-2.rs')
-rw-r--r--src/test/ui/underscore-imports/hygiene-2.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/underscore-imports/hygiene-2.rs b/src/test/ui/underscore-imports/hygiene-2.rs
new file mode 100644
index 000000000..510d91d0d
--- /dev/null
+++ b/src/test/ui/underscore-imports/hygiene-2.rs
@@ -0,0 +1,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();
+}