about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-03 10:56:57 -0700
committerbors <bors@rust-lang.org>2014-05-03 10:56:57 -0700
commit0c691df8acaf10aa3721476e5d7fafcee11b0aaa (patch)
tree7aca9144c64039fea0aff444e13870b4be40fae7 /src/libstd/rt
parentbca9647cd34c78a1c7c2409fbb2c31cb2c8194d7 (diff)
parenta5be12ce7e88c1d28de1c98215991127d1e765f0 (diff)
downloadrust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.tar.gz
rust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.zip
auto merge of #13773 : brson/rust/boxxy, r=alexcrichton
`box` is the way you allocate in future-rust.
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/args.rs4
-rw-r--r--src/libstd/rt/at_exit_imp.rs2
-rw-r--r--src/libstd/rt/global_heap.rs4
-rw-r--r--src/libstd/rt/local.rs12
-rw-r--r--src/libstd/rt/task.rs4
-rw-r--r--src/libstd/rt/thread.rs6
-rw-r--r--src/libstd/rt/thread_local_storage.rs8
-rw-r--r--src/libstd/rt/unwind.rs6
8 files changed, 23 insertions, 23 deletions
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs
index 824d9e5ec92..092efcad831 100644
--- a/src/libstd/rt/args.rs
+++ b/src/libstd/rt/args.rs
@@ -99,7 +99,7 @@ mod imp {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
             rtassert!((*ptr).is_none());
-            (*ptr) = Some(~args.clone());
+            (*ptr) = Some(box args.clone());
         })
     }
 
