diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-02 10:58:01 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-02 10:58:01 -0800 |
| commit | 902abab14475c4ed5885c1993492e89745edf0ad (patch) | |
| tree | e87f4e9c0a7bb599a073088abcb5ddaea09dae09 /src/libstd/rt/util.rs | |
| parent | 7b185f9cda565945ae048c5567b1680670ff7482 (diff) | |
| parent | 70ed3a48dfa301c5bb56de3e0a7c25214539b83c (diff) | |
rollup merge of #21787: alexcrichton/std-env
Conflicts: src/libstd/sys/unix/backtrace.rs src/libstd/sys/unix/os.rs
Diffstat (limited to 'src/libstd/rt/util.rs')
| -rw-r--r-- | src/libstd/rt/util.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index f5727a38b69..86d21cf7278 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -13,6 +13,7 @@ use prelude::v1::*; use cmp; +use env; use fmt; use intrinsics; use libc::{self, uintptr_t}; @@ -51,7 +52,7 @@ pub fn min_stack() -> uint { 0 => {} n => return n - 1, } - let amt = os::getenv("RUST_MIN_STACK").and_then(|s| s.parse().ok()); + let amt = env::var_string("RUST_MIN_STACK").ok().and_then(|s| s.parse().ok()); let amt = amt.unwrap_or(2 * 1024 * 1024); // 0 is our sentinel value, so ensure that we'll never see 0 after // initialization has run @@ -62,15 +63,15 @@ pub fn min_stack() -> uint { /// Get's the number of scheduler threads requested by the environment /// either `RUST_THREADS` or `num_cpus`. pub fn default_sched_threads() -> uint { - match os::getenv("RUST_THREADS") { - Some(nstr) => { + match env::var_string("RUST_THREADS") { + Ok(nstr) => { let opt_n: Option<uint> = nstr.parse().ok(); match opt_n { Some(n) if n > 0 => n, _ => panic!("`RUST_THREADS` is `{}`, should be a positive integer", nstr) } } - None => { + Err(..) => { if limit_thread_creation_due_to_osx_and_valgrind() { 1 } else { |
