Skip to content

Commit 54a4c52

Browse files
committed
---
yaml --- r: 7962 b: refs/heads/snap-stage3 c: 3f1534a h: refs/heads/master v: v3
1 parent ca1073a commit 54a4c52

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: d7a2837c55d3577e797a73721de4dfd8f74978bc
4+
refs/heads/snap-stage3: 3f1534ad72465577ce5152d2d51e2aebeec143dc
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/rustdoc/desc_to_brief_pass.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ fn run(
2323
fold_fn: fold_fn,
2424
fold_enum: fold_enum,
2525
fold_res: fold_res,
26-
fold_iface: fold_iface
26+
fold_iface: fold_iface,
27+
fold_impl: fold_impl
2728
with *fold::default_seq_fold(())
2829
});
2930
fold.fold_crate(fold, doc)
@@ -104,6 +105,26 @@ fn fold_iface(fold: fold::fold<()>, doc: doc::ifacedoc) -> doc::ifacedoc {
104105
}
105106
}
106107

108+
fn fold_impl(fold: fold::fold<()>, doc: doc::impldoc) -> doc::impldoc {
109+
let doc =fold::default_seq_fold_impl(fold, doc);
110+
let (brief, desc) = modify(doc.brief, doc.desc);
111+
112+
{
113+
brief: brief,
114+
desc: desc,
115+
methods: vec::map(doc.methods) {|doc|
116+
let (brief, desc) = modify(doc.brief, doc.desc);
117+
118+
{
119+
brief: brief,
120+
desc: desc
121+
with doc
122+
}
123+
}
124+
with doc
125+
}
126+
}
127+
107128
#[test]
108129
fn should_promote_mod_desc() {
109130
let doc = test::mk_doc("#[doc(desc = \"desc\")] mod m { }");
@@ -154,6 +175,22 @@ fn should_promote_iface_method_desc() {
154175
assert doc.topmod.ifaces()[0].methods[0].desc == none;
155176
}
156177

178+
#[test]
179+
fn should_promote_impl_desc() {
180+
let doc = test::mk_doc(
181+
"#[doc(desc = \"desc\")] impl i for int { fn a() { } }");
182+
assert doc.topmod.impls()[0].brief == some("desc");
183+
assert doc.topmod.impls()[0].desc == none;
184+
}
185+
186+
#[test]
187+
fn should_promote_impl_method_desc() {
188+
let doc = test::mk_doc(
189+
"impl i for int { #[doc(desc = \"desc\")] fn a() { } }");
190+
assert doc.topmod.impls()[0].methods[0].brief == some("desc");
191+
assert doc.topmod.impls()[0].methods[0].desc == none;
192+
}
193+
157194
#[cfg(test)]
158195
mod test {
159196
fn mk_doc(source: str) -> doc::cratedoc {

0 commit comments

Comments
 (0)