about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2021-03-31 15:43:33 -0300
committerSantiago Pastorino <spastorino@gmail.com>2021-04-23 10:40:32 -0300
commit0e4d2fd447602f8cc9cf2eb9851cdfddfbcd6f3d (patch)
tree6e5549a1d04acb5a99655b1e6076d7e60c45379e /src
parent5f1aeb52c22e3784928765e34be6dc0d17a350b4 (diff)
downloadrust-0e4d2fd447602f8cc9cf2eb9851cdfddfbcd6f3d.tar.gz
rust-0e4d2fd447602f8cc9cf2eb9851cdfddfbcd6f3d.zip
Revert "Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis"
This reverts commit e2561c58a41023a14e0e583113dcf55e1ecb236a, reversing
changes made to 2982ba50fc4bb629b8fe4108a81cb2f9b053510b.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/did_you_mean/pub-macro-rules.rs16
-rw-r--r--src/test/ui/did_you_mean/pub-macro-rules.stderr8
-rw-r--r--src/test/ui/feature-gates/feature-gate-pub_macro_rules.rs10
-rw-r--r--src/test/ui/feature-gates/feature-gate-pub_macro_rules.stderr39
-rw-r--r--src/test/ui/macros/macro-export-on-modularized-macros.rs11
-rw-r--r--src/test/ui/macros/macro-export-on-modularized-macros.stderr14
-rw-r--r--src/test/ui/macros/pub-macro-rules-fail.rs28
-rw-r--r--src/test/ui/macros/pub-macro-rules-fail.stderr48
-rw-r--r--src/test/ui/macros/pub-macro-rules.rs20
9 files changed, 24 insertions, 170 deletions
diff --git a/src/test/ui/did_you_mean/pub-macro-rules.rs b/src/test/ui/did_you_mean/pub-macro-rules.rs
new file mode 100644
index 00000000000..c5393703f70
--- /dev/null
+++ b/src/test/ui/did_you_mean/pub-macro-rules.rs
@@ -0,0 +1,16 @@
+#[macro_use] mod bleh {
+    pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation
+        ($n:ident) => (
+            fn $n () -> i32 {
+                1
+            }
+        )
+    }
+
+}
+
+foo!(meh);
+
+fn main() {
+    println!("{}", meh());
+}
diff --git a/src/test/ui/did_you_mean/pub-macro-rules.stderr b/src/test/ui/did_you_mean/pub-macro-rules.stderr
new file mode 100644
index 00000000000..0bde5783b8c
--- /dev/null
+++ b/src/test/ui/did_you_mean/pub-macro-rules.stderr
@@ -0,0 +1,8 @@
+error: can't qualify macro_rules invocation with `pub`
+  --> $DIR/pub-macro-rules.rs:2:5
+   |
+LL |     pub macro_rules! foo {
+   |     ^^^ help: try exporting the macro: `#[macro_export]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/feature-gates/feature-gate-pub_macro_rules.rs b/src/test/ui/feature-gates/feature-gate-pub_macro_rules.rs
deleted file mode 100644
index 5504ec317ae..00000000000
--- a/src/test/ui/feature-gates/feature-gate-pub_macro_rules.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-pub macro_rules! m1 { () => {} } //~ ERROR `pub` on `macro_rules` items is unstable
-
-#[cfg(FALSE)]
-pub macro_rules! m2 { () => {} } //~ ERROR `pub` on `macro_rules` items is unstable
-
-pub(crate) macro_rules! m3 { () => {} } //~ ERROR `pub` on `macro_rules` items is unstable
-
-pub(in self) macro_rules! m4 { () => {} } //~ ERROR `pub` on `macro_rules` items is unstable
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-pub_macro_rules.stderr b/src/test/ui/feature-gates/feature-gate-pub_macro_rules.stderr
deleted file mode 100644
index bfaec398d9a..00000000000
--- a/src/test/ui/feature-gates/feature-gate-pub_macro_rules.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0658]: `pub` on `macro_rules` items is unstable
-  --> $DIR/feature-gate-pub_macro_rules.rs:1:1
-   |
-LL | pub macro_rules! m1 { () => {} }
-   | ^^^
-   |
-   = note: see issue #78855 <https://github.com/rust-lang/rust/issues/78855> for more information
-   = help: add `#![feature(pub_macro_rules)]` to the crate attributes to enable
-
-error[E0658]: `pub` on `macro_rules` items is unstable
-  --> $DIR/feature-gate-pub_macro_rules.rs:4:1
-   |
-LL | pub macro_rules! m2 { () => {} }
-   | ^^^
-   |
-   = note: see issue #78855 <https://github.com/rust-lang/rust/issues/78855> for more information
-   = help: add `#![feature(pub_macro_rules)]` to the crate attributes to enable
-
-error[E0658]: `pub` on `macro_rules` items is unstable
-  --> $DIR/feature-gate-pub_macro_rules.rs:6:1
-   |
-LL | pub(crate) macro_rules! m3 { () => {} }
-   | ^^^^^^^^^^
-   |
-   = note: see issue #78855 <https://github.com/rust-lang/rust/issues/78855> for more information
-   = help: add `#![feature(pub_macro_rules)]` to the crate attributes to enable
-
-error[E0658]: `pub` on `macro_rules` items is unstable
-  --> $DIR/feature-gate-pub_macro_rules.rs:8:1
-   |
-LL | pub(in self) macro_rules! m4 { () => {} }
-   | ^^^^^^^^^^^^
-   |
-   = note: see issue #78855 <https://github.com/rust-lang/rust/issues/78855> for more information
-   = help: add `#![feature(pub_macro_rules)]` to the crate attributes to enable
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/macros/macro-export-on-modularized-macros.rs b/src/test/ui/macros/macro-export-on-modularized-macros.rs
deleted file mode 100644
index 467c6ba7b78..00000000000
--- a/src/test/ui/macros/macro-export-on-modularized-macros.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![feature(decl_macro)]
-#![feature(pub_macro_rules)]
-
-#[macro_export]
-macro m1() {} //~ ERROR `#[macro_export]` cannot be used on `macro` items
-
-#[macro_export]
-pub macro_rules! m2 { () => {} }
-//~^ ERROR `#[macro_export]` cannot be used on `macro_rules` with `pub`
-
-fn main() {}
diff --git a/src/test/ui/macros/macro-export-on-modularized-macros.stderr b/src/test/ui/macros/macro-export-on-modularized-macros.stderr
deleted file mode 100644
index 8bb031e12cb..00000000000
--- a/src/test/ui/macros/macro-export-on-modularized-macros.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: `#[macro_export]` cannot be used on `macro` items
-  --> $DIR/macro-export-on-modularized-macros.rs:5:1
-   |
-LL | macro m1() {}
-   | ^^^^^^^^^^^^^
-
-error: `#[macro_export]` cannot be used on `macro_rules` with `pub`
-  --> $DIR/macro-export-on-modularized-macros.rs:8:1
-   |
-LL | pub macro_rules! m2 { () => {} }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/macros/pub-macro-rules-fail.rs b/src/test/ui/macros/pub-macro-rules-fail.rs
deleted file mode 100644
index bdb4c73f18b..00000000000
--- a/src/test/ui/macros/pub-macro-rules-fail.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![feature(pub_macro_rules)]
-
-#[macro_use]
-mod m {
-    pub macro_rules! mac { () => {} }
-
-    // `pub` `macro_rules` cannot be redefined in the same module.
-    pub macro_rules! mac { () => {} } //~ ERROR the name `mac` is defined multiple times
-
-    pub(self) macro_rules! private_mac { () => {} }
-}
-
-const _: () = {
-    pub macro_rules! block_mac { () => {} }
-};
-
-mod n {
-    // Scope of `pub` `macro_rules` is not extended by `#[macro_use]`.
-    mac!(); //~ ERROR cannot find macro `mac` in this scope
-
-    // `pub` `macro_rules` doesn't put the macro into the root module, unlike `#[macro_export]`.
-    crate::mac!(); //~ ERROR failed to resolve: maybe a missing crate `mac`
-    crate::block_mac!(); //~ ERROR failed to resolve: maybe a missing crate `block_mac`
-
-    crate::m::private_mac!(); //~ ERROR macro `private_mac` is private
-}
-
-fn main() {}
diff --git a/src/test/ui/macros/pub-macro-rules-fail.stderr b/src/test/ui/macros/pub-macro-rules-fail.stderr
deleted file mode 100644
index 588d79dd76a..00000000000
--- a/src/test/ui/macros/pub-macro-rules-fail.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error[E0428]: the name `mac` is defined multiple times
-  --> $DIR/pub-macro-rules-fail.rs:8:5
-   |
-LL |     pub macro_rules! mac { () => {} }
-   |     -------------------- previous definition of the macro `mac` here
-...
-LL |     pub macro_rules! mac { () => {} }
-   |     ^^^^^^^^^^^^^^^^^^^^ `mac` redefined here
-   |
-   = note: `mac` must be defined only once in the macro namespace of this module
-
-error[E0433]: failed to resolve: maybe a missing crate `mac`?
-  --> $DIR/pub-macro-rules-fail.rs:22:12
-   |
-LL |     crate::mac!();
-   |            ^^^ maybe a missing crate `mac`?
-
-error[E0433]: failed to resolve: maybe a missing crate `block_mac`?
-  --> $DIR/pub-macro-rules-fail.rs:23:12
-   |
-LL |     crate::block_mac!();
-   |            ^^^^^^^^^ maybe a missing crate `block_mac`?
-
-error: cannot find macro `mac` in this scope
-  --> $DIR/pub-macro-rules-fail.rs:19:5
-   |
-LL |     mac!();
-   |     ^^^
-   |
-   = note: consider importing this macro:
-           m::mac
-
-error[E0603]: macro `private_mac` is private
-  --> $DIR/pub-macro-rules-fail.rs:25:15
-   |
-LL |     crate::m::private_mac!();
-   |               ^^^^^^^^^^^ private macro
-   |
-note: the macro `private_mac` is defined here
-  --> $DIR/pub-macro-rules-fail.rs:10:5
-   |
-LL |     pub(self) macro_rules! private_mac { () => {} }
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 5 previous errors
-
-Some errors have detailed explanations: E0428, E0433, E0603.
-For more information about an error, try `rustc --explain E0428`.
diff --git a/src/test/ui/macros/pub-macro-rules.rs b/src/test/ui/macros/pub-macro-rules.rs
deleted file mode 100644
index cd4a845f7c0..00000000000
--- a/src/test/ui/macros/pub-macro-rules.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// check-pass
-
-#![feature(pub_macro_rules)]
-
-mod m {
-    // `pub` `macro_rules` can be used earlier in item order than they are defined.
-    foo!();
-
-    pub macro_rules! foo { () => {} }
-
-    // `pub(...)` works too.
-    pub(super) macro_rules! bar { () => {} }
-}
-
-// `pub` `macro_rules` are available by module path.
-m::foo!();
-
-m::bar!();
-
-fn main() {}