Skip to content

Commit c1abaf8

Browse files
committed
---
yaml --- r: 7646 b: refs/heads/master c: a7d3544 h: refs/heads/master v: v3
1 parent f781971 commit c1abaf8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5cff7c093eec13405ad8f6d16019c3b11cf88eac
2+
refs/heads/master: a7d3544d10e1fd44fd3e3d300e7c56917ed4a305

trunk/src/rustdoc/prune_undoc_pass.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ fn fold_fn(
4444
fold: fold::fold<ctxt>,
4545
doc: doc::fndoc
4646
) -> doc::fndoc {
47+
let have_arg_docs = false;
4748
let doc = ~{
4849
args: vec::filter_map(doc.args) {|doc|
4950
if option::is_some(doc.desc) {
51+
have_arg_docs = true;
5052
some(doc)
5153
} else {
5254
none
@@ -58,6 +60,7 @@ fn fold_fn(
5860
fold.ctxt.have_docs =
5961
doc.brief != none
6062
|| doc.desc != none
63+
|| have_arg_docs
6164
|| doc.return.desc != none;
6265
ret doc;
6366
}
@@ -72,6 +75,16 @@ fn should_elide_undocumented_arguments() {
7275
assert vec::is_empty(doc.topmod.fns[0].args);
7376
}
7477

78+
#[test]
79+
fn should_not_elide_fns_with_documented_arguments() {
80+
let source = "#[doc(args(a = \"b\"))] fn a(a: int) { }";
81+
let srv = astsrv::mk_srv_from_str(source);
82+
let doc = extract::from_srv(srv, "");
83+
let doc = attr_pass::mk_pass()(srv, doc);
84+
let doc = run(srv, doc);
85+
assert vec::is_not_empty(*doc.topmod.fns);
86+
}
87+
7588
fn fold_modlist(
7689
fold: fold::fold<ctxt>,
7790
list: doc::modlist

0 commit comments

Comments
 (0)