diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 |
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libarena | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip | |
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
Diffstat (limited to 'src/libarena')
| -rw-r--r-- | src/libarena/lib.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index d80385587da..24e7a65e02a 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -29,14 +29,14 @@ extern crate collections; use std::cast::{transmute, transmute_mut_lifetime}; use std::cast; use std::cell::{Cell, RefCell}; -use std::mem; -use std::ptr::read; use std::cmp; +use std::intrinsics::{TyDesc, get_tydesc}; +use std::intrinsics; +use std::mem; use std::num; +use std::ptr::read; use std::rc::Rc; use std::rt::global_heap; -use std::intrinsics::{TyDesc, get_tydesc}; -use std::intrinsics; // The way arena uses arrays is really deeply awful. The arrays are // allocated, and have capacities reserved, but the fill for the array @@ -339,12 +339,12 @@ pub struct TypedArena<T> { end: *T, /// A pointer to the first arena segment. - first: Option<~TypedArenaChunk<T>>, + first: Option<Box<TypedArenaChunk<T>>>, } struct TypedArenaChunk<T> { /// Pointer to the next arena segment. - next: Option<~TypedArenaChunk<T>>, + next: Option<Box<TypedArenaChunk<T>>>, /// The number of elements that this chunk can hold. capacity: uint, @@ -354,7 +354,8 @@ struct TypedArenaChunk<T> { impl<T> TypedArenaChunk<T> { #[inline] - fn new(next: Option<~TypedArenaChunk<T>>, capacity: uint) -> ~TypedArenaChunk<T> { + fn new(next: Option<Box<TypedArenaChunk<T>>>, capacity: uint) + -> Box<TypedArenaChunk<T>> { let mut size = mem::size_of::<TypedArenaChunk<T>>(); size = round_up(size, mem::min_align_of::<T>()); let elem_size = mem::size_of::<T>(); @@ -363,7 +364,7 @@ impl<T> TypedArenaChunk<T> { let mut chunk = unsafe { let chunk = global_heap::exchange_malloc(size); - let mut chunk: ~TypedArenaChunk<T> = cast::transmute(chunk); + let mut chunk: Box<TypedArenaChunk<T>> = cast::transmute(chunk); mem::move_val_init(&mut chunk.next, next); chunk }; |
