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.
Motivation
Attempted fix for #2075, see also #2075 (comment).
Solution
This tries to work within the 0.2 approach of using
doc(cfg(feature = "…"))
by adding an additionaldoc(cfg)
to ensure themacros
feature requirement is included in rustdoc.Then it adds some plain-english rustdoc to the descriptions of test and main macro options to explain the feature dependencies on those. There was previously some mixup with what macros these options (and associated usage examples) were applied, so that is also fixed here.
To test this locally, one can use the following:
RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --open --all-features
Note that this results in the following rustdoc generated output on these macros:
This is not entirely correct, but its better then what it is in current (0.2.11) docs:
I do not see a way to entirely override the
doc(cfg)
without unwinding the whole set ofcfg_*
macros which seems rather invasive. Perhaps this PR can improve 0.2 as a stopgap, and the approach of applyingdoc(cfg)
can be more generally revisited for 0.3/1.0?