File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
branches/dist-snap/src/rustdoc Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 38595e66643c3dd47e6f6c8ca443a33398561f8f
10
+ refs/heads/dist-snap: e0f5f259115b2f45f7290fad48fd32b29ce7b8b7
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ fn fold_struct(
333
333
sig: do astsrv:: exec ( srv) |ctxt| {
334
334
match ctxt. ast_map . get ( doc. id ( ) ) {
335
335
ast_map:: node_item( item, _) => {
336
+ let item = strip_struct_drop_block ( item) ;
336
337
Some ( pprust:: item_to_str ( item,
337
338
extract:: interner ( ) ) )
338
339
}
@@ -343,12 +344,39 @@ fn fold_struct(
343
344
}
344
345
}
345
346
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 {
350
+ let node = match item. node {
351
+ ast:: item_class( def, tys) => {
352
+ let def = @{
353
+ dtor: None ,
354
+ .. * def
355
+ } ;
356
+ ast:: item_class ( def, tys)
357
+ }
358
+ _ => fail ~"not a struct "
359
+ } ;
360
+
361
+ @{
362
+ node: node,
363
+ .. * item
364
+ }
365
+ }
366
+
346
367
#[ test]
347
368
fn should_add_struct_defs ( ) {
348
369
let doc = test:: mk_doc ( ~"struct S { field : ( ) } ") ;
349
370
assert doc. cratemod ( ) . structs ( ) [ 0 ] . sig . get ( ) . contains ( "struct S {" ) ;
350
371
}
351
372
373
+ #[ test]
374
+ fn should_not_serialize_struct_drop_blocks ( ) {
375
+ // All we care about are the fields
376
+ let doc = test:: mk_doc ( ~"struct S { field : ( ) , drop { } } ") ;
377
+ assert !doc. cratemod ( ) . structs ( ) [ 0 ] . sig . get ( ) . contains ( "drop" ) ;
378
+ }
379
+
352
380
#[ cfg( test) ]
353
381
mod test {
354
382
fn mk_doc ( source : ~str ) -> doc:: Doc {
You can’t perform that action at this time.
0 commit comments