Skip to content

Commit b27323d

Browse files
committed
---
yaml --- r: 89029 b: refs/heads/snap-stage3 c: 9ff65b5 h: refs/heads/master i: 89027: ce0931c v: v3
1 parent 0774f5c commit b27323d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a5d976297285ad837e5c7e3a4ce5e9d01d3848c5
4+
refs/heads/snap-stage3: 9ff65b503f0ecb00e5ddcda1776b1c55b123fc46
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use driver::session;
1515
use front::config;
1616

17+
use std::cell::RefCell;
1718
use std::vec;
1819
use syntax::ast_util::*;
1920
use syntax::attr::AttrMetaMethods;
@@ -38,7 +39,7 @@ struct Test {
3839

3940
struct TestCtxt {
4041
sess: session::Session,
41-
path: ~[ast::Ident],
42+
path: RefCell<~[ast::Ident]>,
4243
ext_cx: @ExtCtxt,
4344
testfns: ~[Test],
4445
is_extra: bool,
@@ -78,9 +79,12 @@ impl fold::ast_fold for TestHarnessGenerator {
7879
}
7980

8081
fn fold_item(&self, i: @ast::item) -> SmallVector<@ast::item> {
81-
self.cx.path.push(i.ident);
82+
{
83+
let mut path = self.cx.path.borrow_mut();
84+
path.get().push(i.ident);
85+
}
8286
debug!("current path: {}",
83-
ast_util::path_name_i(self.cx.path.clone()));
87+
ast_util::path_name_i(self.cx.path.get()));
8488

8589
if is_test_fn(self.cx, i) || is_bench_fn(i) {
8690
match i.node {
@@ -95,7 +99,7 @@ impl fold::ast_fold for TestHarnessGenerator {
9599
debug!("this is a test function");
96100
let test = Test {
97101
span: i.span,
98-
path: self.cx.path.clone(),
102+
path: self.cx.path.get(),
99103
bench: is_bench_fn(i),
100104
ignore: is_ignored(self.cx, i),
101105
should_fail: should_fail(i)
@@ -108,7 +112,10 @@ impl fold::ast_fold for TestHarnessGenerator {
108112
}
109113

110114
let res = fold::noop_fold_item(i, self);
111-
self.cx.path.pop();
115+
{
116+
let mut path = self.cx.path.borrow_mut();
117+
path.get().pop();
118+
}
112119
res
113120
}
114121

@@ -147,7 +154,7 @@ fn generate_test_harness(sess: session::Session, crate: ast::Crate)
147154
let cx: @mut TestCtxt = @mut TestCtxt {
148155
sess: sess,
149156
ext_cx: ExtCtxt::new(sess.parse_sess, sess.opts.cfg.clone()),
150-
path: ~[],
157+
path: RefCell::new(~[]),
151158
testfns: ~[],
152159
is_extra: is_extra(&crate),
153160
config: crate.config.clone(),

0 commit comments

Comments
 (0)