about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/backtrace.rs20
-rw-r--r--src/libstd/rt/util.rs6
2 files changed, 12 insertions, 14 deletions
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index 6cbbc0af390..e05e533be56 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -28,20 +28,18 @@ pub use self::imp::write;
 // For now logging is turned off by default, and this function checks to see
 // whether the magical environment variable is present to see if it's turned on.
 pub fn log_enabled() -> bool {
-    static mut ENABLED: atomic::AtomicInt = atomic::INIT_ATOMIC_INT;
-    unsafe {
-        match ENABLED.load(atomic::SeqCst) {
-            1 => return false,
-            2 => return true,
-            _ => {}
-        }
+    static ENABLED: atomic::AtomicInt = atomic::INIT_ATOMIC_INT;
+    match ENABLED.load(atomic::SeqCst) {
+        1 => return false,
+        2 => return true,
+        _ => {}
     }
 
     let val = match os::getenv("RUST_BACKTRACE") {
         Some(..) => 2,
         None => 1,
     };
-    unsafe { ENABLED.store(val, atomic::SeqCst); }
+    ENABLED.store(val, atomic::SeqCst);
     val == 2
 }
 
@@ -268,7 +266,7 @@ mod imp {
         // while it doesn't requires lock for work as everything is
         // local, it still displays much nicer backtraces when a
         // couple of tasks fail simultaneously
-        static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
+        static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
         let _g = unsafe { LOCK.lock() };
 
         try!(writeln!(w, "stack backtrace:"));
@@ -301,7 +299,7 @@ mod imp {
         // is semi-reasonable in terms of printing anyway, and we know that all
         // I/O done here is blocking I/O, not green I/O, so we don't have to
         // worry about this being a native vs green mutex.
-        static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
+        static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
         let _g = unsafe { LOCK.lock() };
 
         try!(writeln!(w, "stack backtrace:"));
@@ -931,7 +929,7 @@ mod imp {
     pub fn write(w: &mut Writer) -> IoResult<()> {
         // According to windows documentation, all dbghelp functions are
         // single-threaded.
-        static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
+        static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
         let _g = unsafe { LOCK.lock() };
 
         // Open up dbghelp.dll, we don't link to it explicitly because it can't
diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs
index ed24ed2a569..ec301369804 100644
--- a/src/libstd/rt/util.rs
+++ b/src/libstd/rt/util.rs
@@ -41,8 +41,8 @@ pub fn limit_thread_creation_due_to_osx_and_valgrind() -> bool {
 }
 
 pub fn min_stack() -> uint {
-    static mut MIN: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
-    match unsafe { MIN.load(atomic::SeqCst) } {
+    static MIN: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
+    match MIN.load(atomic::SeqCst) {
         0 => {}
         n => return n - 1,
     }
@@ -50,7 +50,7 @@ pub fn min_stack() -> uint {
     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
-    unsafe { MIN.store(amt + 1, atomic::SeqCst); }
+    MIN.store(amt + 1, atomic::SeqCst);
     return amt;
 }