Skip to content

Commit f19c122

Browse files
committed
---
yaml --- r: 21960 b: refs/heads/snap-stage3 c: 0bd02b1 h: refs/heads/master v: v3
1 parent a7972d4 commit f19c122

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5558ebb6b7bf54a370111a46ea7c75b5becf85ec
4+
refs/heads/snap-stage3: 0bd02b113c02c1b3eea33cc339d71697a316d412
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ fn fold_struct(
333333
sig: do astsrv::exec(srv) |ctxt| {
334334
match ctxt.ast_map.get(doc.id()) {
335335
ast_map::node_item(item, _) => {
336-
let item = strip_struct_drop_block(item);
336+
let item = strip_struct_extra_stuff(item);
337337
Some(pprust::item_to_str(item,
338338
extract::interner()))
339339
}
@@ -344,13 +344,15 @@ fn fold_struct(
344344
}
345345
}
346346

347-
/// Removes the drop block from structs so that they aren't displayed
348-
/// as part of the type
349-
fn strip_struct_drop_block(item: @ast::item) -> @ast::item {
347+
/// Removes various things from the struct item definition that
348+
/// shouldn't be displayed in the struct signature. Probably there
349+
/// should be a simple pprust::struct_to_str function that does
350+
/// what I actually want
351+
fn strip_struct_extra_stuff(item: @ast::item) -> @ast::item {
350352
let node = match item.node {
351353
ast::item_class(def, tys) => {
352354
let def = @{
353-
dtor: None,
355+
dtor: None, // Remove the drop { } block
354356
.. *def
355357
};
356358
ast::item_class(def, tys)
@@ -359,6 +361,7 @@ fn strip_struct_drop_block(item: @ast::item) -> @ast::item {
359361
};
360362

361363
@{
364+
attrs: ~[], // Remove the attributes
362365
node: node,
363366
.. *item
364367
}
@@ -377,6 +380,13 @@ fn should_not_serialize_struct_drop_blocks() {
377380
assert !doc.cratemod().structs()[0].sig.get().contains("drop");
378381
}
379382

383+
#[test]
384+
fn should_not_serialize_struct_attrs() {
385+
// All we care about are the fields
386+
let doc = test::mk_doc(~"#[wut] struct S { field: () }");
387+
assert !doc.cratemod().structs()[0].sig.get().contains("wut");
388+
}
389+
380390
#[cfg(test)]
381391
mod test {
382392
fn mk_doc(source: ~str) -> doc::Doc {

0 commit comments

Comments
 (0)