diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-07-24 17:26:21 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-08-10 07:52:07 -0400 |
| commit | 78d9088e7784849dbfe14f1e550a08111d547622 (patch) | |
| tree | 6b4b3ca0ef14c44e981c5686b62a60402cc31e0c | |
| parent | c36e0c04243c2aa5e6fb9289345e9215ea0ebde5 (diff) | |
| download | rust-78d9088e7784849dbfe14f1e550a08111d547622.tar.gz rust-78d9088e7784849dbfe14f1e550a08111d547622.zip | |
Replace is_doc_reachable with is_public
| -rw-r--r-- | src/librustdoc/clean/blanket_impl.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/passes/mod.rs | 4 |
5 files changed, 7 insertions, 20 deletions
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 5c42d705bd5..64cffaec2ea 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -5,8 +5,6 @@ use rustc::ty::subst::Subst; use rustc::infer::InferOk; use syntax_pos::DUMMY_SP; -use crate::core::DocAccessLevels; - use super::*; pub struct BlanketImplFinder<'a, 'tcx> { @@ -30,7 +28,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { debug!("get_blanket_impls({:?})", ty); let mut impls = Vec::new(); for &trait_def_id in self.cx.all_traits.iter() { - if !self.cx.renderinfo.borrow().access_levels.is_doc_reachable(trait_def_id) || + if !self.cx.renderinfo.borrow().access_levels.is_public(trait_def_id) || self.cx.generated_synthetics .borrow_mut() .get(&(ty, trait_def_id)) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 8463fbfbd20..d2a6dcf19bc 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -14,7 +14,7 @@ use rustc_metadata::cstore::LoadedMacro; use rustc::ty; use rustc::util::nodemap::FxHashSet; -use crate::core::{DocContext, DocAccessLevels}; +use crate::core::DocContext; use crate::doctree; use crate::clean::{ self, @@ -326,7 +326,7 @@ pub fn build_impl(cx: &DocContext<'_>, did: DefId, attrs: Option<Attrs<'_>>, // reachable in rustdoc generated documentation if !did.is_local() { if let Some(traitref) = associated_trait { - if !cx.renderinfo.borrow().access_levels.is_doc_reachable(traitref.def_id) { + if !cx.renderinfo.borrow().access_levels.is_public(traitref.def_id) { return } } @@ -347,7 +347,7 @@ pub fn build_impl(cx: &DocContext<'_>, did: DefId, attrs: Option<Attrs<'_>>, // reachable in rustdoc generated documentation if !did.is_local() { if let Some(did) = for_.def_id() { - if !cx.renderinfo.borrow().access_levels.is_doc_reachable(did) { + if !cx.renderinfo.borrow().access_levels.is_public(did) { return } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index e23a24a8dc5..2d19cfacd96 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -178,16 +178,6 @@ impl<'tcx> DocContext<'tcx> { } } -pub trait DocAccessLevels { - fn is_doc_reachable(&self, did: DefId) -> bool; -} - -impl DocAccessLevels for AccessLevels<DefId> { - fn is_doc_reachable(&self, did: DefId) -> bool { - self.is_public(did) - } -} - /// Creates a new diagnostic `Handler` that can be used to emit warnings and errors. /// /// If the given `error_format` is `ErrorOutputType::Json` and no `SourceMap` is given, a new one diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 9e5cc03b831..9c22837bdae 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -14,7 +14,6 @@ use rustc_target::spec::abi::Abi; use rustc::hir; use crate::clean::{self, PrimitiveType}; -use crate::core::DocAccessLevels; use crate::html::item_type::ItemType; use crate::html::render::{self, cache, CURRENT_LOCATION_KEY}; @@ -404,7 +403,7 @@ impl fmt::Display for clean::Path { pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> { let cache = cache(); - if !did.is_local() && !cache.access_levels.is_doc_reachable(did) { + if !did.is_local() && !cache.access_levels.is_public(did) { return None } diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index ca40d6d02f8..4e10b46bc8a 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -10,7 +10,7 @@ use syntax_pos::{DUMMY_SP, InnerSpan, Span}; use std::ops::Range; use crate::clean::{self, GetDefId, Item}; -use crate::core::{DocContext, DocAccessLevels}; +use crate::core::DocContext; use crate::fold::{DocFolder, StripItem}; use crate::html::markdown::{find_testable_code, ErrorCodes, LangString}; @@ -347,7 +347,7 @@ pub fn look_for_tests<'tcx>( diag.emit(); } else if check_missing_code == false && tests.found_tests > 0 && - !cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) { + !cx.renderinfo.borrow().access_levels.is_public(item.def_id) { let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::PRIVATE_DOC_TESTS, hir_id, |
