diff options
| author | Urgau <urgau@numericable.fr> | 2024-09-06 12:20:36 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-09-06 12:20:36 +0200 |
| commit | 7dd1be1d0d2911b16aa1347efa47e7c43c507ade (patch) | |
| tree | fa2b745a24e69246a6e80c96b439064ca3f16387 | |
| parent | eb33b43bab08223fa6b46abacc1e95e859fe375d (diff) | |
| download | rust-7dd1be1d0d2911b16aa1347efa47e7c43c507ade.tar.gz rust-7dd1be1d0d2911b16aa1347efa47e7c43c507ade.zip | |
Also emit `missing_docs` lint with `--test` to fulfill expectations
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 6 | ||||
| -rw-r--r-- | tests/ui/lint/lint-missing-doc-expect.rs | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index d8482567bbe..5cb51953674 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -426,12 +426,6 @@ impl MissingDoc { article: &'static str, desc: &'static str, ) { - // If we're building a test harness, then warning about - // documentation is probably not really relevant right now. - if cx.sess().opts.test { - return; - } - // Only check publicly-visible items, using the result from the privacy pass. // It's an option so the crate root can also use this function (it doesn't // have a `NodeId`). diff --git a/tests/ui/lint/lint-missing-doc-expect.rs b/tests/ui/lint/lint-missing-doc-expect.rs new file mode 100644 index 00000000000..991f65003dc --- /dev/null +++ b/tests/ui/lint/lint-missing-doc-expect.rs @@ -0,0 +1,13 @@ +// Make sure that `#[expect(missing_docs)]` is always correctly fulfilled. + +//@ check-pass +//@ revisions: lib bin test +//@ [lib]compile-flags: --crate-type lib +//@ [bin]compile-flags: --crate-type bin +//@ [test]compile-flags: --test + +#[expect(missing_docs)] +pub fn foo() {} + +#[cfg(bin)] +fn main() {} |