@@ -147,7 +147,7 @@ mod imp {
             // Preserve the actual global state.
             let saved_value = take();
 
-            let expected = ~[bytes!("happy").to_owned(), bytes!("today?").to_owned()];
+            let expected = box [bytes!("happy").to_owned(), bytes!("today?").to_owned()];
 
             put(expected.clone());
             assert!(clone() == Some(expected.clone()));
diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs
index 67b8b40b47e..2c8e159aeb9 100644
--- a/src/libstd/rt/at_exit_imp.rs
+++ b/src/libstd/rt/at_exit_imp.rs
@@ -36,7 +36,7 @@ pub fn init() {
     unsafe {
         rtassert!(!RUNNING);
         rtassert!(QUEUE.is_null());
-        let state: ~Queue = ~Exclusive::new(vec!());
+        let state: ~Queue = box Exclusive::new(vec!());
         QUEUE = cast::transmute(state);
     }
 }
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs
index b9c0a02d7d2..094bbd13889 100644
--- a/src/libstd/rt/global_heap.rs
+++ b/src/libstd/rt/global_heap.rs
@@ -125,14 +125,14 @@ mod bench {
     #[bench]
     fn alloc_owned_small(b: &mut Bencher) {
         b.iter(|| {
-            ~10
+            box 10
         })
     }
 
     #[bench]
     fn alloc_owned_big(b: &mut Bencher) {
         b.iter(|| {
-            ~[10, ..1000]
+            box [10, ..1000]
         })
     }
 }
diff --git a/src/libstd/rt/local.rs b/src/libstd/rt/local.rs
index 3cfa494d382..828bbc118c1 100644
--- a/src/libstd/rt/local.rs
+++ b/src/libstd/rt/local.rs
@@ -59,7 +59,7 @@ mod test {
     #[test]
     fn thread_local_task_smoke_test() {
         run_in_bare_thread(proc() {
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
             let task: ~Task = Local::take();
             cleanup_task(task);
@@ -69,11 +69,11 @@ mod test {
     #[test]
     fn thread_local_task_two_instances() {
         run_in_bare_thread(proc() {
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
             let task: ~Task = Local::take();
             cleanup_task(task);
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
             let task: ~Task = Local::take();
             cleanup_task(task);
@@ -83,7 +83,7 @@ mod test {
     #[test]
     fn borrow_smoke_test() {
         run_in_bare_thread(proc() {
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
 
             unsafe {
@@ -97,7 +97,7 @@ mod test {
     #[test]
     fn borrow_with_return() {
         run_in_bare_thread(proc() {
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
 
             {
@@ -112,7 +112,7 @@ mod test {
     #[test]
     fn try_take() {
         run_in_bare_thread(proc() {
-            let task = ~Task::new();
+            let task = box Task::new();
             Local::put(task);
 
             let t: ~Task = Local::try_take().unwrap();
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 2dab0e975da..ae5786604c7 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -353,7 +353,7 @@ impl BlockedTask {
                 blocked_task_ptr
             }
             Shared(arc) => {
-                let blocked_task_ptr: uint = cast::transmute(~arc);
+                let blocked_task_ptr: uint = cast::transmute(box arc);
                 rtassert!(blocked_task_ptr & 0x1 == 0);
                 blocked_task_ptr | 0x1
             }
@@ -485,7 +485,7 @@ mod test {
 
     #[test]
     fn block_and_wake() {
-        let task = ~Task::new();
+        let task = box Task::new();
         let mut task = BlockedTask::block(task).wake().unwrap();
         task.destroyed = true;
     }
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index 9f5986e3dc6..a836958279b 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -80,12 +80,12 @@ impl Thread<()> {
         // We need the address of the packet to fill in to be stable so when
         // `main` fills it in it's still valid, so allocate an extra ~ box to do
         // so.
-        let packet = ~None;
+        let packet = box None;
         let packet2: *mut Option<T> = unsafe {
             *cast::transmute::<&~Option<T>, **mut Option<T>>(&packet)
         };
         let main = proc() unsafe { *packet2 = Some(main()); };
-        let native = unsafe { imp::create(stack, ~main) };
+        let native = unsafe { imp::create(stack, box main) };
 
         Thread {
             native: native,
@@ -108,7 +108,7 @@ impl Thread<()> {
     /// stack size for the new thread.
     pub fn spawn_stack(stack: uint, main: proc():Send) {
         unsafe {
-            let handle = imp::create(stack, ~main);
+            let handle = imp::create(stack, box main);
             imp::detach(handle);
         }
     }
diff --git a/src/libstd/rt/thread_local_storage.rs b/src/libstd/rt/thread_local_storage.rs
index 2f567e91b4c..fceff80e792 100644
--- a/src/libstd/rt/thread_local_storage.rs
+++ b/src/libstd/rt/thread_local_storage.rs
@@ -96,14 +96,14 @@ fn tls_smoke_test() {
     use cast::transmute;
     unsafe {
         let mut key = 0;
-        let value = ~20;
+        let value = box 20;
         create(&mut key);
         set(key, transmute(value));
         let value: ~int = transmute(get(key));
-        assert_eq!(value, ~20);
-        let value = ~30;
+        assert_eq!(value, box 20);
+        let value = box 30;
         set(key, transmute(value));
         let value: ~int = transmute(get(key));
-        assert_eq!(value, ~30);
+        assert_eq!(value, box 30);
     }
 }
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 4f84202f8f8..98623c35b78 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -141,7 +141,7 @@ impl Unwinder {
         #[no_mangle]
         fn rust_fail() -> ! {
             unsafe {
-                let exception = ~uw::_Unwind_Exception {
+                let exception = box uw::_Unwind_Exception {
                     exception_class: rust_exception_class(),
                     exception_cleanup: exception_cleanup,
                     private: [0, ..uw::unwinder_private_data_size],
@@ -346,7 +346,7 @@ pub fn begin_unwind_fmt(msg: &fmt::Arguments, file: &'static str, line: uint) ->
     // required with the current scheme, and (b) we don't handle
     // failure + OOM properly anyway (see comment in begin_unwind
     // below).
-    begin_unwind_inner(~fmt::format(msg), file, line)
+    begin_unwind_inner(box fmt::format(msg), file, line)
 }
 
 /// This is the entry point of unwinding for fail!() and assert!().
@@ -360,7 +360,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
     // failing.
 
     // see below for why we do the `Any` coercion here.
-    begin_unwind_inner(~msg, file, line)
+    begin_unwind_inner(box msg, file, line)
 }