You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Teach pub(crate) use for E0364 on macro_rules! #145140
mod macros {macro_rules! foo {() => {};}pubuse 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.
Activity
makai410 commentedon Aug 9, 2025
@rustbot claim
Rollup merge of rust-lang#145166 - makai410:teach-pub-crate, r=lcnr
Rollup merge of rust-lang#145166 - makai410:teach-pub-crate, r=lcnr
Rollup merge of rust-lang#145166 - makai410:teach-pub-crate, r=lcnr
Rollup merge of rust-lang#145166 - makai410:teach-pub-crate, r=lcnr
Unrolled build for #145166
Rollup merge of #145166 - makai410:teach-pub-crate, r=lcnr