about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-22 15:16:31 -0700
committerbors <bors@rust-lang.org>2014-05-22 15:16:31 -0700
commit87ad19eb78239707f1ceed43e475c6aa052efdbc (patch)
tree35940d52f145bca81dcf73e5e7da7f3847ceb413 /src/libstd/rt
parente402e75f4eb79af09b9451f0f232f994b3e2c998 (diff)
parente878721d70349e2055f0ef854085de92e9498fde (diff)
downloadrust-87ad19eb78239707f1ceed43e475c6aa052efdbc.tar.gz
rust-87ad19eb78239707f1ceed43e475c6aa052efdbc.zip
auto merge of #14310 : pcwalton/rust/detildestr-alllibs, r=brson
r? @brson
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/args.rs44
-rw-r--r--src/libstd/rt/env.rs11
-rw-r--r--src/libstd/rt/macros.rs3
-rw-r--r--src/libstd/rt/task.rs8
-rw-r--r--src/libstd/rt/unwind.rs5
-rw-r--r--src/libstd/rt/util.rs5
6 files changed, 45 insertions, 31 deletions
diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs
index 95d0eabd336..cde20521c2f 100644
--- a/src/libstd/rt/args.rs
+++ b/src/libstd/rt/args.rs
@@ -37,8 +37,8 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
 #[cfg(test)]      pub unsafe fn cleanup() { realargs::cleanup() }
 
 /// Take the global arguments from global storage.
-#[cfg(not(test))] pub fn take() -> Option<Vec<~[u8]>> { imp::take() }
-#[cfg(test)]      pub fn take() -> Option<Vec<~[u8]>> {
+#[cfg(not(test))] pub fn take() -> Option<Vec<Vec<u8>>> { imp::take() }
+#[cfg(test)]      pub fn take() -> Option<Vec<Vec<u8>>> {
     match realargs::take() {
         realstd::option::Some(v) => Some(unsafe{ ::mem::transmute(v) }),
         realstd::option::None => None,
@@ -48,12 +48,16 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
 /// Give the global arguments to global storage.
 ///
 /// It is an error if the arguments already exist.
-#[cfg(not(test))] pub fn put(args: Vec<~[u8]>) { imp::put(args) }
-#[cfg(test)]      pub fn put(args: Vec<~[u8]>) { realargs::put(unsafe { ::mem::transmute(args) }) }
+#[cfg(not(test))] pub fn put(args: Vec<Vec<u8>>) { imp::put(args) }
+#[cfg(test)]      pub fn put(args: Vec<Vec<u8>>) {
+    realargs::put(unsafe {
+        ::mem::transmute(args)
+    })
+}
 
 /// Make a clone of the global arguments.
-#[cfg(not(test))] pub fn clone() -> Option<Vec<~[u8]>> { imp::clone() }
-#[cfg(test)]      pub fn clone() -> Option<Vec<~[u8]>> {
+#[cfg(not(test))] pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
+#[cfg(test)]      pub fn clone() -> Option<Vec<Vec<u8>>> {
     match realargs::clone() {
         realstd::option::Some(v) => Some(unsafe { ::mem::transmute(v) }),
         realstd::option::None => None,
@@ -88,15 +92,15 @@ mod imp {
         lock.destroy();
     }
 
-    pub fn take() -> Option<Vec<~[u8]>> {
+    pub fn take() -> Option<Vec<Vec<u8>>> {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
             let val = mem::replace(&mut *ptr, None);
-            val.as_ref().map(|s: &Box<Vec<~[u8]>>| (**s).clone())
+            val.as_ref().map(|s: &Box<Vec<Vec<u8>>>| (**s).clone())
         })
     }
 
-    pub fn put(args: Vec<~[u8]>) {
+    pub fn put(args: Vec<Vec<u8>>) {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
             rtassert!((*ptr).is_none());
@@ -104,10 +108,10 @@ mod imp {
         })
     }
 
-    pub fn clone() -> Option<Vec<~[u8]>> {
+    pub fn clone() -> Option<Vec<Vec<u8>>> {
         with_lock(|| unsafe {
             let ptr = get_global_ptr();
-            (*ptr).as_ref().map(|s: &Box<Vec<~[u8]>>| (**s).clone())
+            (*ptr).as_ref().map(|s: &Box<Vec<Vec<u8>>>| (**s).clone())
         })
     }
 
@@ -118,22 +122,21 @@ mod imp {
         }
     }
 
