Skip to content

Commit 78d9088

Browse files
Replace is_doc_reachable with is_public
1 parent c36e0c0 commit 78d9088

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

src/librustdoc/clean/blanket_impl.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use rustc::ty::subst::Subst;
55
use rustc::infer::InferOk;
66
use syntax_pos::DUMMY_SP;
77

8-
use crate::core::DocAccessLevels;
9-
108
use super::*;
119

1210
pub struct BlanketImplFinder<'a, 'tcx> {
@@ -30,7 +28,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
3028
debug!("get_blanket_impls({:?})", ty);
3129
let mut impls = Vec::new();
3230
for &trait_def_id in self.cx.all_traits.iter() {
33-
if !self.cx.renderinfo.borrow().access_levels.is_doc_reachable(trait_def_id) ||
31+
if !self.cx.renderinfo.borrow().access_levels.is_public(trait_def_id) ||
3432
self.cx.generated_synthetics
3533
.borrow_mut()
3634
.get(&(ty, trait_def_id))

src/librustdoc/clean/inline.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_metadata::cstore::LoadedMacro;
1414
use rustc::ty;
1515
use rustc::util::nodemap::FxHashSet;
1616

17-
use crate::core::{DocContext, DocAccessLevels};
17+
use crate::core::DocContext;
1818
use crate::doctree;
1919
use crate::clean::{
2020
self,
@@ -326,7 +326,7 @@ pub fn build_impl(cx: &DocContext<'_>, did: DefId, attrs: Option<Attrs<'_>>,
326326
// reachable in rustdoc generated documentation
327327
if !did.is_local() {
328328
if let Some(traitref) = associated_trait {
329-
if !cx.renderinfo.borrow().access_levels.is_doc_reachable(traitref.def_id) {
329+
if !cx.renderinfo.borrow().access_levels.is_public(traitref.def_id) {
330330
return
331331
}
332332
}
@@ -347,7 +347,7 @@ pub fn build_impl(cx: &DocContext<'_>, did: DefId, attrs: Option<Attrs<'_>>,
347347
// reachable in rustdoc generated documentation
348348
if !did.is_local() {
349349
if let Some(did) = for_.def_id() {
350-
if !cx.renderinfo.borrow().access_levels.is_doc_reachable(did) {
350+
if !cx.renderinfo.borrow().access_levels.is_public(did) {
351351
return
352352
}
353353
}

src/librustdoc/core.rs

-10
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,6 @@ impl<'tcx> DocContext<'tcx> {
178178
}
179179
}
180180

181-
pub trait DocAccessLevels {
182-
fn is_doc_reachable(&self, did: DefId) -> bool;
183-
}
184-
185-
impl DocAccessLevels for AccessLevels<DefId> {
186-
fn is_doc_reachable(&self, did: DefId) -> bool {
187-
self.is_public(did)
188-
}
189-
}
190-
191181
/// Creates a new diagnostic `Handler` that can be used to emit warnings and errors.
192182
///
193183
/// If the given `error_format` is `ErrorOutputType::Json` and no `SourceMap` is given, a new one

src/librustdoc/html/format.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rustc_target::spec::abi::Abi;
1414
use rustc::hir;
1515

1616
use crate::clean::{self, PrimitiveType};
17-
use crate::core::DocAccessLevels;
1817
use crate::html::item_type::ItemType;
1918
use crate::html::render::{self, cache, CURRENT_LOCATION_KEY};
2019

@@ -404,7 +403,7 @@ impl fmt::Display for clean::Path {
404403

405404
pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
406405
let cache = cache();
407-
if !did.is_local() && !cache.access_levels.is_doc_reachable(did) {
406+
if !did.is_local() && !cache.access_levels.is_public(did) {
408407
return None
409408
}
410409

src/librustdoc/passes/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syntax_pos::{DUMMY_SP, InnerSpan, Span};
1010
use std::ops::Range;
1111

1212
use crate::clean::{self, GetDefId, Item};
13-
use crate::core::{DocContext, DocAccessLevels};
13+
use crate::core::DocContext;
1414
use crate::fold::{DocFolder, StripItem};
1515
use crate::html::markdown::{find_testable_code, ErrorCodes, LangString};
1616

@@ -347,7 +347,7 @@ pub fn look_for_tests<'tcx>(
347347
diag.emit();
348348
} else if check_missing_code == false &&
349349
tests.found_tests > 0 &&
350-
!cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) {
350+
!cx.renderinfo.borrow().access_levels.is_public(item.def_id) {
351351
let mut diag = cx.tcx.struct_span_lint_hir(
352352
lint::builtin::PRIVATE_DOC_TESTS,
353353
hir_id,

0 commit comments

Comments
 (0)