Revert "Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis"
This reverts commite2561c58a4, reversing changes made to2982ba50fc.
This commit is contained in:
parent
5f1aeb52c2
commit
0e4d2fd447
14 changed files with 35 additions and 183 deletions
|
|
@ -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() {}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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() {}
|
||||
|
|
@ -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`.
|
||||
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue