@@ -63,7 +63,7 @@ pub fn modify_for_testing(sess: session::Session,
63
63
}
64
64
65
65
struct TestHarnessGenerator {
66
- cx : @ TestCtxt ,
66
+ cx : TestCtxt ,
67
67
}
68
68
69
69
impl fold:: ast_fold for TestHarnessGenerator {
@@ -73,7 +73,7 @@ impl fold::ast_fold for TestHarnessGenerator {
73
73
// Add a special __test module to the crate that will contain code
74
74
// generated for the test harness
75
75
ast:: Crate {
76
- module : add_test_module ( self . cx , & folded. module ) ,
76
+ module : add_test_module ( & self . cx , & folded. module ) ,
77
77
.. folded
78
78
}
79
79
}
@@ -86,7 +86,7 @@ impl fold::ast_fold for TestHarnessGenerator {
86
86
debug ! ( "current path: {}" ,
87
87
ast_util:: path_name_i( self . cx. path. get( ) ) ) ;
88
88
89
- if is_test_fn ( self . cx , i) || is_bench_fn ( i) {
89
+ if is_test_fn ( & self . cx , i) || is_bench_fn ( i) {
90
90
match i. node {
91
91
ast:: item_fn( _, purity, _, _, _)
92
92
if purity == ast:: unsafe_fn => {
@@ -101,7 +101,7 @@ impl fold::ast_fold for TestHarnessGenerator {
101
101
span : i. span ,
102
102
path : self . cx . path . get ( ) ,
103
103
bench : is_bench_fn ( i) ,
104
- ignore : is_ignored ( self . cx , i) ,
104
+ ignore : is_ignored ( & self . cx , i) ,
105
105
should_fail : should_fail ( i)
106
106
} ;
107
107
{
@@ -126,7 +126,7 @@ impl fold::ast_fold for TestHarnessGenerator {
126
126
// Remove any #[main] from the AST so it doesn't clash with
127
127
// the one we're going to add. Only if compiling an executable.
128
128
129
- fn nomain ( cx : @ TestCtxt , item : @ast:: item ) -> @ast:: item {
129
+ fn nomain ( cx : & TestCtxt , item : @ast:: item ) -> @ast:: item {
130
130
if !cx. sess . building_library . get ( ) {
131
131
@ast:: item {
132
132
attrs : item. attrs . iter ( ) . filter_map ( |attr| {
@@ -145,7 +145,7 @@ impl fold::ast_fold for TestHarnessGenerator {
145
145
146
146
let mod_nomain = ast:: _mod {
147
147
view_items : m. view_items . clone ( ) ,
148
- items : m. items . iter ( ) . map ( |i| nomain ( self . cx , * i) ) . collect ( ) ,
148
+ items : m. items . iter ( ) . map ( |i| nomain ( & self . cx , * i) ) . collect ( ) ,
149
149
} ;
150
150
151
151
fold:: noop_fold_mod ( & mod_nomain, self )
@@ -154,7 +154,7 @@ impl fold::ast_fold for TestHarnessGenerator {
154
154
155
155
fn generate_test_harness ( sess : session:: Session , crate : ast:: Crate )
156
156
-> ast:: Crate {
157
- let cx: @ TestCtxt = @ TestCtxt {
157
+ let mut cx: TestCtxt = TestCtxt {
158
158
sess : sess,
159
159
ext_cx : ExtCtxt :: new ( sess. parse_sess , sess. opts . cfg . clone ( ) ) ,
160
160
path : RefCell :: new ( ~[ ] ) ,
@@ -176,7 +176,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
176
176
cx : cx
177
177
} ;
178
178
let res = fold. fold_crate ( crate ) ;
179
- cx. ext_cx . bt_pop ( ) ;
179
+ fold . cx . ext_cx . bt_pop ( ) ;
180
180
return res;
181
181
}
182
182
@@ -189,7 +189,7 @@ fn strip_test_functions(crate: ast::Crate) -> ast::Crate {
189
189
} )
190
190
}
191
191
192
- fn is_test_fn ( cx : @ TestCtxt , i : @ast:: item ) -> bool {
192
+ fn is_test_fn ( cx : & TestCtxt , i : @ast:: item ) -> bool {
193
193
let has_test_attr = attr:: contains_name ( i. attrs , "test" ) ;
194
194
195
195
fn has_test_signature ( i : @ast:: item ) -> bool {
@@ -242,7 +242,7 @@ fn is_bench_fn(i: @ast::item) -> bool {
242
242
return has_bench_attr && has_test_signature ( i) ;
243
243
}
244
244
245
- fn is_ignored ( cx : @ TestCtxt , i : @ast:: item ) -> bool {
245
+ fn is_ignored ( cx : & TestCtxt , i : @ast:: item ) -> bool {
246
246
i. attrs . iter ( ) . any ( |attr| {
247
247
// check ignore(cfg(foo, bar))
248
248
"ignore" == attr. name ( ) && match attr. meta_item_list ( ) {
0 commit comments