std: Split the std_misc feature

This commit is contained in:
Alex Crichton 2015-06-09 18:15:22 -07:00
parent d444d0c357
commit 6895311e85
35 changed files with 92 additions and 117 deletions

View File

@ -1151,7 +1151,7 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> {
}
impl<'a, K: Ord, V> Entry<'a, K, V> {
#[unstable(feature = "std_misc",
#[unstable(feature = "entry",
reason = "will soon be replaced by or_insert")]
#[deprecated(since = "1.0",
reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]

View File

@ -173,8 +173,10 @@
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(iter_cmp)]
#![feature(once_new)]
#![feature(rt)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(static_mutex)]
use std::boxed;
use std::cell::RefCell;

View File

@ -34,9 +34,11 @@
#![feature(const_fn)]
#![feature(duration)]
#![feature(duration_span)]
#![feature(dynamic_lib)]
#![feature(enumset)]
#![feature(fs_canonicalize)]
#![feature(hash_default)]
#![feature(hashmap_hasher)]
#![feature(into_cow)]
#![feature(iter_sum)]
#![feature(libc)]
@ -53,7 +55,6 @@
#![feature(slice_patterns)]
#![feature(slice_position_elem)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(str_matches)]
#![feature(vec_push_all)]

View File

@ -33,6 +33,7 @@
#![feature(iter_sum)]
#![feature(iter_unfold)]
#![feature(libc)]
#![feature(once_new)]
#![feature(path_ext)]
#![feature(path_ext)]
#![feature(path_relative_from)]
@ -42,7 +43,6 @@
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(unicode)]
#![feature(unicode)]
#![feature(vec_push_all)]

View File

@ -29,15 +29,15 @@ Core encoding and decoding interfaces.
#![feature(box_syntax)]
#![feature(collections)]
#![feature(enumset)]
#![feature(hashmap_hasher)]
#![feature(num_bits_bytes)]
#![feature(num_wrapping)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(unicode)]
#![feature(vecmap)]
#![feature(enumset)]
#![cfg_attr(test, feature(test))]
// test harness access

View File

