mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Ignore rustc_private items from std docs
Apply suggestions from code review Co-authored-by: Joshua Nelson <joshua@yottadb.com>
This commit is contained in:
parent
7dd4582f95
commit
c743fc4342
@ -337,18 +337,13 @@ pub fn build_impl(
|
||||
// reachable in rustdoc generated documentation
|
||||
if !did.is_local() {
|
||||
if let Some(traitref) = associated_trait {
|
||||
if !cx.renderinfo.borrow().access_levels.is_public(traitref.def_id) {
|
||||
let did = traitref.def_id;
|
||||
if !cx.renderinfo.borrow().access_levels.is_public(did) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip foreign unstable traits from lists of trait implementations and
|
||||
// such. This helps prevent dependencies of the standard library, for
|
||||
// example, from getting documented as "traits `u32` implements" which
|
||||
// isn't really too helpful.
|
||||
if let Some(trait_did) = associated_trait {
|
||||
if let Some(stab) = cx.tcx.lookup_stability(trait_did.def_id) {
|
||||
if stab.level.is_unstable() {
|
||||
if let Some(stab) = tcx.lookup_stability(did) {
|
||||
if stab.level.is_unstable() && stab.feature == sym::rustc_private {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -372,6 +367,12 @@ pub fn build_impl(
|
||||
if !cx.renderinfo.borrow().access_levels.is_public(did) {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(stab) = tcx.lookup_stability(did) {
|
||||
if stab.level.is_unstable() && stab.feature == sym::rustc_private {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,16 @@ fn is_exception(file: &Path, link: &str) -> bool {
|
||||
if let Some(entry) = LINKCHECK_EXCEPTIONS.iter().find(|&(f, _)| file.ends_with(f)) {
|
||||
entry.1.contains(&link)
|
||||
} else {
|
||||
// FIXME(#63351): Concat trait in alloc/slice reexported in primitive page
|
||||
//
|
||||
// NOTE: This cannot be added to `LINKCHECK_EXCEPTIONS` because the resolved path
|
||||
// calculated in `check` function is outside `build/<triple>/doc` dir.
|
||||
// So the `strip_prefix` method just returns the old absolute broken path.
|
||||
if file.ends_with("std/primitive.slice.html") {
|
||||
if link.ends_with("primitive.slice.html") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user