Skip to content

Commit a66bff6

Browse files
committed
rustdoc: Don't prune functions with documented failure conditions
1 parent efc0679 commit a66bff6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/rustdoc/prune_undoc_pass.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ fn fold_fn(
7171
doc.brief != none
7272
|| doc.desc != none
7373
|| have_arg_docs
74-
|| doc.return.desc != none;
74+
|| doc.return.desc != none
75+
|| doc.failure != none;
7576
ret doc;
7677
}
7778

@@ -106,6 +107,16 @@ fn should_elide_undocumented_return_values() {
106107
assert doc.topmod.fns[0].return.ty == none;
107108
}
108109

110+
#[test]
111+
fn should_not_elide_fns_with_documented_failure_conditions() {
112+
let source = "#[doc(failure = \"yup\")] fn a() { }";
113+
let srv = astsrv::mk_srv_from_str(source);
114+
let doc = extract::from_srv(srv, "");
115+
let doc = attr_pass::mk_pass()(srv, doc);
116+
let doc = run(srv, doc);
117+
assert vec::is_not_empty(*doc.topmod.fns);
118+
}
119+
109120
fn fold_modlist(
110121
fold: fold::fold<ctxt>,
111122
list: doc::modlist

0 commit comments

Comments
 (0)