Skip to content

Re-exported proc-macros are documented incorrectly #68690

Closed
@SergioBenitez

Description

@SergioBenitez

When multiple proc-macros are re-exported, their documentation is permuted in such a way that the docs for one macro become the docs for another. For a specific case, consider Rocket's proc-macros, defined in earnest in the rocket_codegen crate. The documentation for the rocket_codegen crate, which is rendered correctly and as expected, looks like:

|-----------------|----------------------------------------------------------|
| async_test      |                                                          |
| catchers        | Generates a Vec of Catchers from a set of catcher paths. |
| routes          | Generates a Vec of Routes from a set of route paths.     |
| uri             | Type safe generation of route URIs.                      |
| catch           | Attribute to generate a Catcher and associated metadata. |
| delete          | Attribute to generate a Route and associated metadata.   |
| get             | Attribute to generate a Route and associated metadata.   |
| head            | Attribute to generate a Route and associated metadata.   |
| options         | Attribute to generate a Route and associated metadata.   |
| patch           | Attribute to generate a Route and associated metadata.   |
| post            | Attribute to generate a Route and associated metadata.   |
| put             | Attribute to generate a Route and associated metadata.   |
| route           | Attribute to generate a Route and associated metadata.   |
| FromForm        | Derive for the FromForm trait.                           |
| FromFormValue   | Derive for the FromFormValue trait.                      |
| Responder       | Derive for the Responder trait.                          |
| UriDisplayPath  | Derive for the UriDisplay<Path> trait.                   |
| UriDisplayQuery | Derive for the UriDisplay<Query> trait.                  |
|-----------------|----------------------------------------------------------|

When these proc-macros are re-exported from rocket via pub use rocket_codegen::*, their documentation in rocket is rendered as:

|---------------------|----------------------------------------------------------|
| async_test          | Type safe generation of route URIs.                      |
| catchers            | Attribute to generate a Route and associated metadata.   |
| rocket_internal_uri | Attribute to generate a Route and associated metadata.   |
| routes              | Attribute to generate a Route and associated metadata.   |
| uri                 | Attribute to generate a Route and associated metadata.   |
| catch               | Generates a Vec of Catchers from a set of catcher paths. |
| delete              | Derive for the Responder trait.                          |
| get                 |                                                          |
| head                | Derive for the UriDisplay<Query> trait.                  |
| options             | Generates a Vec of Routes from a set of route paths.     |
| patch               | Derive for the UriDisplay<Path> trait.                   |
| post                | Derive for the FromForm trait.                           |
| put                 | Derive for the FromFormValue trait.                      |
| route               | Attribute to generate a Catcher and associated metadata. |
| FromForm            | Attribute to generate a Route and associated metadata.   |
| Responder           | Attribute to generate a Route and associated metadata.   |
| UriDisplayPath      | Attribute to generate a Route and associated metadata.   |
| UriDisplayQuery     | Attribute to generate a Route and associated metadata.   |
|---------------------|----------------------------------------------------------|

Clicking through an item leads to the documentation alluded to by the snippet which is similarly incorrect.

Note that rocket_internal_uri is #[doc(hidden)] in rocket_codegen; it erroneously appears in rocket. Also note that FromFormValue is missing in rocket. The expected rendering, of course, is one identical to the rendering for rocket_codegen.

Metadata

Metadata

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions