Re-export a macro with the name same as a module

This works: pub use core::stringify;

But this reexports the module instead of the macro with the same name:
pub use core::panic;

I've tried many ways but can't find a way that workrs. I wonder if this is even possible.

I know we can disambiguate intra-doc links with the [mod@panic] and [macro@panic] syntax but tha doesn't seem applicable for imports.

Not quite… it reexports both. The tricky part is if you wanted to reexport only one of the two.

It you want just the module, you can still do pub use core::panic::{self}; For just the macro, I’m not sure there’s any way.

1 Like

Thank you for the quick answer. I think then this may be the only workaround, it justs needs you to document it from scratch.

/// Re-exported [`core::panic`][macro@panic].
macro_rules! panic { ($($tt:tt)*) => { core::panic![$($tt)*] } }
pub use panic;

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.