Skip to content

Commit bace6f0

Browse files
committed
---
yaml --- r: 66975 b: refs/heads/master c: b171413 h: refs/heads/master i: 66973: d15148b 66971: 9243bac 66967: b074a9a 66959: 9619217 66943: 19765ce v: v3
1 parent adc1cec commit bace6f0

File tree

8 files changed

+23
-4
lines changed

8 files changed

+23
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0239a06a6401d789a70c0089ada071ca981874df
2+
refs/heads/master: b17141370f316578e98164a37b2d4645d51b7095
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/librustc/middle/trans/closure.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ pub fn allocate_cbox(bcx: block, sigil: ast::Sigil, cdata_ty: ty::t)
174174
let ccx = bcx.ccx();
175175
let tcx = ccx.tcx;
176176

177+
fn nuke_ref_count(bcx: block, llbox: ValueRef) {
178+
let _icx = push_ctxt("closure::nuke_ref_count");
179+
// Initialize ref count to arbitrary value for debugging:
180+
let ccx = bcx.ccx();
181+
let llbox = PointerCast(bcx, llbox, Type::opaque_box(ccx).ptr_to());
182+
let ref_cnt = GEPi(bcx, llbox, [0u, abi::box_field_refcnt]);
183+
let rc = C_int(ccx, 0x12345678);
184+
Store(bcx, rc, ref_cnt);
185+
}
186+
177187
// Allocate and initialize the box:
178188
match sigil {
179189
ast::ManagedSigil => {
@@ -185,6 +195,7 @@ pub fn allocate_cbox(bcx: block, sigil: ast::Sigil, cdata_ty: ty::t)
185195
ast::BorrowedSigil => {
186196
let cbox_ty = tuplify_box_ty(tcx, cdata_ty);
187197
let llbox = alloc_ty(bcx, cbox_ty, "__closure");
198+
nuke_ref_count(bcx, llbox);
188199
rslt(bcx, llbox)
189200
}
190201
}

trunk/src/libstd/reflect.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
197197
true
198198
}
199199

200-
#[cfg(stage0)]
201200
fn visit_str(&self) -> bool {
202201
self.align_to::<~str>();
203202
if ! self.inner.visit_str() { return false; }

trunk/src/libstd/repr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ impl TyVisitor for ReprVisitor {
269269
}
270270

271271
// Type no longer exists, vestigial function.
272-
#[cfg(stage0)]
273272
fn visit_str(&self) -> bool { fail!(); }
274273

275274
fn visit_estr_box(&self) -> bool {

trunk/src/libstd/rt/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
6969
let f_cell = Cell::new(f);
7070

7171
do run_in_bare_thread {
72-
let nthreads = match os::getenv("RUST_TEST_THREADS") {
72+
let nthreads = match os::getenv("RUST_RT_TEST_THREADS") {
7373
Some(nstr) => FromStr::from_str(nstr).get(),
7474
None => {
7575
// Using more threads than cores in test code

trunk/src/libstd/unstable/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ pub trait TyVisitor {
8282
fn visit_f64(&self) -> bool;
8383

8484
fn visit_char(&self) -> bool;
85+
fn visit_str(&self) -> bool;
8586

8687
fn visit_estr_box(&self) -> bool;
8788
fn visit_estr_uniq(&self) -> bool;

trunk/src/test/run-pass/reflect-visit-data.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
181181
true
182182
}
183183

184+
fn visit_str(&self) -> bool {
185+
self.align_to::<~str>();
186+
if ! self.inner.visit_str() { return false; }
187+
self.bump_past::<~str>();
188+
true
189+
}
190+
184191
fn visit_estr_box(&self) -> bool {
185192
self.align_to::<@str>();
186193
if ! self.inner.visit_estr_box() { return false; }
@@ -549,6 +556,7 @@ impl TyVisitor for my_visitor {
549556
fn visit_f64(&self) -> bool { true }
550557

551558
fn visit_char(&self) -> bool { true }
559+
fn visit_str(&self) -> bool { true }
552560

553561
fn visit_estr_box(&self) -> bool { true }
554562
fn visit_estr_uniq(&self) -> bool { true }

trunk/src/test/run-pass/reflect-visit-type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl TyVisitor for MyVisitor {
5959
fn visit_f64(&self) -> bool { true }
6060

6161
fn visit_char(&self) -> bool { true }
62+
fn visit_str(&self) -> bool { true }
6263

6364
fn visit_estr_box(&self) -> bool { true }
6465
fn visit_estr_uniq(&self) -> bool { true }

0 commit comments

Comments
 (0)