16
16
use driver:: session:: Session ;
17
17
use front:: config;
18
18
19
- use std:: cell:: RefCell ;
20
19
use std:: gc:: { Gc , GC } ;
21
20
use std:: slice;
22
21
use std:: vec;
@@ -46,9 +45,9 @@ struct Test {
46
45
47
46
struct TestCtxt < ' a > {
48
47
sess : & ' a Session ,
49
- path : RefCell < Vec < ast:: Ident > > ,
48
+ path : Vec < ast:: Ident > ,
50
49
ext_cx : ExtCtxt < ' a > ,
51
- testfns : RefCell < Vec < Test > > ,
50
+ testfns : Vec < Test > ,
52
51
is_test_crate : bool ,
53
52
config : ast:: CrateConfig ,
54
53
}
@@ -86,9 +85,9 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
86
85
}
87
86
88
87
fn fold_item ( & mut self , i : Gc < ast:: Item > ) -> SmallVector < Gc < ast:: Item > > {
89
- self . cx . path . borrow_mut ( ) . push ( i. ident ) ;
88
+ self . cx . path . push ( i. ident ) ;
90
89
debug ! ( "current path: {}" ,
91
- ast_util:: path_name_i( self . cx. path. borrow ( ) . as_slice( ) ) ) ;
90
+ ast_util:: path_name_i( self . cx. path. as_slice( ) ) ) ;
92
91
93
92
if is_test_fn ( & self . cx , i) || is_bench_fn ( & self . cx , i) {
94
93
match i. node {
@@ -102,20 +101,20 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
102
101
debug ! ( "this is a test function" ) ;
103
102
let test = Test {
104
103
span : i. span ,
105
- path : self . cx . path . borrow ( ) . clone ( ) ,
104
+ path : self . cx . path . clone ( ) ,
106
105
bench : is_bench_fn ( & self . cx , i) ,
107
106
ignore : is_ignored ( & self . cx , i) ,
108
107
should_fail : should_fail ( i)
109
108
} ;
110
- self . cx . testfns . borrow_mut ( ) . push ( test) ;
109
+ self . cx . testfns . push ( test) ;
111
110
// debug!("have {} test/bench functions",
112
111
// cx.testfns.len());
113
112
}
114
113
}
115
114
}
116
115
117
116
let res = fold:: noop_fold_item ( & * i, self ) ;
118
- self . cx . path . borrow_mut ( ) . pop ( ) ;
117
+ self . cx . path . pop ( ) ;
119
118
res
120
119
}
121
120
@@ -155,8 +154,8 @@ fn generate_test_harness(sess: &Session, krate: ast::Crate)
155
154
deriving_hash_type_parameter : false ,
156
155
crate_name : "test" . to_string ( ) ,
157
156
} ) ,
158
- path : RefCell :: new ( Vec :: new ( ) ) ,
159
- testfns : RefCell :: new ( Vec :: new ( ) ) ,
157
+ path : Vec :: new ( ) ,
158
+ testfns : Vec :: new ( ) ,
160
159
is_test_crate : is_test_crate ( & krate) ,
161
160
config : krate. config . clone ( ) ,
162
161
} ;
@@ -399,13 +398,13 @@ fn is_test_crate(krate: &ast::Crate) -> bool {
399
398
}
400
399
401
400
fn mk_test_descs ( cx : & TestCtxt ) -> Gc < ast:: Expr > {
402
- debug ! ( "building test vector from {} tests" , cx. testfns. borrow ( ) . len( ) ) ;
401
+ debug ! ( "building test vector from {} tests" , cx. testfns. len( ) ) ;
403
402
404
403
box ( GC ) ast:: Expr {
405
404
id : ast:: DUMMY_NODE_ID ,
406
405
node : ast:: ExprVstore ( box ( GC ) ast:: Expr {
407
406
id : ast:: DUMMY_NODE_ID ,
408
- node : ast:: ExprVec ( cx. testfns . borrow ( ) . iter ( ) . map ( |test| {
407
+ node : ast:: ExprVec ( cx. testfns . iter ( ) . map ( |test| {
409
408
mk_test_desc_and_fn_rec ( cx, test)
410
409
} ) . collect ( ) ) ,
411
410
span : DUMMY_SP ,
0 commit comments