Skip to content

Commit adc747e

Browse files
committed
Fix swapped stability attributes
This fixes a regression introduced in #74855.
1 parent 0f91f5c commit adc747e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustdoc/passes/doc_test_lints.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This pass is overloaded and runs two different lints.
22
//!
3-
//! - MISSING_DOC_CODE_EXAMPLES: this looks for public items missing doc-tests
4-
//! - PRIVATE_DOC_TESTS: this looks for private items with doc-tests.
3+
//! - MISSING_DOC_CODE_EXAMPLES: this lint is **UNSTABLE** and looks for public items missing doc-tests
4+
//! - PRIVATE_DOC_TESTS: this lint is **STABLE** and looks for private items with doc-tests.
55
66
use super::{span_of_attrs, Pass};
77
use crate::clean;
@@ -89,7 +89,9 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
8989

9090
find_testable_code(&dox, &mut tests, ErrorCodes::No, false, None);
9191

92-
if tests.found_tests == 0 {
92+
if tests.found_tests == 0
93+
&& rustc_feature::UnstableFeatures::from_environment().is_nightly_build()
94+
{
9395
if should_have_doc_example(&item.inner) {
9496
debug!("reporting error for {:?} (hir_id={:?})", item, hir_id);
9597
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
@@ -100,9 +102,7 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
100102
|lint| lint.build("missing code example in this documentation").emit(),
101103
);
102104
}
103-
} else if rustc_feature::UnstableFeatures::from_environment().is_nightly_build()
104-
&& tests.found_tests > 0
105-
&& !cx.renderinfo.borrow().access_levels.is_public(item.def_id)
105+
} else if tests.found_tests > 0 && !cx.renderinfo.borrow().access_levels.is_public(item.def_id)
106106
{
107107
cx.tcx.struct_span_lint_hir(
108108
lint::builtin::PRIVATE_DOC_TESTS,

0 commit comments

Comments
 (0)