rustdoc: add support for macro_rules macros of multiple kinds #148005
+344
−108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for advanced RFC 3697 and 3698 macros, that look like this:
And can be used like this:
The basic problem is that there are three different ways to use this macro, and, historically, these three ways were implemented by fully-separated proc macro items with separate doc comments. We want these new declarative macros to work the same way, so they appear in the same section of the module table of contents and can be filtered for in the search engine.
This commit makes the feature work by generating separate pages for each macro kind. These separate pages appear in separate sections of the module table of contents, produce separate search results, and have duplicate copies of the doc comment.
The following features would also be helpful, but are left for future commits to implement:
To improve the produced documentation, we should probably add support for adding
///
attributes to macro rules arms, so that the different syntaxes can actually be documented separately.This commit doesn't test intra-doc links.
Parts of #145458 are directly used in this code.
cc @joshtriplett @GuillaumeGomez @lolbinarycat