Skip to content

Commit 4d20d7e

Browse files
committed
---
yaml --- r: 13759 b: refs/heads/try c: 6d80584 h: refs/heads/master i: 13757: 46095be 13755: d23a45a 13751: 19cb00b 13743: c4c2db0 13727: dc60629 13695: 3054090 v: v3
1 parent 06c6cfd commit 4d20d7e

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: fc64aefe0aebe547322e86b3e5daa4564d038e63
5+
refs/heads/try: 6d8058451b71f3e5a8178ca21856b529655df032
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustdoc/attr_parser.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ type fn_attrs = {
2525
brief: option<str>,
2626
desc: option<str>,
2727
args: [arg_attrs],
28-
return: option<str>
28+
return: option<str>,
29+
failure: option<str>
2930
};
3031

3132
type arg_attrs = {
@@ -193,7 +194,8 @@ fn parse_fn(
193194
brief: none,
194195
desc: desc,
195196
args: [],
196-
return: none
197+
return: none,
198+
failure: none
197199
}
198200
},
199201
parse_fn_long_doc
@@ -206,7 +208,7 @@ fn parse_fn_long_doc(
206208
desc: option<str>
207209
) -> fn_attrs {
208210
let return = attr::meta_item_value_from_list(items, "return");
209-
211+
let failure = attr::meta_item_value_from_list(items, "failure");
210212
let args = alt attr::meta_item_list_from_list(items, "args") {
211213
some(items) {
212214
vec::filter_map(items) {|item|
@@ -225,7 +227,8 @@ fn parse_fn_long_doc(
225227
brief: brief,
226228
desc: desc,
227229
args: args,
228-
return: return
230+
return: return,
231+
failure: failure
229232
}
230233
}
231234

@@ -281,6 +284,14 @@ fn parse_fn_should_parse_the_argument_descriptions() {
281284
assert attrs.args[1] == {name: "b", desc: "arg b"};
282285
}
283286
287+
#[test]
288+
fn parse_fn_should_parse_failure_conditions() {
289+
let source = "#[doc(failure = \"it's the fail\")]";
290+
let attrs = test::parse_attributes(source);
291+
let attrs = parse_fn(attrs);
292+
assert attrs.failure == some("it's the fail");
293+
}
294+
284295
fn parse_const(attrs: [ast::attribute]) -> const_attrs {
285296
parse_short_doc_or(
286297
attrs,

0 commit comments

Comments
 (0)