Declare a new lint to properly deny warnings in rustdoc#79816
Declare a new lint to properly deny warnings in rustdoc#79816poliorcetics wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @jyn514 |
jyn514
left a comment
There was a problem hiding this comment.
This looks about like what I imagined, thanks :)
There was a problem hiding this comment.
It is not always local (e.g. if this is a re-export), I think we found why it wasn't a lint before. Fortunately, we don't need to check the syntax of other crates, so you can just return without doing anything if it's non-local.
See #77230 for more discussion; it would also be good to add a test, since if the behavior changes it should be intentional.
There was a problem hiding this comment.
Could you add a test for the behavior?
|
@rustbot label +S-waiting-on-review -S-waiting-on-author |
jyn514
left a comment
There was a problem hiding this comment.
Thanks, LGTM. Can you squash the commits before merging?
|
Also you need to update |
7158e11 to
d271e41
Compare
|
Added the changes you proposed and squashed the whole thing Edit: I forgot to ran |
d271e41 to
0e0ae47
Compare
|
@bors r+ Looks great, thanks! |
|
📌 Commit 0e0ae47 has been approved by |
…r=jyn514 Declare a new lint to properly deny warnings in rustdoc This declares a new lint: `INVALID_RUST_CODEBLOCK` that is used by `rustdoc` to properly follow `-D warnings` instead of unconditionally emitting a warning. ## Todo List - [x] Declare lint. - [x] Document lint (file: `src/doc/rustdoc/src/lints.md`). - [x] Use lint in `rustdoc` (file: `src/librustdoc/passes/check_code_block_syntax.rs`, maybe others). - [x] Write tests. - [x] Note: one for the behaviour of the new lint when the error is in a dependency, not the crate being tested (rust-lang#79816 (comment)) - [x] Refactor things. ## Questions - How/where are lints tested ? - Where are lints for `rustdoc` tested ? Fix rust-lang#79792. `@rustbot` label T-rustdoc A-lint
…r=jyn514 Declare a new lint to properly deny warnings in rustdoc This declares a new lint: `INVALID_RUST_CODEBLOCK` that is used by `rustdoc` to properly follow `-D warnings` instead of unconditionally emitting a warning. ## Todo List - [x] Declare lint. - [x] Document lint (file: `src/doc/rustdoc/src/lints.md`). - [x] Use lint in `rustdoc` (file: `src/librustdoc/passes/check_code_block_syntax.rs`, maybe others). - [x] Write tests. - [x] Note: one for the behaviour of the new lint when the error is in a dependency, not the crate being tested (rust-lang#79816 (comment)) - [x] Refactor things. ## Questions - How/where are lints tested ? - Where are lints for `rustdoc` tested ? Fix rust-lang#79792. ``@rustbot`` label T-rustdoc A-lint
2c33488 to
c067fae
Compare
|
@rustbot label: +S-waiting-on-review -S-waiting-on-author |
This comment has been minimized.
This comment has been minimized.
This adds a new lint to `rustc` that is used in rustdoc when a code block is empty or cannot be parsed as valid Rust code. Previously this was unconditionally a warning. As such some documentation comments were (unknowingly) abusing this to pass despite the `-Dwarnings` used when compiling `rustc`, this should not be the case anymore.
c067fae to
4f4b2f5
Compare
|
This is still not correct. Any new lints should be added to |
| LL | | /// ``` | ||
| | |_______^ | ||
| | | ||
| = note: `#[warn(invalid_rust_codeblock)]` on by default |
There was a problem hiding this comment.
Could you add some tests for when ignore is present (and for all the rest of the branching you have for the diagnostics)?
|
@poliorcetics - Ping from triage: can you please resolve the merge conflict and set it to |
|
Hi @poliorcetics, any updates on this? It's really close to being done :/ |
|
I'm going to close this - feel free to re-open if you have time to work on this again. |
…pider rustdoc: Make "rust code block is empty" and "could not parse code block" warnings a lint (`INVALID_RUST_CODEBLOCKS`) Fixes rust-lang#79792. This already went through FCP in rust-lang#79816, so it only needs final review. This is mostly a rebase of rust-lang#79816 - thank you `@poliorcetics` for doing most of the work!
…pider rustdoc: Make "rust code block is empty" and "could not parse code block" warnings a lint (`INVALID_RUST_CODEBLOCKS`) Fixes rust-lang#79792. This already went through FCP in rust-lang#79816, so it only needs final review. This is mostly a rebase of rust-lang#79816 - thank you ``@poliorcetics`` for doing most of the work!
…pider rustdoc: Make "rust code block is empty" and "could not parse code block" warnings a lint (`INVALID_RUST_CODEBLOCKS`) Fixes rust-lang#79792. This already went through FCP in rust-lang#79816, so it only needs final review. This is mostly a rebase of rust-lang#79816 - thank you `@poliorcetics` for doing most of the work!
…pider rustdoc: Make "rust code block is empty" and "could not parse code block" warnings a lint (`INVALID_RUST_CODEBLOCKS`) Fixes rust-lang#79792. This already went through FCP in rust-lang#79816, so it only needs final review. This is mostly a rebase of rust-lang#79816 - thank you ``@poliorcetics`` for doing most of the work!
This declares a new lint:
INVALID_RUST_CODEBLOCKthat is used byrustdocto properly follow-D warningsinstead of unconditionally emitting a warning.Todo List
Declare lint.
Document lint (file:
src/doc/rustdoc/src/lints.md).Use lint in
rustdoc(file:src/librustdoc/passes/check_code_block_syntax.rs, maybe others).Write tests.
Refactor things.
Wait on Make rustdoc lints a tool lint instead of built-in #80527.
Fix #79792.
@rustbot label T-rustdoc A-lint