Rustdoc: pub use
ing and/or globbing a submodule containing a pub macro
(Macros 2.0) does not document the macro
#87257
Labels
A-macros-2.0
Area: Declarative macros 2.0 (#39412)
C-bug
Category: This is a bug.
requires-nightly
This issue requires a nightly compiler in some way.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Rustdoc will properly generate the documentation for a Macros-2.0 macro when that macro is defined in a directly-exported submodule, e.g.
pub mod foo { pub macro bar()
. But if the module is not directly exported (pub mod foo {
) but indirectly exported (pub use foo;
) then the macro no longer exists in the documentation: the module documentation formod foo
will not mention it, and no page for the macro will be generated at all. The same problem occurs if a macro is exported viapub use foo::*
.Note that these are not problems with name resolution itself: Rust code will resolve the exported macro properly, the docs merely don't show it.
Example:
(In the above example even though
some_macro
is not listed in the docs forinner
, the docs page forsome_macro
will still be generated because of the explicitpub use outer::inner::some_macro
; if this line is removed then that page will also vanish.)Presumably this is a descendant of #74355 , where Macros-2.0 were not being documented at the correct paths. The fix for that issue landed in #77862 , although the fix itself appears to be regarded as a deplorable hack, and presumably the fix for this issue should not attempt to further hack the hack and instead make Macros 2.0 Just Work with Rustdoc.
The text was updated successfully, but these errors were encountered: