Also emit missing_docs lint with --test to fulfill expectations

This commit is contained in:
Urgau 2024-09-06 12:20:36 +02:00
parent eb33b43bab
commit 7dd1be1d0d
2 changed files with 13 additions and 6 deletions

View File

@ -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`).

View File

@ -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() {}