Skip to content

Commit 22cf4b9

Browse files
committed
move test to dvec
1 parent 2adb3a5 commit 22cf4b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/rustc/front/test.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import syntax::codemap::span;
99
import driver::session;
1010
import session::session;
1111
import syntax::attr;
12+
import dvec::{dvec, extensions};
1213

1314
export modify_for_testing;
1415

@@ -20,7 +21,7 @@ type test_ctxt =
2021
@{sess: session::session,
2122
crate: @ast::crate,
2223
mut path: [ast::ident],
23-
mut testfns: [test]};
24+
testfns: dvec<test>};
2425

2526
// Traverse the crate, collecting all the test functions, eliding any
2627
// existing main functions, and synthesizing a main test harness
@@ -40,7 +41,7 @@ fn generate_test_harness(sess: session::session,
4041
@{sess: sess,
4142
crate: crate,
4243
mut path: [],
43-
mut testfns: []};
44+
testfns: dvec()};
4445

4546
let precursor =
4647
@{fold_crate: fold::wrap(bind fold_crate(cx, _, _)),
@@ -110,8 +111,8 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
110111
let test = {span: i.span,
111112
path: cx.path, ignore: is_ignored(cx, i),
112113
should_fail: should_fail(i)};
113-
cx.testfns += [test];
114-
#debug("have %u test functions", vec::len(cx.testfns));
114+
cx.testfns.push(test);
115+
#debug("have %u test functions", cx.testfns.len());
115116
}
116117
}
117118
}
@@ -269,11 +270,10 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
269270
}
270271

271272
fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
272-
#debug("building test vector from %u tests", vec::len(cx.testfns));
273+
#debug("building test vector from %u tests", cx.testfns.len());
273274
let mut descs = [];
274275
for cx.testfns.each {|test|
275-
let test_ = test; // Satisfy alias analysis
276-
descs += [mk_test_desc_rec(cx, test_)];
276+
descs += [mk_test_desc_rec(cx, test)];
277277
}
278278

279279
ret @{id: cx.sess.next_node_id(),

0 commit comments

Comments
 (0)