File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
branches/dist-snap/src/librustc/front Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
9
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10
- refs/heads/dist-snap: a4eb76abd0b43c3e0d38cebd2c227a06e3b6edc4
10
+ refs/heads/dist-snap: bd6536f8687b1b4fb166594ed5cf79db0ec1436d
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
13
13
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
Original file line number Diff line number Diff line change @@ -86,24 +86,20 @@ fn strip_test_functions(crate: @ast::crate) -> @ast::crate {
86
86
87
87
fn fold_mod ( cx : test_ctxt , m : ast:: _mod , fld : fold:: ast_fold ) -> ast:: _mod {
88
88
89
- // Remove any defined main function from the AST so it doesn't clash with
89
+ // Remove any #[ main] from the AST so it doesn't clash with
90
90
// the one we're going to add. Only if compiling an executable.
91
91
92
- fn nomain ( cx : test_ctxt , item : @ast:: item ) -> Option < @ast:: item > {
93
- match item. node {
94
- ast:: item_fn( * ) => {
95
- if attrs_contains_name ( item. attrs , ~"main")
96
- && !cx. sess . building_library {
97
- option:: None
98
- } else { option:: Some ( item) }
99
- }
100
- _ => option:: Some ( item)
101
- }
92
+ fn nomain ( cx : test_ctxt , item : @ast:: item ) -> @ast:: item {
93
+ if !cx. sess . building_library {
94
+ @ast:: item { attrs : item. attrs . filtered ( |attr| {
95
+ attr:: get_attr_name ( * attr) != ~"main"
96
+ } ) , .. copy * item}
97
+ } else { item }
102
98
}
103
99
104
100
let mod_nomain =
105
101
{ view_items: /*bad*/ copy m. view_items ,
106
- items: vec:: filter_map ( m. items , |i| nomain ( cx, * i) ) } ;
102
+ items: vec:: map ( m. items , |i| nomain ( cx, * i) ) } ;
107
103
return fold:: noop_fold_mod ( mod_nomain, fld) ;
108
104
}
109
105
You can’t perform that action at this time.
0 commit comments