Code
mod macros {
macro_rules! foo { () => {}; }
pub use foo;
}
Current output
error[E0364]: `foo` is only public within the crate, and cannot be re-exported outside
--> src/lib.rs:3:13
|
3 | pub use foo;
| ^^^
|
help: consider adding a `#[macro_export]` to the macro in the imported module
--> src/lib.rs:2:5
|
2 | macro_rules! foo { () => {}; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Desired output
In addition to the current output:
help: or, if you want to use the macro within this crate only, reduce the visibility to `pub(crate)`
|
| pub(crate) use foo;
| ^^^^^^^^^^
Rationale and extra context
macro_rules! export behavior is unique and weirdly restricted, and needs to be taught in more detail so users can write the program that is as close to what they actually want as possible.
Rust Version
Anything else?
@rustbot label +A-macros
Code
Current output
Desired output
In addition to the current output:
Rationale and extra context
macro_rules!export behavior is unique and weirdly restricted, and needs to be taught in more detail so users can write the program that is as close to what they actually want as possible.Rust Version
Anything else?
@rustbot label +A-macros