-    fn get_global_ptr() -> *mut Option<Box<Vec<~[u8]>>> {
+    fn get_global_ptr() -> *mut Option<Box<Vec<Vec<u8>>>> {
         unsafe { mem::transmute(&global_args_ptr) }
     }
 
     // Copied from `os`.
     #[cfg(not(test))]
-    unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> Vec<~[u8]> {
+    unsafe fn load_argc_and_argv(argc: int, argv: **u8) -> Vec<Vec<u8>> {
         use c_str::CString;
         use ptr::RawPtr;
         use libc;
-        use slice::CloneableVector;
         use vec::Vec;
 
         Vec::from_fn(argc as uint, |i| {
             let cs = CString::new(*(argv as **libc::c_char).offset(i as int), false);
-            cs.as_bytes_no_nul().to_owned()
+            Vec::from_slice(cs.as_bytes_no_nul())
         })
     }
 
@@ -148,7 +151,10 @@ mod imp {
             // Preserve the actual global state.
             let saved_value = take();
 
-            let expected = vec![bytes!("happy").to_owned(), bytes!("today?").to_owned()];
+            let expected = vec![
+                Vec::from_slice(bytes!("happy")),
+                Vec::from_slice(bytes!("today?")),
+            ];
 
             put(expected.clone());
             assert!(clone() == Some(expected.clone()));
@@ -179,15 +185,15 @@ mod imp {
     pub fn cleanup() {
     }
 
-    pub fn take() -> Option<Vec<~[u8]>> {
+    pub fn take() -> Option<Vec<Vec<u8>>> {
         fail!()
     }
 
-    pub fn put(_args: Vec<~[u8]>) {
+    pub fn put(_args: Vec<Vec<u8>>) {
         fail!()
     }
 
-    pub fn clone() -> Option<Vec<~[u8]>> {
+    pub fn clone() -> Option<Vec<Vec<u8>>> {
         fail!()
     }
 }
diff --git a/src/libstd/rt/env.rs b/src/libstd/rt/env.rs
index 708c42030ab..c9e5cae60e4 100644
--- a/src/libstd/rt/env.rs
+++ b/src/libstd/rt/env.rs
@@ -13,6 +13,7 @@
 use from_str::from_str;
 use option::{Some, None, Expect};
 use os;
+use str::Str;
 
 // Note that these are all accessed without any synchronization.
 // They are expected to be initialized once then left alone.
@@ -25,15 +26,19 @@ static mut DEBUG_BORROW: bool = false;
 pub fn init() {
     unsafe {
         match os::getenv("RUST_MIN_STACK") {
-            Some(s) => match from_str(s) {
+            Some(s) => match from_str(s.as_slice()) {
                 Some(i) => MIN_STACK = i,
                 None => ()
             },
             None => ()
         }
         match os::getenv("RUST_MAX_CACHED_STACKS") {
-            Some(max) => MAX_CACHED_STACKS = from_str(max).expect("expected positive integer in \
-                                                                   RUST_MAX_CACHED_STACKS"),
+            Some(max) => {
+                MAX_CACHED_STACKS =
+                    from_str(max.as_slice()).expect("expected positive \
+                                                     integer in \
+                                                     RUST_MAX_CACHED_STACKS")
+            }
             None => ()
         }
         match os::getenv("RUST_DEBUG_BORROW") {
diff --git a/src/libstd/rt/macros.rs b/src/libstd/rt/macros.rs
index 74675c85b96..aef41de925f 100644
--- a/src/libstd/rt/macros.rs
+++ b/src/libstd/rt/macros.rs
@@ -43,6 +43,7 @@ macro_rules! rtassert (
 
 macro_rules! rtabort (
     ($($arg:tt)*) => ( {
-        ::rt::util::abort(format!($($arg)*));
+        use str::Str;
+        ::rt::util::abort(format!($($arg)*).as_slice());
     } )
 )
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 8968747d990..749f44d1c9d 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -420,11 +420,11 @@ mod test {
 
     #[test]
     fn tls() {
-        local_data_key!(key: @~str)
-        key.replace(Some(@"data".to_owned()));
+        local_data_key!(key: @StrBuf)
+        key.replace(Some(@"data".to_strbuf()));
         assert_eq!(key.get().unwrap().as_slice(), "data");
-        local_data_key!(key2: @~str)
-        key2.replace(Some(@"data".to_owned()));
+        local_data_key!(key2: @StrBuf)
+        key2.replace(Some(@"data".to_strbuf()));
         assert_eq!(key2.get().unwrap().as_slice(), "data");
     }
 
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index af87a31b7bd..8f2df831196 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -71,6 +71,7 @@ use rt::backtrace;
 use rt::local::Local;
 use rt::task::Task;
 use str::Str;
+use strbuf::StrBuf;
 use task::TaskResult;
 
 use uw = rt::libunwind;
@@ -353,7 +354,7 @@ pub fn begin_unwind_fmt(msg: &fmt::Arguments, file: &'static str,
     // required with the current scheme, and (b) we don't handle
     // failure + OOM properly anyway (see comment in begin_unwind
     // below).
-    begin_unwind_inner(box fmt::format(msg), file, line)
+    begin_unwind_inner(box fmt::format_strbuf(msg), file, line)
 }
 
 /// This is the entry point of unwinding for fail!() and assert!().
@@ -388,7 +389,7 @@ fn begin_unwind_inner(msg: Box<Any:Send>,
     {
         let msg_s = match msg.as_ref::<&'static str>() {
             Some(s) => *s,
-            None => match msg.as_ref::<~str>() {
+            None => match msg.as_ref::<StrBuf>() {
                 Some(s) => s.as_slice(),
                 None => "Box<Any>",
             }
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index c9e82bd16e5..1ab9ac1b11e 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -18,7 +18,7 @@ use libc;
 use option::{Some, None, Option};
 use os;
 use result::Ok;
-use str::StrSlice;
+use str::{Str, StrSlice};
 use unstable::running_on_valgrind;
 use slice::ImmutableVector;
 
@@ -55,7 +55,7 @@ pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool {
 pub fn default_sched_threads() -> uint {
     match os::getenv("RUST_THREADS") {
         Some(nstr) => {
-            let opt_n: Option<uint> = FromStr::from_str(nstr);
+            let opt_n: Option<uint> = FromStr::from_str(nstr.as_slice());
             match opt_n {
                 Some(n) if n > 0 => n,
                 _ => rtabort!("`RUST_THREADS` is `{}`, should be a positive integer", nstr)
@@ -145,6 +145,7 @@ which at the time convulsed us with joy, yet which are now partly lost to my
 memory and partly incapable of presentation to others.",
         _ => "You've met with a terrible fate, haven't you?"
     };
+    ::alloc::util::make_stdlib_link_work(); // see comments in liballoc
     rterrln!("{}", "");
     rterrln!("{}", quote);
     rterrln!("{}", "");