diff options
| author | bors <bors@rust-lang.org> | 2014-03-29 11:41:37 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-29 11:41:37 -0700 |
| commit | d878df05ad589d1ae3f4e087bbc8abba1b459703 (patch) | |
| tree | 4fc8b2f734f94938d60fe6bfe2d2a0a4c11d7bbb /src/libarena | |
| parent | 3eb3a02c92e129e87561ebcf927543679bf7c74d (diff) | |
| parent | 63b233c25d45f4dc792fa864ddf710ce9ddd0224 (diff) | |
auto merge of #13183 : erickt/rust/remove-list, r=alexcrichton
`collections::list::List` was decided in a [team meeting](https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25) that it was unnecessary, so this PR removes it. Additionally, it removes an old and redundant purity test and fixes some warnings.
Diffstat (limited to 'src/libarena')
| -rw-r--r-- | src/libarena/lib.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index cd857afb5c4..061f3e6d268 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -27,8 +27,6 @@ extern crate collections; -use collections::list::{List, Cons, Nil}; - use std::cast::{transmute, transmute_mut, transmute_mut_region}; use std::cast; use std::cell::{Cell, RefCell}; @@ -87,7 +85,7 @@ pub struct Arena { // access the head. priv head: Chunk, priv copy_head: Chunk, - priv chunks: RefCell<@List<Chunk>>, + priv chunks: RefCell<Vec<Chunk>>, } impl Arena { @@ -99,7 +97,7 @@ impl Arena { Arena { head: chunk(initial_size, false), copy_head: chunk(initial_size, true), - chunks: RefCell::new(@Nil), + chunks: RefCell::new(Vec::new()), } } } @@ -117,7 +115,7 @@ impl Drop for Arena { fn drop(&mut self) { unsafe { destroy_chunk(&self.head); - for chunk in self.chunks.get().iter() { + for chunk in self.chunks.borrow().iter() { if !chunk.is_copy.get() { destroy_chunk(chunk); } @@ -179,7 +177,7 @@ impl Arena { fn alloc_copy_grow(&mut self, n_bytes: uint, align: uint) -> *u8 { // Allocate a new chunk. let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size()); - self.chunks.set(@Cons(self.copy_head.clone(), self.chunks.get())); + self.chunks.borrow_mut().push(self.copy_head.clone()); self.copy_head = chunk(num::next_power_of_two(new_min_chunk_size + 1u), true); @@ -219,7 +217,7 @@ impl Arena { -> (*u8, *u8) { // Allocate a new chunk. let new_min_chunk_size = cmp::max(n_bytes, self.chunk_size()); - self.chunks.set(@Cons(self.head.clone(), self.chunks.get())); + self.chunks.borrow_mut().push(self.head.clone()); self.head = chunk(num::next_power_of_two(new_min_chunk_size + 1u), false); |
