Skip to content

Commit c3d048a

Browse files
tesujiJoshua Nelson
and
Joshua Nelson
committed
Ignore rustc_private items from std docs
Apply suggestions from code review Co-authored-by: Joshua Nelson <[email protected]>
1 parent fb8d070 commit c3d048a

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/librustdoc/clean/inline.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -337,18 +337,13 @@ pub fn build_impl(
337337
// reachable in rustdoc generated documentation
338338
if !did.is_local() {
339339
if let Some(traitref) = associated_trait {
340-
if !cx.renderinfo.borrow().access_levels.is_public(traitref.def_id) {
340+
let did = traitref.def_id;
341+
if !cx.renderinfo.borrow().access_levels.is_public(did) {
341342
return;
342343
}
343-
}
344344

345-
// Skip foreign unstable traits from lists of trait implementations and
346-
// such. This helps prevent dependencies of the standard library, for
347-
// example, from getting documented as "traits `u32` implements" which
348-
// isn't really too helpful.
349-
if let Some(trait_did) = associated_trait {
350-
if let Some(stab) = cx.tcx.lookup_stability(trait_did.def_id) {
351-
if stab.level.is_unstable() {
345+
if let Some(stab) = tcx.lookup_stability(did) {
346+
if stab.level.is_unstable() && stab.feature == sym::rustc_private {
352347
return;
353348
}
354349
}
@@ -372,6 +367,12 @@ pub fn build_impl(
372367
if !cx.renderinfo.borrow().access_levels.is_public(did) {
373368
return;
374369
}
370+
371+
if let Some(stab) = tcx.lookup_stability(did) {
372+
if stab.level.is_unstable() && stab.feature == sym::rustc_private {
373+
return;
374+
}
375+
}
375376
}
376377
}
377378

src/tools/linkchecker/main.rs

+10
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ fn is_exception(file: &Path, link: &str) -> bool {
142142
if let Some(entry) = LINKCHECK_EXCEPTIONS.iter().find(|&(f, _)| file.ends_with(f)) {
143143
entry.1.contains(&link)
144144
} else {
145+
// FIXME(#63351): Concat trait in alloc/slice reexported in primitive page
146+
//
147+
// NOTE: This cannot be added to `LINKCHECK_EXCEPTIONS` because the resolved path
148+
// calculated in `check` function is outside `build/<triple>/doc` dir.
149+
// So the `strip_prefix` method just returns the old absolute broken path.
150+
if file.ends_with("std/primitive.slice.html") {
151+
if link.ends_with("std/primitive.slice.html") {
152+
return true;
153+
}
154+
}
145155
false
146156
}
147157
}

0 commit comments

Comments
 (0)