diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-06-15 00:42:10 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-06-15 00:42:10 +0900 |
| commit | d29915af79f4a372647b67e7d83f1fc4aabbb92a (patch) | |
| tree | ca0d57e12b998c6b9249230f0183c0ed5ea9c36c | |
| parent | 0d24405211404f5e6b5a746af1ecd08d3d2b4438 (diff) | |
| download | rust-d29915af79f4a372647b67e7d83f1fc4aabbb92a.tar.gz rust-d29915af79f4a372647b67e7d83f1fc4aabbb92a.zip | |
add a test case for `decl_macro`
| -rw-r--r-- | src/test/ui/privacy/macro-private-reexport.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/privacy/macro-private-reexport.stderr | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/test/ui/privacy/macro-private-reexport.rs b/src/test/ui/privacy/macro-private-reexport.rs index bc3e6fb5c59..d0aab528ed4 100644 --- a/src/test/ui/privacy/macro-private-reexport.rs +++ b/src/test/ui/privacy/macro-private-reexport.rs @@ -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() {} diff --git a/src/test/ui/privacy/macro-private-reexport.stderr b/src/test/ui/privacy/macro-private-reexport.stderr index af85cbcf3f2..b8768f3612e 100644 --- a/src/test/ui/privacy/macro-private-reexport.stderr +++ b/src/test/ui/privacy/macro-private-reexport.stderr @@ -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`. |
