about summary refs log tree commit diff
path: root/src/test/rustdoc-ui/coverage/json.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-23 16:09:41 +0000
committerbors <bors@rust-lang.org>2020-02-23 16:09:41 +0000
commitb1f395de642e8be7bcbbd2bd8aaadab715851f49 (patch)
tree756f27d09555da49a28a09148daf12b2c14a9b33 /src/test/rustdoc-ui/coverage/json.rs
parent87b0d83745c0cc5b3679e406fbdbf0e8a8bfd3c6 (diff)
parent09bc5e3d969a154ffcbeb6827a901d36a6a854eb (diff)
downloadrust-b1f395de642e8be7bcbbd2bd8aaadab715851f49.tar.gz
rust-b1f395de642e8be7bcbbd2bd8aaadab715851f49.zip
Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov
Split non macro portion of unused_doc_comment from macro part into two passes/lints

## Motivation

This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally.

## Approach

This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs.

The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable.

fixes https://github.com/rust-lang/rust/issues/67838
Diffstat (limited to 'src/test/rustdoc-ui/coverage/json.rs')
0 files changed, 0 insertions, 0 deletions