diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-08-27 01:14:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-27 01:14:18 +0200 |
| commit | c2a0168ce5eeb546ff7f72b3460ac9a55fc21381 (patch) | |
| tree | 86c48d6bfeafba74a7037b0597e50170aef7e7a7 | |
| parent | 11e9769a971d40073e6ede6a1cdd7f2641a601ba (diff) | |
| parent | 29399fad5f961f0e235d28ed2f4c68e7a1ae5062 (diff) | |
| download | rust-c2a0168ce5eeb546ff7f72b3460ac9a55fc21381.tar.gz rust-c2a0168ce5eeb546ff7f72b3460ac9a55fc21381.zip | |
Rollup merge of #75953 - jyn514:missing-lints, r=Manishearth
Fix swapped stability attributes for rustdoc lints This fixes a regression introduced in https://github.com/rust-lang/rust/pull/74855. Previously, `missing_doc_code_examples` would be run on stable and `private_doc_tests` would only be run on nightly. Now, it correctly does the reverse. Closes https://github.com/rust-lang/rust/issues/75951. r? @ehuss
| -rw-r--r-- | src/librustdoc/passes/doc_test_lints.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/passes/doc_test_lints.rs b/src/librustdoc/passes/doc_test_lints.rs index a465a5f681f..367f93cfd38 100644 --- a/src/librustdoc/passes/doc_test_lints.rs +++ b/src/librustdoc/passes/doc_test_lints.rs @@ -1,7 +1,7 @@ //! This pass is overloaded and runs two different lints. //! -//! - MISSING_DOC_CODE_EXAMPLES: this looks for public items missing doc-tests -//! - PRIVATE_DOC_TESTS: this looks for private items with doc-tests. +//! - MISSING_DOC_CODE_EXAMPLES: this lint is **UNSTABLE** and looks for public items missing doc-tests +//! - PRIVATE_DOC_TESTS: this lint is **STABLE** and looks for private items with doc-tests. use super::{span_of_attrs, Pass}; use crate::clean; @@ -89,7 +89,9 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) { find_testable_code(&dox, &mut tests, ErrorCodes::No, false, None); - if tests.found_tests == 0 { + if tests.found_tests == 0 + && rustc_feature::UnstableFeatures::from_environment().is_nightly_build() + { if should_have_doc_example(&item.inner) { debug!("reporting error for {:?} (hir_id={:?})", item, hir_id); 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) { |lint| lint.build("missing code example in this documentation").emit(), ); } - } else if rustc_feature::UnstableFeatures::from_environment().is_nightly_build() - && tests.found_tests > 0 - && !cx.renderinfo.borrow().access_levels.is_public(item.def_id) + } else if tests.found_tests > 0 && !cx.renderinfo.borrow().access_levels.is_public(item.def_id) { cx.tcx.struct_span_lint_hir( lint::builtin::PRIVATE_DOC_TESTS, |
