Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
04db063
Don't build the library and standard library before documenting them
jyn514 Sep 5, 2021
76e09eb
Do not unshallow -- already done by other code
Mark-Simulacrum Sep 6, 2021
c9d46eb
Rework DepthFirstSearch API
nikomatsakis Nov 23, 2020
2987f4b
WIP state
BoxyUwU Sep 6, 2021
9b29138
as casts and block exprs
BoxyUwU Sep 6, 2021
4483c2b
dont support blocks
BoxyUwU Sep 6, 2021
47b16f4
bless stderr
BoxyUwU Sep 6, 2021
c170dcf
tidy
BoxyUwU Sep 6, 2021
08e8644
move thir visitor to rustc_middle
BoxyUwU Sep 6, 2021
fc63e9a
dont build abstract const for monomorphic consts
BoxyUwU Sep 6, 2021
4cbcb09
handle `ExprKind::NeverToAny`
BoxyUwU Sep 6, 2021
1f57f8b
remove `WorkNode`
BoxyUwU Sep 6, 2021
15101c8
remove debug stmts
BoxyUwU Sep 7, 2021
406d2ab
rename mir -> thir around abstract consts
BoxyUwU Sep 7, 2021
79be080
remove comment
BoxyUwU Sep 7, 2021
955e2b2
nits
BoxyUwU Sep 7, 2021
8c7954d
add a `CastKind` to `Node::Cast`
BoxyUwU Sep 7, 2021
3212734
resolve `from_hir_call` FIXME
BoxyUwU Sep 7, 2021
cd2915e
fmt
BoxyUwU Sep 7, 2021
fd9bb30
CI please
BoxyUwU Sep 7, 2021
c86c634
Allow missing code examples in trait impls.
hnj2 Sep 8, 2021
8295e4a
add test for builtin types N + N unifying with fn call
BoxyUwU Sep 9, 2021
44e6f2e
Remove unnecessary `Cache.*_did` fields
camelid Aug 22, 2021
294510e
rustc: Remove local variable IDs from `Export`s
petrochenkov Sep 5, 2021
03f9fe2
explicitly link to external `ena` docs
lcnr Sep 11, 2021
df281ee
Only take `tcx` when it's all that's needed
camelid Aug 27, 2021
0bb1c28
rustdoc: Get symbol for `TyParam` directly
camelid Aug 23, 2021
6a84d34
Create a valid `Res` in `external_path()`
camelid Aug 24, 2021
c2207f5
Remove unused `hir_id` parameter from `resolve_type`
camelid Aug 27, 2021
5321b35
Fix redundant arguments in `external_path()`
camelid Sep 11, 2021
913764d
Remove unnecessary `is_trait` argument
camelid Sep 11, 2021
280fc2d
rustdoc: Cleanup a pattern match in `external_generic_args()`
camelid Sep 11, 2021
f00af15
Rollup merge of #88675 - jyn514:faster-doc, r=Mark-Simulacrum
Manishearth Sep 12, 2021
68bb06a
Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco
Manishearth Sep 12, 2021
ae14fc4
Rollup merge of #88699 - Mark-Simulacrum:fixes-cherry-picker, r=pietr…
Manishearth Sep 12, 2021
4972d14
Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr
Manishearth Sep 12, 2021
543b8c0
Rollup merge of #88711 - Mark-Simulacrum:fix-dfs-bug, r=jackh726
Manishearth Sep 12, 2021
c134e96
Rollup merge of #88745 - hnj2:allow-trait-impl-missing-code, r=Guilla…
Manishearth Sep 12, 2021
49a7f5f
Rollup merge of #88810 - camelid:cleanup-pt1, r=jyn514
Manishearth Sep 12, 2021
d6b179b
Rollup merge of #88813 - lcnr:ena-docs, r=jyn514
Manishearth Sep 12, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/librustdoc/passes/doc_test_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::core::DocContext;
use crate::fold::DocFolder;
use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString};
use crate::visit_ast::inherits_doc_hidden;
use rustc_hir as hir;
use rustc_middle::lint::LintLevelSource;
use rustc_session::lint;
use rustc_span::symbol::sym;
Expand Down Expand Up @@ -67,13 +68,32 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
| clean::ImportItem(_)
| clean::PrimitiveItem(_)
| clean::KeywordItem(_)
// check for trait impl
| clean::ImplItem(clean::Impl { trait_: Some(_), .. })
)
{
return false;
}

// The `expect_def_id()` should be okay because `local_def_id_to_hir_id`
// would presumably panic if a fake `DefIndex` were passed.
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_def_id().expect_local());

// check if parent is trait impl
if let Some(parent_hir_id) = cx.tcx.hir().find_parent_node(hir_id) {
if let Some(parent_node) = cx.tcx.hir().find(parent_hir_id) {
if matches!(
parent_node,
hir::Node::Item(hir::Item {
kind: hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }),
..
})
) {
return false;
}
}
}

if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
|| inherits_doc_hidden(cx.tcx, hir_id)
{
Expand Down
7 changes: 7 additions & 0 deletions src/test/rustdoc-ui/lint-missing-doc-code-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ pub union Union {
b: f32,
}

// no code example and it's fine!
impl Clone for Struct {
fn clone(&self) -> Self {
Self { field: self.field }
}
}


#[doc(hidden)]
pub mod foo {
Expand Down