rustdoc: Add fn failure conditions to the doc tree
This commit is contained in:
parent
6d8058451b
commit
efc067952d
|
@ -135,7 +135,8 @@ fn fold_fn(
|
|||
brief: attrs.brief,
|
||||
desc: attrs.desc,
|
||||
args: merge_arg_attrs(doc.args, attrs.args),
|
||||
return: merge_ret_attrs(doc.return, attrs.return)
|
||||
return: merge_ret_attrs(doc.return, attrs.return),
|
||||
failure: attrs.failure
|
||||
with *doc
|
||||
};
|
||||
}
|
||||
|
@ -213,6 +214,16 @@ fn fold_fn_should_preserve_sig() {
|
|||
assert doc.sig == some("fn a() -> int");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fold_fn_should_extract_failure_conditions() {
|
||||
let source = "#[doc(failure = \"what\")] fn a() { }";
|
||||
let srv = astsrv::mk_srv_from_str(source);
|
||||
let doc = extract::from_srv(srv, "");
|
||||
let fold = fold::default_seq_fold(srv);
|
||||
let doc = fold_fn(fold, doc.topmod.fns[0]);
|
||||
assert doc.failure == some("what");
|
||||
}
|
||||
|
||||
fn fold_const(
|
||||
fold: fold::fold<astsrv::srv>,
|
||||
doc: doc::constdoc
|
||||
|
|
|
@ -32,6 +32,7 @@ type fndoc = ~{
|
|||
desc: option<str>,
|
||||
args: [argdoc],
|
||||
return: retdoc,
|
||||
failure: option<str>,
|
||||
sig: option<str>
|
||||
};
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ fn fndoc_from_fn(
|
|||
desc: none,
|
||||
ty: none
|
||||
},
|
||||
failure: none,
|
||||
sig: none
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue