Skip to content

Commit 6d057e6

Browse files
committed
---
yaml --- r: 147646 b: refs/heads/try2 c: d0dfc35 h: refs/heads/master v: v3
1 parent 2e09afd commit 6d057e6

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9ff65b503f0ecb00e5ddcda1776b1c55b123fc46
8+
refs/heads/try2: d0dfc35fc906e30502c17139ac91798db4d99fce
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/front/test.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct TestCtxt {
4141
sess: session::Session,
4242
path: RefCell<~[ast::Ident]>,
4343
ext_cx: @ExtCtxt,
44-
testfns: ~[Test],
44+
testfns: RefCell<~[Test]>,
4545
is_extra: bool,
4646
config: ast::CrateConfig,
4747
}
@@ -104,7 +104,10 @@ impl fold::ast_fold for TestHarnessGenerator {
104104
ignore: is_ignored(self.cx, i),
105105
should_fail: should_fail(i)
106106
};
107-
self.cx.testfns.push(test);
107+
{
108+
let mut testfns = self.cx.testfns.borrow_mut();
109+
testfns.get().push(test);
110+
}
108111
// debug!("have {} test/bench functions",
109112
// cx.testfns.len());
110113
}
@@ -155,7 +158,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
155158
sess: sess,
156159
ext_cx: ExtCtxt::new(sess.parse_sess, sess.opts.cfg.clone()),
157160
path: RefCell::new(~[]),
158-
testfns: ~[],
161+
testfns: RefCell::new(~[]),
159162
is_extra: is_extra(&crate),
160163
config: crate.config.clone(),
161164
};
@@ -389,10 +392,13 @@ fn is_extra(crate: &ast::Crate) -> bool {
389392
}
390393

391394
fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
392-
debug!("building test vector from {} tests", cx.testfns.len());
393395
let mut descs = ~[];
394-
for test in cx.testfns.iter() {
395-
descs.push(mk_test_desc_and_fn_rec(cx, test));
396+
{
397+
let testfns = cx.testfns.borrow();
398+
debug!("building test vector from {} tests", testfns.get().len());
399+
for test in testfns.get().iter() {
400+
descs.push(mk_test_desc_and_fn_rec(cx, test));
401+
}
396402
}
397403

398404
let inner_expr = @ast::Expr {

0 commit comments

Comments
 (0)