Skip to content

Commit 2e09afd

Browse files
committed
---
yaml --- r: 147645 b: refs/heads/try2 c: 9ff65b5 h: refs/heads/master i: 147643: 8c924be v: v3
1 parent d963465 commit 2e09afd

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
@@ -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: a5d976297285ad837e5c7e3a4ce5e9d01d3848c5
8+
refs/heads/try2: 9ff65b503f0ecb00e5ddcda1776b1c55b123fc46
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: 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)