Skip to content

Commit d6e9384

Browse files
committed
---
yaml --- r: 101797 b: refs/heads/master c: aaead93 h: refs/heads/master i: 101795: 4565e2a v: v3
1 parent d6d5d1f commit d6e9384

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
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: d5e0622f95252e442b909011129336c11ddb0151
2+
refs/heads/master: aaead93c4554b685935b70565fc1bb54edd945d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/src/libstd/rt/local_heap.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rt::local::Local;
2323
use rt::task::Task;
2424
use unstable::raw;
2525
use vec::ImmutableVector;
26+
use vec_ng::Vec;
2627

2728
// This has no meaning with out rtdebug also turned on.
2829
#[cfg(rtdebug)]
@@ -33,7 +34,7 @@ static MAGIC: u32 = 0xbadc0ffe;
3334
pub type Box = raw::Box<()>;
3435

3536
pub struct MemoryRegion {
36-
priv allocations: ~[*AllocHeader],
37+
priv allocations: Vec<*AllocHeader>,
3738
priv live_allocations: uint,
3839
}
3940

@@ -48,7 +49,7 @@ impl LocalHeap {
4849
#[inline]
4950
pub fn new() -> LocalHeap {
5051
let region = MemoryRegion {
51-
allocations: ~[],
52+
allocations: Vec::new(),
5253
live_allocations: 0,
5354
};
5455
LocalHeap {
@@ -248,8 +249,8 @@ impl MemoryRegion {
248249
fn release(&mut self, alloc: &AllocHeader) {
249250
alloc.assert_sane();
250251
if TRACK_ALLOCATIONS > 1 {
251-
rtassert!(self.allocations[alloc.index] == alloc as *AllocHeader);
252-
self.allocations[alloc.index] = ptr::null();
252+
rtassert!(self.allocations.as_slice()[alloc.index] == alloc as *AllocHeader);
253+
self.allocations.as_mut_slice()[alloc.index] = ptr::null();
253254
}
254255
}
255256
#[cfg(not(rtdebug))]
@@ -260,8 +261,8 @@ impl MemoryRegion {
260261
fn update(&mut self, alloc: &mut AllocHeader, orig: *AllocHeader) {
261262
alloc.assert_sane();
262263
if TRACK_ALLOCATIONS > 1 {
263-
rtassert!(self.allocations[alloc.index] == orig);
264-
self.allocations[alloc.index] = &*alloc as *AllocHeader;
264+
rtassert!(self.allocations.as_slice()[alloc.index] == orig);
265+
self.allocations.as_mut_slice()[alloc.index] = &*alloc as *AllocHeader;
265266
}
266267
}
267268
#[cfg(not(rtdebug))]
@@ -274,7 +275,7 @@ impl Drop for MemoryRegion {
274275
if self.live_allocations != 0 {
275276
rtabort!("leaked managed memory ({} objects)", self.live_allocations);
276277
}
277-
rtassert!(self.allocations.iter().all(|s| s.is_null()));
278+
rtassert!(self.allocations.as_slice().iter().all(|s| s.is_null()));
278279
}
279280
}
280281

0 commit comments

Comments
 (0)