From e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Jul 2014 19:10:12 -0700 Subject: std: Stabilize unit, bool, ty, tuple, arc, any This commit applies stability attributes to the contents of these modules, summarized here: * The `unit` and `bool` modules have become #[unstable] as they are purely meant for documentation purposes and are candidates for removal. * The `ty` module has been deprecated, and the inner `Unsafe` type has been renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field has been removed as the compiler now always infers `UnsafeCell` to be invariant. The `new` method i stable, but the `value` field, `get` and `unwrap` methods are all unstable. * The `tuple` module has its name as stable, the naming of the `TupleN` traits as stable while the methods are all #[unstable]. The other impls in the module have appropriate stability for the corresponding trait. * The `arc` module has received the exact same treatment as the `rc` module previously did. * The `any` module has its name as stable. The `Any` trait is also stable, with a new private supertrait which now contains the `get_type_id` method. This is to make the method a private implementation detail rather than a public-facing detail. The two extension traits in the module are marked #[unstable] as they will not be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods have been renamed to downcast_{mut,ref} and are #[unstable]. The extension trait `BoxAny` has been clarified as to why it is unstable as it will not be necessary with DST. This is a breaking change because the `marker1` field was removed from the `UnsafeCell` type. To deal with this change, you can simply delete the field and only specify the value of the `data` field in static initializers. [breaking-change] --- src/libnative/io/helper_thread.rs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/libnative') diff --git a/src/libnative/io/helper_thread.rs b/src/libnative/io/helper_thread.rs index d18e92866bf..8e92aa56d3c 100644 --- a/src/libnative/io/helper_thread.rs +++ b/src/libnative/io/helper_thread.rs @@ -26,7 +26,7 @@ use std::mem; use std::rt::bookkeeping; use std::rt::mutex::StaticNativeMutex; use std::rt; -use std::ty::Unsafe; +use std::cell::UnsafeCell; use task; @@ -41,35 +41,26 @@ pub struct Helper { /// Internal lock which protects the remaining fields pub lock: StaticNativeMutex, - // You'll notice that the remaining fields are Unsafe, and this is + // You'll notice that the remaining fields are UnsafeCell, and this is // because all helper thread operations are done through &self, but we need // these to be mutable (once `lock` is held). /// Lazily allocated channel to send messages to the helper thread. - pub chan: Unsafe<*mut Sender>, + pub chan: UnsafeCell<*mut Sender>, /// OS handle used to wake up a blocked helper thread - pub signal: Unsafe, + pub signal: UnsafeCell, /// Flag if this helper thread has booted and been initialized yet. - pub initialized: Unsafe, + pub initialized: UnsafeCell, } macro_rules! helper_init( (static mut $name:ident: Helper<$m:ty>) => ( static mut $name: Helper<$m> = Helper { lock: ::std::rt::mutex::NATIVE_MUTEX_INIT, - chan: ::std::ty::Unsafe { - value: 0 as *mut Sender<$m>, - marker1: ::std::kinds::marker::InvariantType, - }, - signal: ::std::ty::Unsafe { - value: 0, - marker1: ::std::kinds::marker::InvariantType, - }, - initialized: ::std::ty::Unsafe { - value: false, - marker1: ::std::kinds::marker::InvariantType, - }, + chan: ::std::cell::UnsafeCell { value: 0 as *mut Sender<$m> }, + signal: ::std::cell::UnsafeCell { value: 0 }, + initialized: ::std::cell::UnsafeCell { value: false }, }; ) ) -- cgit 1.4.1-3-g733a5