diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-16 10:45:16 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-22 14:42:01 -0700 |
| commit | 36195eb91f15975fed7555a3aa52807ecd5698a1 (patch) | |
| tree | d0e99310be4a24e76b8d6b13f05ec79c1f89b6ba /src/libstd/rt | |
| parent | e402e75f4eb79af09b9451f0f232f994b3e2c998 (diff) | |
| download | rust-36195eb91f15975fed7555a3aa52807ecd5698a1.tar.gz rust-36195eb91f15975fed7555a3aa52807ecd5698a1.zip | |
libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/env.rs | 11 | ||||
| -rw-r--r-- | src/libstd/rt/macros.rs | 3 | ||||
| -rw-r--r-- | src/libstd/rt/task.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rt/unwind.rs | 5 | ||||
| -rw-r--r-- | src/libstd/rt/util.rs | 4 |
5 files changed, 19 insertions, 12 deletions
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..7aebb6e4796 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) |
