diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-27 11:18:36 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-05-27 11:19:03 +0300 |
| commit | 377b0900aede976b2d37a499bbd7b62c2e39b358 (patch) | |
| tree | b4a5a4431d36ed1a4e0a39c7d2ef2563ecac9bf4 /src/libstd/rt/unwind | |
| parent | 6e8e4f847c2ea02fec021ea15dfb2de6beac797a (diff) | |
| download | rust-377b0900aede976b2d37a499bbd7b62c2e39b358.tar.gz rust-377b0900aede976b2d37a499bbd7b62c2e39b358.zip | |
Use `const fn` to abstract away the contents of UnsafeCell & friends.
Diffstat (limited to 'src/libstd/rt/unwind')
| -rw-r--r-- | src/libstd/rt/unwind/mod.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libstd/rt/unwind/mod.rs b/src/libstd/rt/unwind/mod.rs index 576035ffe9a..c403976745a 100644 --- a/src/libstd/rt/unwind/mod.rs +++ b/src/libstd/rt/unwind/mod.rs @@ -72,7 +72,7 @@ use intrinsics; use libc::c_void; use mem; use sync::atomic::{self, Ordering}; -use sys_common::mutex::{Mutex, MUTEX_INIT}; +use sys_common::mutex::Mutex; // The actual unwinding implementation is cfg'd here, and we've got two current // implementations. One goes through SEH on Windows and the other goes through @@ -89,15 +89,15 @@ pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: u32); // For more information, see below. const MAX_CALLBACKS: usize = 16; static CALLBACKS: [atomic::AtomicUsize; MAX_CALLBACKS] = - [atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT, - atomic::ATOMIC_USIZE_INIT, atomic::ATOMIC_USIZE_INIT]; -static CALLBACK_CNT: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; + [atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0), + atomic::AtomicUsize::new(0), atomic::AtomicUsize::new(0)]; +static CALLBACK_CNT: atomic::AtomicUsize = atomic::AtomicUsize::new(0); thread_local! { static PANICKING: Cell<bool> = Cell::new(false) } @@ -243,7 +243,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, // `std::sync` one as accessing TLS can cause weird recursive problems (and // we don't need poison checking). unsafe { - static LOCK: Mutex = MUTEX_INIT; + static LOCK: Mutex = Mutex::new(); static mut INIT: bool = false; LOCK.lock(); if !INIT { |
