Skip to content

Commit 7dd1be1

Browse files
committed
Also emit missing_docs lint with --test to fulfill expectations
1 parent eb33b43 commit 7dd1be1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

compiler/rustc_lint/src/builtin.rs

-6
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,6 @@ impl MissingDoc {
426426
article: &'static str,
427427
desc: &'static str,
428428
) {
429-
// If we're building a test harness, then warning about
430-
// documentation is probably not really relevant right now.
431-
if cx.sess().opts.test {
432-
return;
433-
}
434-
435429
// Only check publicly-visible items, using the result from the privacy pass.
436430
// It's an option so the crate root can also use this function (it doesn't
437431
// have a `NodeId`).
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Make sure that `#[expect(missing_docs)]` is always correctly fulfilled.
2+
3+
//@ check-pass
4+
//@ revisions: lib bin test
5+
//@ [lib]compile-flags: --crate-type lib
6+
//@ [bin]compile-flags: --crate-type bin
7+
//@ [test]compile-flags: --test
8+
9+
#[expect(missing_docs)]
10+
pub fn foo() {}
11+
12+
#[cfg(bin)]
13+
fn main() {}

0 commit comments

Comments
 (0)