@ -18,7 +18,7 @@ use ops::Range;
use mem;
/// Extension methods for ASCII-subset only operations on owned strings
#[unstable(feature = "std_misc",
#[unstable(feature = "owned_ascii_ext",
reason = "would prefer to do this in a more general way")]
pub trait OwnedAsciiExt {
/// Converts the string to ASCII upper case:
@ -189,8 +189,6 @@ impl AsciiExt for str {
}
}
#[unstable(feature = "std_misc",
reason = "would prefer to do this in a more general way")]
impl OwnedAsciiExt for String {
#[inline]
fn into_ascii_uppercase(self) -> String {
@ -244,8 +242,6 @@ impl AsciiExt for [u8] {
}
}
#[unstable(feature = "std_misc",
reason = "would prefer to do this in a more general way")]
impl OwnedAsciiExt for Vec<u8> {
#[inline]
fn into_ascii_uppercase(mut self) -> Vec<u8> {

View File

@ -43,8 +43,7 @@ use super::table::BucketState::{
use super::state::HashState;
const INITIAL_LOG2_CAP: usize = 5;
#[unstable(feature = "std_misc")]
pub const INITIAL_CAPACITY: usize = 1 << INITIAL_LOG2_CAP; // 2^5
const INITIAL_CAPACITY: usize = 1 << INITIAL_LOG2_CAP; // 2^5
/// The default behavior of HashMap implements a load factor of 90.9%.
/// This behavior is characterized by the following condition:
@ -544,7 +543,7 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(hashmap_hasher)]
/// use std::collections::HashMap;
/// use std::collections::hash_map::RandomState;
///
@ -553,7 +552,7 @@ impl<K, V, S> HashMap<K, V, S>
/// map.insert(1, 2);
/// ```
#[inline]
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> {
HashMap {
hash_state: hash_state,
@ -573,7 +572,7 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(hashmap_hasher)]
/// use std::collections::HashMap;
/// use std::collections::hash_map::RandomState;
///
@ -582,7 +581,7 @@ impl<K, V, S> HashMap<K, V, S>
/// map.insert(1, 2);
/// ```
#[inline]
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
-> HashMap<K, V, S> {
let resize_policy = DefaultResizePolicy::new();
@ -980,7 +979,7 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(drain)]
/// use std::collections::HashMap;
///
/// let mut a = HashMap::new();
@ -995,7 +994,7 @@ impl<K, V, S> HashMap<K, V, S>
/// assert!(a.is_empty());
/// ```
#[inline]
#[unstable(feature = "std_misc",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn drain(&mut self) -> Drain<K, V> {
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
@ -1308,7 +1307,7 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
}
/// HashMap drain iterator.
#[unstable(feature = "std_misc",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub struct Drain<'a, K: 'a, V: 'a> {
inner: iter::Map<table::Drain<'a, K, V>, fn((SafeHash, K, V)) -> (K, V)>
@ -1480,7 +1479,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
}
impl<'a, K, V> Entry<'a, K, V> {
#[unstable(feature = "std_misc",
#[unstable(feature = "entry",
reason = "will soon be replaced by or_insert")]
#[deprecated(since = "1.0",
reason = "replaced with more ergonomic `or_insert` and `or_insert_with`")]
@ -1596,14 +1595,14 @@ impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S>
/// `Hasher`, but the hashers created by two different `RandomState`
/// instances are unlikely to produce the same result for the same values.
#[derive(Clone)]
#[unstable(feature = "std_misc",
#[unstable(feature = "hashmap_hasher",
reason = "hashing an hash maps may be altered")]
pub struct RandomState {
k0: u64,
k1: u64,
}
#[unstable(feature = "std_misc",
#[unstable(feature = "hashmap_hasher",
reason = "hashing an hash maps may be altered")]
impl RandomState {
/// Constructs a new `RandomState` that is initialized with random keys.
@ -1615,7 +1614,7 @@ impl RandomState {
}
}
#[unstable(feature = "std_misc",
#[unstable(feature = "hashmap_hasher",
reason = "hashing an hash maps may be altered")]
impl HashState for RandomState {
type Hasher = SipHasher;

View File

@ -20,9 +20,11 @@ use iter::{Iterator, IntoIterator, ExactSizeIterator, FromIterator, Map, Chain,
use ops::{BitOr, BitAnd, BitXor, Sub};
use option::Option::{Some, None, self};
use super::map::{self, HashMap, Keys, INITIAL_CAPACITY, RandomState};
use super::map::{self, HashMap, Keys, RandomState};
use super::state::HashState;
const INITIAL_CAPACITY: usize = 32;
// Future Optimization (FIXME!)
// =============================
//
@ -152,7 +154,7 @@ impl<T, S> HashSet<T, S>
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(hashmap_hasher)]
/// use std::collections::HashSet;
/// use std::collections::hash_map::RandomState;
///
@ -161,7 +163,7 @@ impl<T, S> HashSet<T, S>
/// set.insert(2);
/// ```
#[inline]
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
pub fn with_hash_state(hash_state: S) -> HashSet<T, S> {
HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state)
}
@ -177,7 +179,7 @@ impl<T, S> HashSet<T, S>
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(hashmap_hasher)]
/// use std::collections::HashSet;
/// use std::collections::hash_map::RandomState;
///
@ -186,7 +188,7 @@ impl<T, S> HashSet<T, S>
/// set.insert(1);
/// ```
#[inline]
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
-> HashSet<T, S> {
HashSet {
@ -406,7 +408,7 @@ impl<T, S> HashSet<T, S>
/// Clears the set, returning all elements in an iterator.
#[inline]
#[unstable(feature = "std_misc",
#[unstable(feature = "drain",
reason = "matches collection reform specification, waiting for dust to settle")]
pub fn drain(&mut self) -> Drain<T> {
fn first<A, B>((a, _): (A, B)) -> A { a }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
use clone::Clone;
use default::Default;
use hash;
@ -25,7 +27,6 @@ use marker;
/// algorithm can implement the `Default` trait and create hash maps with the
/// `DefaultState` structure. This state is 0-sized and will simply delegate
/// to `Default` when asked to create a hasher.
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
pub trait HashState {
/// Type of the hasher that will be created.
type Hasher: hash::Hasher;
@ -38,7 +39,6 @@ pub trait HashState {
/// default trait.
///
/// This struct has is 0-sized and does not need construction.
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
pub struct DefaultState<H>(marker::PhantomData<H>);
impl<H: Default + hash::Hasher> HashState for DefaultState<H> {

View File

@ -410,7 +410,7 @@ pub mod hash_set {
/// Experimental support for providing custom hash algorithms to a HashMap and
/// HashSet.
#[unstable(feature = "std_misc", reason = "module was recently added")]
#[unstable(feature = "hashmap_hasher", reason = "module was recently added")]
pub mod hash_state {
pub use super::hash::state::*;
}

View File

@ -12,7 +12,9 @@
//!
//! A simple wrapper over the platform's dynamic library facilities
#![unstable(feature = "std_misc")]
#![unstable(feature = "dynamic_lib",
reason = "API has not been scrutinized and is highly likely to \
either disappear or change")]
#![allow(missing_docs)]
use prelude::v1::*;

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc")]
use borrow::{Cow, ToOwned};
use boxed::{self, Box};

View File

@ -123,7 +123,7 @@ pub enum ErrorKind {
Other,
/// Any I/O error not part of this list.
#[unstable(feature = "std_misc",
#[unstable(feature = "io_error_internals",
reason = "better expressed through extensible enums that this \
enum cannot be exhaustively matched against")]
#[doc(hidden)]

View File

@ -150,7 +150,7 @@
#![feature(wrapping)]
#![feature(zero_one)]
#![cfg_attr(test, feature(float_from_str_radix))]
#![cfg_attr(test, feature(test, rustc_private, std_misc))]
#![cfg_attr(test, feature(test, rustc_private))]
// Don't link to std. We are std.
#![no_std]

View File

@ -14,8 +14,6 @@
//! library. Each macro is available for use when linking against the standard
//! library.
#![unstable(feature = "std_misc")]
/// The entry point for panic of Rust threads.
///
/// This macro is used to inject panic into a Rust thread, causing the thread to
@ -165,7 +163,7 @@ macro_rules! try {
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(mpsc_select)]
/// use std::thread;
/// use std::sync::mpsc;
///
@ -191,7 +189,7 @@ macro_rules! try {
///
/// For more information about select, see the `std::sync::mpsc::Select` structure.
#[macro_export]
#[unstable(feature = "std_misc")]
#[unstable(feature = "mpsc_select")]
macro_rules! select {
(
$($name:pat = $rx:ident.$meth:ident() => $code:expr),+

View File

@ -194,7 +194,7 @@ impl f32 {
/// The floating point encoding is documented in the [Reference][floating-point].
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32;
///
/// let num = 2.0f32;
@ -211,9 +211,11 @@ impl f32 {
/// assert!(abs_difference <= f32::EPSILON);
/// ```
/// [floating-point]: ../../../../../reference.html#machine-types
#[unstable(feature = "std_misc", reason = "signature is undecided")]
#[unstable(feature = "float_extras", reason = "signature is undecided")]
#[inline]
pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
pub fn integer_decode(self) -> (u64, i16, i8) {
num::Float::integer_decode(self)
}
/// Returns the largest integer less than or equal to a number.
///
@ -555,7 +557,7 @@ impl f32 {
/// Converts radians to degrees.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32::{self, consts};
///
/// let angle = consts::PI;
@ -564,14 +566,14 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[unstable(feature = "std_misc", reason = "desirability is unclear")]
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
#[inline]
pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
/// Converts degrees to radians.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32::{self, consts};
///
/// let angle = 180.0f32;
@ -580,21 +582,21 @@ impl f32 {
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[unstable(feature = "std_misc", reason = "desirability is unclear")]
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
#[inline]
pub fn to_radians(self) -> f32 { num::Float::to_radians(self) }
/// Constructs a floating point number of `x*2^exp`.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32;
/// // 3*2^2 - 12 == 0
/// let abs_difference = (f32::ldexp(3.0, 2) - 12.0).abs();
///
/// assert!(abs_difference <= f32::EPSILON);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "pending integer conventions")]
#[inline]
pub fn ldexp(x: f32, exp: isize) -> f32 {
@ -608,7 +610,7 @@ impl f32 {
/// * `0.5 <= abs(x) < 1.0`
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32;
///
/// let x = 4.0f32;
@ -621,7 +623,7 @@ impl f32 {
/// assert!(abs_difference_0 <= f32::EPSILON);
/// assert!(abs_difference_1 <= f32::EPSILON);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "pending integer conventions")]
#[inline]
pub fn frexp(self) -> (f32, isize) {
@ -636,7 +638,7 @@ impl f32 {
/// `other`.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// use std::f32;
///
/// let x = 1.0f32;
@ -645,7 +647,7 @@ impl f32 {
///
/// assert!(abs_diff <= f32::EPSILON);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "unsure about its place in the world")]
#[inline]
pub fn next_after(self, other: f32) -> f32 {

View File

@ -190,7 +190,7 @@ impl f64 {
/// The floating point encoding is documented in the [Reference][floating-point].
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// let num = 2.0f64;
///
/// // (8388608, -22, 1)
@ -205,7 +205,7 @@ impl f64 {
/// assert!(abs_difference < 1e-10);
/// ```
/// [floating-point]: ../../../../../reference.html#machine-types
#[unstable(feature = "std_misc", reason = "signature is undecided")]
#[unstable(feature = "float_extras", reason = "signature is undecided")]
#[inline]
pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
@ -567,13 +567,13 @@ impl f64 {
/// Constructs a floating point number of `x*2^exp`.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// // 3*2^2 - 12 == 0
/// let abs_difference = (f64::ldexp(3.0, 2) - 12.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "pending integer conventions")]
#[inline]
pub fn ldexp(x: f64, exp: isize) -> f64 {
@ -587,7 +587,7 @@ impl f64 {
/// * `0.5 <= abs(x) < 1.0`
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
/// let x = 4.0_f64;
///
/// // (1/2)*2^3 -> 1 * 8/2 -> 4.0
@ -598,7 +598,7 @@ impl f64 {
/// assert!(abs_difference_0 < 1e-10);
/// assert!(abs_difference_1 < 1e-10);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "pending integer conventions")]
#[inline]
pub fn frexp(self) -> (f64, isize) {
@ -613,7 +613,7 @@ impl f64 {
/// `other`.
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(float_extras)]
///
/// let x = 1.0f32;
///
@ -621,7 +621,7 @@ impl f64 {
///
/// assert!(abs_diff < 1e-10);
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "float_extras",
reason = "unsure about its place in the world")]
#[inline]
pub fn next_after(self, other: f64) -> f64 {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc")]
#![doc(hidden)]
macro_rules! assert_approx_eq {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc")]
#![doc(hidden)]
macro_rules! int_module { ($T:ty) => (

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc")]
#![doc(hidden)]
#![allow(unsigned_negation)]

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc")]
use prelude::v1::*;
use io::prelude::*;

View File

@ -16,7 +16,9 @@
//! and should be considered as private implementation details for the
//! time being.
#![unstable(feature = "std_misc")]
#![unstable(feature = "rt",
reason = "this public module should not exist and is highly likely \
to disappear")]
#![allow(missing_docs)]
use prelude::v1::*;

View File

@ -12,8 +12,6 @@
//! the standard library This varies per-platform, but these libraries are
//! necessary for running libstd.
#![unstable(feature = "std_misc")]
// All platforms need to link to rustrt
#[cfg(not(test))]
#[link(name = "rust_builtin", kind = "static")]

View File

@ -28,7 +28,7 @@
//! ```
#![allow(missing_docs)]
#![unstable(feature = "std_misc",
#![unstable(feature = "future",
reason = "futures as-is have yet to be deeply reevaluated with recent \
core changes to Rust's synchronization story, and will likely \
become stable in the future but are unstable until that time")]

View File

@ -35,8 +35,6 @@
//! method, and see the method for more information about it. Due to this
//! caveat, this queue may not be appropriate for all use-cases.
#![unstable(feature = "std_misc")]
// http://www.1024cores.net/home/lock-free-algorithms
// /queues/non-intrusive-mpsc-node-based-queue

View File

@ -27,7 +27,7 @@
//! # Examples
//!
//! ```rust
//! # #![feature(std_misc)]
//! # #![feature(mpsc_select)]
//! use std::sync::mpsc::channel;
//!
//! let (tx1, rx1) = channel();
@ -47,7 +47,7 @@
//! ```
#![allow(dead_code)]
#![unstable(feature = "std_misc",
#![unstable(feature = "mpsc_select",
reason = "This implementation, while likely sufficient, is unsafe and \
likely to be error prone. At some point in the future this \
module will likely be replaced, and it is currently \
@ -124,7 +124,7 @@ impl Select {
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(mpsc_select)]
/// use std::sync::mpsc::Select;
///
/// let select = Select::new();

View File

@ -33,8 +33,6 @@
//! concurrently between two threads. This data structure is safe to use and
//! enforces the semantics that there is one pusher and one popper.
#![unstable(feature = "std_misc")]
use core::prelude::*;
use alloc::boxed;

View File

@ -85,7 +85,6 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
/// To recover from a poisoned mutex:
///
/// ```
/// # #![feature(std_misc)]
/// use std::sync::{Arc, Mutex};
/// use std::thread;
///
@ -139,7 +138,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(static_mutex)]
/// use std::sync::{StaticMutex, MUTEX_INIT};
///
/// static LOCK: StaticMutex = MUTEX_INIT;
@ -150,7 +149,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
/// }
/// // lock is unlocked here.
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "static_mutex",
reason = "may be merged with Mutex in the future")]
pub struct StaticMutex {
lock: sys::Mutex,
@ -176,7 +175,7 @@ impl<'a, T: ?Sized> !marker::Send for MutexGuard<'a, T> {}
/// Static initialization of a mutex. This constant can be used to initialize
/// other mutex constants.
#[unstable(feature = "std_misc",
#[unstable(feature = "static_mutex",
reason = "may be merged with Mutex in the future")]
pub const MUTEX_INIT: StaticMutex = StaticMutex::new();
@ -237,7 +236,7 @@ impl<T: ?Sized> Mutex<T> {
/// time. You should not trust a `false` value for program correctness
/// without additional synchronization.
#[inline]
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poison")]
pub fn is_poisoned(&self) -> bool {
self.inner.poison.get()
}
@ -270,10 +269,10 @@ struct Dummy(UnsafeCell<()>);
unsafe impl Sync for Dummy {}
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
#[unstable(feature = "static_mutex",
reason = "may be merged with Mutex in the future")]
impl StaticMutex {
/// Creates a new mutex in an unlocked state ready for use.
#[unstable(feature = "std_misc",
reason = "may be merged with Mutex in the future")]
pub const fn new() -> StaticMutex {
StaticMutex {
lock: sys::Mutex::new(),
@ -283,8 +282,6 @@ impl StaticMutex {
/// Acquires this lock, see `Mutex::lock`
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with Mutex in the future")]
pub fn lock(&'static self) -> LockResult<MutexGuard<()>> {
unsafe { self.lock.lock() }
MutexGuard::new(self, &DUMMY.0)
@ -292,8 +289,6 @@ impl StaticMutex {
/// Attempts to grab this lock, see `Mutex::try_lock`
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with Mutex in the future")]
pub fn try_lock(&'static self) -> TryLockResult<MutexGuard<()>> {
if unsafe { self.lock.try_lock() } {
Ok(try!(MutexGuard::new(self, &DUMMY.0)))
@ -312,8 +307,6 @@ impl StaticMutex {
/// *all* platforms. It may be the case that some platforms do not leak
/// memory if this method is not called, but this is not guaranteed to be
/// true on all platforms.
#[unstable(feature = "std_misc",
reason = "may be merged with Mutex in the future")]
pub unsafe fn destroy(&'static self) {
self.lock.destroy()
}

View File

@ -48,7 +48,7 @@ pub const ONCE_INIT: Once = Once::new();
impl Once {
/// Creates a new `Once` value.
#[unstable(feature = "std_misc")]
#[unstable(feature = "once_new")]
pub const fn new() -> Once {
Once {
mutex: StaticMutex::new(),

View File

@ -81,7 +81,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
/// # Examples
///
/// ```
/// # #![feature(std_misc)]
/// # #![feature(static_rwlock)]
/// use std::sync::{StaticRwLock, RW_LOCK_INIT};
///
/// static LOCK: StaticRwLock = RW_LOCK_INIT;
@ -96,7 +96,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
/// }
/// unsafe { LOCK.destroy() } // free all resources
/// ```
#[unstable(feature = "std_misc",
#[unstable(feature = "static_rwlock",
reason = "may be merged with RwLock in the future")]
pub struct StaticRwLock {
lock: sys::RWLock,
@ -104,7 +104,7 @@ pub struct StaticRwLock {
}
/// Constant initialization for a statically-initialized rwlock.
#[unstable(feature = "std_misc",
#[unstable(feature = "static_rwlock",
reason = "may be merged with RwLock in the future")]
pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock::new();
@ -253,7 +253,7 @@ impl<T: ?Sized> RwLock<T> {
/// time. You should not trust a `false` value for program correctness
/// without additional synchronization.
#[inline]
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poison")]
pub fn is_poisoned(&self) -> bool {
self.inner.poison.get()
}
@ -283,10 +283,10 @@ struct Dummy(UnsafeCell<()>);
unsafe impl Sync for Dummy {}
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
#[unstable(feature = "static_rwlock",
reason = "may be merged with RwLock in the future")]
impl StaticRwLock {
/// Creates a new rwlock.
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub const fn new() -> StaticRwLock {
StaticRwLock {
lock: sys::RWLock::new(),
@ -299,8 +299,6 @@ impl StaticRwLock {
///
/// See `RwLock::read`.
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub fn read(&'static self) -> LockResult<RwLockReadGuard<'static, ()>> {
unsafe { self.lock.read() }
RwLockReadGuard::new(self, &DUMMY.0)
@ -310,8 +308,6 @@ impl StaticRwLock {
///
/// See `RwLock::try_read`.
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub fn try_read(&'static self)
-> TryLockResult<RwLockReadGuard<'static, ()>> {
if unsafe { self.lock.try_read() } {
@ -326,8 +322,6 @@ impl StaticRwLock {
///
/// See `RwLock::write`.
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub fn write(&'static self) -> LockResult<RwLockWriteGuard<'static, ()>> {
unsafe { self.lock.write() }
RwLockWriteGuard::new(self, &DUMMY.0)
@ -337,8 +331,6 @@ impl StaticRwLock {
///
/// See `RwLock::try_write`.
#[inline]
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub fn try_write(&'static self)
-> TryLockResult<RwLockWriteGuard<'static, ()>> {
if unsafe { self.lock.try_write() } {
@ -354,8 +346,6 @@ impl StaticRwLock {
/// active users of the lock, and this also doesn't prevent any future users
/// of this lock. This method is required to be called to not leak memory on
/// all platforms.
#[unstable(feature = "std_misc",
reason = "may be merged with RwLock in the future")]
pub unsafe fn destroy(&'static self) {
self.lock.destroy()
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![unstable(feature = "std_misc",
#![unstable(feature = "semaphore",
reason = "the interaction between semaphores and the acquisition/release \
of resources is currently unclear")]

View File

@ -120,24 +120,24 @@ impl<T: Send + Reflect> Error for PoisonError<T> {
impl<T> PoisonError<T> {
/// Creates a `PoisonError`.
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poison")]
pub fn new(guard: T) -> PoisonError<T> {
PoisonError { guard: guard }
}
/// Consumes this error indicating that a lock is poisoned, returning the
/// underlying guard to allow access regardless.
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poison")]
pub fn into_inner(self) -> T { self.guard }
/// Reaches into this error indicating that a lock is poisoned, returning a
/// reference to the underlying guard to allow access regardless.
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poison")]
pub fn get_ref(&self) -> &T { &self.guard }
/// Reaches into this error indicating that a lock is poisoned, returning a
/// mutable reference to the underlying guard to allow access regardless.
#[unstable(feature = "std_misc")]
#[unstable(feature = "sync_poi")]
pub fn get_mut(&mut self) -> &mut T { &mut self.guard }
}

View File

@ -154,7 +154,7 @@ macro_rules! __thread_local_inner {
}
/// Indicator of the state of a thread local storage key.
#[unstable(feature = "std_misc",
#[unstable(feature = "thread_local_state",
reason = "state querying was recently added")]
#[derive(Eq, PartialEq, Copy, Clone)]
pub enum LocalKeyState {
@ -249,7 +249,7 @@ impl<T: 'static> LocalKey<T> {
/// initialization does not panic. Keys in the `Valid` state are guaranteed
/// to be able to be accessed. Keys in the `Destroyed` state will panic on
/// any call to `with`.
#[unstable(feature = "std_misc",
#[unstable(feature = "thread_local_state",
reason = "state querying was recently added")]
pub fn state(&'static self) -> LocalKeyState {
unsafe {

View File

@ -10,7 +10,7 @@
// Because this module is temporary...
#![allow(missing_docs)]
#![unstable(feature = "std_misc")]
#![unstable(feature = "thunk")]
use alloc::boxed::{Box, FnBox};
use core::marker::Send;

View File

@ -56,10 +56,10 @@
#![deny(missing_docs)]
#![feature(box_syntax)]
#![feature(owned_ascii_ext)]
#![feature(path_ext)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(vec_push_all)]
#![cfg_attr(windows, feature(libc))]