@@ -63,7 +63,7 @@ pub fn modify_for_testing(sess: session::Session,
6363}
6464
6565struct TestHarnessGenerator {
66- cx : @ TestCtxt ,
66+ cx : TestCtxt ,
6767}
6868
6969impl fold:: ast_fold for TestHarnessGenerator {
@@ -73,7 +73,7 @@ impl fold::ast_fold for TestHarnessGenerator {
7373 // Add a special __test module to the crate that will contain code
7474 // generated for the test harness
7575 ast:: Crate {
76- module : add_test_module ( self . cx , & folded. module ) ,
76+ module : add_test_module ( & self . cx , & folded. module ) ,
7777 .. folded
7878 }
7979 }
@@ -86,7 +86,7 @@ impl fold::ast_fold for TestHarnessGenerator {
8686 debug ! ( "current path: {}" ,
8787 ast_util:: path_name_i( self . cx. path. get( ) ) ) ;
8888
89- if is_test_fn ( self . cx , i) || is_bench_fn ( i) {
89+ if is_test_fn ( & self . cx , i) || is_bench_fn ( i) {
9090 match i. node {
9191 ast:: item_fn( _, purity, _, _, _)
9292 if purity == ast:: unsafe_fn => {
@@ -101,7 +101,7 @@ impl fold::ast_fold for TestHarnessGenerator {
101101 span : i. span ,
102102 path : self . cx . path . get ( ) ,
103103 bench : is_bench_fn ( i) ,
104- ignore : is_ignored ( self . cx , i) ,
104+ ignore : is_ignored ( & self . cx , i) ,
105105 should_fail : should_fail ( i)
106106 } ;
107107 {
@@ -126,7 +126,7 @@ impl fold::ast_fold for TestHarnessGenerator {
126126 // Remove any #[main] from the AST so it doesn't clash with
127127 // the one we're going to add. Only if compiling an executable.
128128
129- fn nomain ( cx : @ TestCtxt , item : @ast:: item ) -> @ast:: item {
129+ fn nomain ( cx : & TestCtxt , item : @ast:: item ) -> @ast:: item {
130130 if !cx. sess . building_library . get ( ) {
131131 @ast:: item {
132132 attrs : item. attrs . iter ( ) . filter_map ( |attr| {
@@ -145,7 +145,7 @@ impl fold::ast_fold for TestHarnessGenerator {
145145
146146 let mod_nomain = ast:: _mod {
147147 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 ( ) ,
149149 } ;
150150
151151 fold:: noop_fold_mod ( & mod_nomain, self )
@@ -154,7 +154,7 @@ impl fold::ast_fold for TestHarnessGenerator {
154154
155155fn generate_test_harness ( sess : session:: Session , crate : ast:: Crate )
156156 -> ast:: Crate {
157- let cx: @ TestCtxt = @ TestCtxt {
157+ let mut cx: TestCtxt = TestCtxt {
158158 sess : sess,
159159 ext_cx : ExtCtxt :: new ( sess. parse_sess , sess. opts . cfg . clone ( ) ) ,
160160 path : RefCell :: new ( ~[ ] ) ,
@@ -176,7 +176,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
176176 cx : cx
177177 } ;
178178 let res = fold. fold_crate ( crate ) ;
179- cx. ext_cx . bt_pop ( ) ;
179+ fold . cx . ext_cx . bt_pop ( ) ;
180180 return res;
181181}
182182
@@ -189,7 +189,7 @@ fn strip_test_functions(crate: ast::Crate) -> ast::Crate {
189189 } )
190190}
191191
192- fn is_test_fn ( cx : @ TestCtxt , i : @ast:: item ) -> bool {
192+ fn is_test_fn ( cx : & TestCtxt , i : @ast:: item ) -> bool {
193193 let has_test_attr = attr:: contains_name ( i. attrs , "test" ) ;
194194
195195 fn has_test_signature ( i : @ast:: item ) -> bool {
@@ -242,7 +242,7 @@ fn is_bench_fn(i: @ast::item) -> bool {
242242 return has_bench_attr && has_test_signature ( i) ;
243243}
244244
245- fn is_ignored ( cx : @ TestCtxt , i : @ast:: item ) -> bool {
245+ fn is_ignored ( cx : & TestCtxt , i : @ast:: item ) -> bool {
246246 i. attrs . iter ( ) . any ( |attr| {
247247 // check ignore(cfg(foo, bar))
248248 "ignore" == attr. name ( ) && match attr. meta_item_list ( ) {
0 commit comments