add a test case for decl_macro

This commit is contained in:
Takayuki Maeda 2022-06-15 00:42:10 +09:00
parent 0d24405211
commit d29915af79
2 changed files with 21 additions and 3 deletions

View File

@ -1,11 +1,17 @@
// edition:2021
#![feature(decl_macro)]
mod foo {
macro_rules! bar {
() => {};
}
pub use bar as _; //~ ERROR `bar` is only public within the crate, and cannot be re-exported outside
macro baz() {}
pub use baz as _; //~ ERROR `baz` is private, and cannot be re-exported
}
fn main() {}

View File

@ -1,17 +1,29 @@
error[E0364]: `bar` is only public within the crate, and cannot be re-exported outside
--> $DIR/macro-private-reexport.rs:8:13
--> $DIR/macro-private-reexport.rs:10:13
|
LL | pub use bar as _;
| ^^^^^^^^
|
help: consider adding a `#[macro_export]` to the macro in the imported module
--> $DIR/macro-private-reexport.rs:4:5
--> $DIR/macro-private-reexport.rs:6:5
|
LL | / macro_rules! bar {
LL | | () => {};
LL | | }
| |_____^
error: aborting due to previous error
error[E0364]: `baz` is private, and cannot be re-exported
--> $DIR/macro-private-reexport.rs:14:13
|
LL | pub use baz as _;
| ^^^^^^^^
|
note: consider marking `baz` as `pub` in the imported module
--> $DIR/macro-private-reexport.rs:14:13
|
LL | pub use baz as _;
| ^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0364`.