std: Add issues to all unstable features
This commit is contained in:
parent
377c11aa83
commit
5f625620b5
|
@ -92,7 +92,8 @@
|
|||
|
||||
#![doc(hidden)]
|
||||
#![unstable(feature = "dec2flt",
|
||||
reason = "internal routines only exposed for testing")]
|
||||
reason = "internal routines only exposed for testing",
|
||||
issue = "0")]
|
||||
|
||||
use prelude::v1::*;
|
||||
use num::ParseFloatError as PFE;
|
||||
|
|
|
@ -117,7 +117,7 @@ pub trait AsciiExt {
|
|||
///
|
||||
/// assert_eq!('A', ascii);
|
||||
/// ```
|
||||
#[unstable(feature = "ascii")]
|
||||
#[unstable(feature = "ascii", issue = "27809")]
|
||||
fn make_ascii_uppercase(&mut self);
|
||||
|
||||
/// Converts this type to its ASCII lower case equivalent in-place.
|
||||
|
@ -137,7 +137,7 @@ pub trait AsciiExt {
|
|||
///
|
||||
/// assert_eq!('a', ascii);
|
||||
/// ```
|
||||
#[unstable(feature = "ascii")]
|
||||
#[unstable(feature = "ascii", issue = "27809")]
|
||||
fn make_ascii_lowercase(&mut self);
|
||||
}
|
||||
|
||||
|
|
|
@ -553,7 +553,8 @@ impl<K, V, S> HashMap<K, V, S>
|
|||
/// map.insert(1, 2);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||
issue = "27713")]
|
||||
pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> {
|
||||
HashMap {
|
||||
hash_state: hash_state,
|
||||
|
@ -583,7 +584,8 @@ impl<K, V, S> HashMap<K, V, S>
|
|||
/// map.insert(1, 2);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||
issue = "27713")]
|
||||
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
||||
-> HashMap<K, V, S> {
|
||||
let resize_policy = DefaultResizePolicy::new();
|
||||
|
@ -998,7 +1000,8 @@ impl<K, V, S> HashMap<K, V, S>
|
|||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "drain",
|
||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
||||
reason = "matches collection reform specification, waiting for dust to settle",
|
||||
issue = "27711")]
|
||||
pub fn drain(&mut self) -> Drain<K, V> {
|
||||
fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) }
|
||||
let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; // coerce to fn pointer
|
||||
|
@ -1311,7 +1314,8 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
|
|||
|
||||
/// HashMap drain iterator.
|
||||
#[unstable(feature = "drain",
|
||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
||||
reason = "matches collection reform specification, waiting for dust to settle",
|
||||
issue = "27711")]
|
||||
pub struct Drain<'a, K: 'a, V: 'a> {
|
||||
inner: iter::Map<table::Drain<'a, K, V>, fn((SafeHash, K, V)) -> (K, V)>
|
||||
}
|
||||
|
@ -1587,14 +1591,16 @@ impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S>
|
|||
/// instances are unlikely to produce the same result for the same values.
|
||||
#[derive(Clone)]
|
||||
#[unstable(feature = "hashmap_hasher",
|
||||
reason = "hashing an hash maps may be altered")]
|
||||
reason = "hashing an hash maps may be altered",
|
||||
issue = "27713")]
|
||||
pub struct RandomState {
|
||||
k0: u64,
|
||||
k1: u64,
|
||||
}
|
||||
|
||||
#[unstable(feature = "hashmap_hasher",
|
||||
reason = "hashing an hash maps may be altered")]
|
||||
reason = "hashing an hash maps may be altered",
|
||||
issue = "27713")]
|
||||
impl RandomState {
|
||||
/// Constructs a new `RandomState` that is initialized with random keys.
|
||||
#[inline]
|
||||
|
@ -1606,7 +1612,8 @@ impl RandomState {
|
|||
}
|
||||
|
||||
#[unstable(feature = "hashmap_hasher",
|
||||
reason = "hashing an hash maps may be altered")]
|
||||
reason = "hashing an hash maps may be altered",
|
||||
issue = "27713")]
|
||||
impl HashState for RandomState {
|
||||
type Hasher = SipHasher;
|
||||
#[inline]
|
||||
|
|
|
@ -164,7 +164,8 @@ impl<T, S> HashSet<T, S>
|
|||
/// set.insert(2);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||
issue = "27713")]
|
||||
pub fn with_hash_state(hash_state: S) -> HashSet<T, S> {
|
||||
HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state)
|
||||
}
|
||||
|
@ -190,7 +191,8 @@ impl<T, S> HashSet<T, S>
|
|||
/// set.insert(1);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear")]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||
issue = "27713")]
|
||||
pub fn with_capacity_and_hash_state(capacity: usize, hash_state: S)
|
||||
-> HashSet<T, S> {
|
||||
HashSet {
|
||||
|
@ -411,7 +413,8 @@ impl<T, S> HashSet<T, S>
|
|||
/// Clears the set, returning all elements in an iterator.
|
||||
#[inline]
|
||||
#[unstable(feature = "drain",
|
||||
reason = "matches collection reform specification, waiting for dust to settle")]
|
||||
reason = "matches collection reform specification, waiting for dust to settle",
|
||||
issue = "27711")]
|
||||
pub fn drain(&mut self) -> Drain<T> {
|
||||
fn first<A, B>((a, _): (A, B)) -> A { a }
|
||||
let first: fn((T, ())) -> T = first; // coerce to fn pointer
|
||||
|
|
|
@ -8,7 +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")]
|
||||
#![unstable(feature = "hashmap_hasher", reason = "hasher stuff is unclear",
|
||||
issue = "27713")]
|
||||
|
||||
use clone::Clone;
|
||||
use default::Default;
|
||||
|
|
|
@ -410,7 +410,8 @@ pub mod hash_set {
|
|||
|
||||
/// Experimental support for providing custom hash algorithms to a HashMap and
|
||||
/// HashSet.
|
||||
#[unstable(feature = "hashmap_hasher", reason = "module was recently added")]
|
||||
#[unstable(feature = "hashmap_hasher", reason = "module was recently added",
|
||||
issue = "27713")]
|
||||
pub mod hash_state {
|
||||
pub use super::hash::state::*;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
#![unstable(feature = "dynamic_lib",
|
||||
reason = "API has not been scrutinized and is highly likely to \
|
||||
either disappear or change")]
|
||||
either disappear or change",
|
||||
issue = "27810")]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use prelude::v1::*;
|
||||
|
|
|
@ -78,7 +78,8 @@ pub trait Error: Debug + Display + Reflect {
|
|||
/// Get the `TypeId` of `self`
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "error_type_id",
|
||||
reason = "unclear whether to commit to this public implementation detail")]
|
||||
reason = "unclear whether to commit to this public implementation detail",
|
||||
issue = "27745")]
|
||||
fn type_id(&self) -> TypeId where Self: 'static {
|
||||
TypeId::of::<Self>()
|
||||
}
|
||||
|
|
|
@ -205,7 +205,8 @@ impl CString {
|
|||
/// The only appropriate argument is a pointer obtained by calling
|
||||
/// `into_ptr`. The length of the string will be recalculated
|
||||
/// using the pointer.
|
||||
#[unstable(feature = "cstr_memory", reason = "recently added")]
|
||||
#[unstable(feature = "cstr_memory", reason = "recently added",
|
||||
issue = "27769")]
|
||||
// NB: may want to be called from_raw, needs to consider CStr::from_ptr,
|
||||
// Box::from_raw (or whatever it's currently called), and
|
||||
// slice::from_raw_parts
|
||||
|
@ -223,7 +224,8 @@ impl CString {
|
|||
/// this string.
|
||||
///
|
||||
/// Failure to call `from_ptr` will lead to a memory leak.
|
||||
#[unstable(feature = "cstr_memory", reason = "recently added")]
|
||||
#[unstable(feature = "cstr_memory", reason = "recently added",
|
||||
issue = "27769")]
|
||||
// NB: may want to be called into_raw, see comments on from_ptr
|
||||
pub fn into_ptr(self) -> *const libc::c_char {
|
||||
// It is important that the bytes be sized to fit - we need
|
||||
|
@ -407,11 +409,13 @@ impl CStr {
|
|||
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
||||
/// > future to perform the length calculation in addition to the UTF-8
|
||||
/// > check whenever this method is called.
|
||||
#[unstable(feature = "cstr_to_str", reason = "recently added")]
|
||||
#[unstable(feature = "cstr_to_str", reason = "recently added",
|
||||
issue = "27764")]
|
||||
pub fn to_str(&self) -> Result<&str, str::Utf8Error> {
|
||||
// NB: When CStr is changed to perform the length check in .to_bytes() instead of in
|
||||
// from_ptr(), it may be worth considering if this should be rewritten to do the UTF-8
|
||||
// check inline with the length calculation instead of doing it afterwards.
|
||||
// NB: When CStr is changed to perform the length check in .to_bytes()
|
||||
// instead of in from_ptr(), it may be worth considering if this should
|
||||
// be rewritten to do the UTF-8 check inline with the length calculation
|
||||
// instead of doing it afterwards.
|
||||
str::from_utf8(self.to_bytes())
|
||||
}
|
||||
|
||||
|
@ -426,7 +430,8 @@ impl CStr {
|
|||
/// > after a 0-cost cast, but it is planned to alter its definition in the
|
||||
/// > future to perform the length calculation in addition to the UTF-8
|
||||
/// > check whenever this method is called.
|
||||
#[unstable(feature = "cstr_to_str", reason = "recently added")]
|
||||
#[unstable(feature = "cstr_to_str", reason = "recently added",
|
||||
issue = "27764")]
|
||||
pub fn to_string_lossy(&self) -> Cow<str> {
|
||||
String::from_utf8_lossy(self.to_bytes())
|
||||
}
|
||||
|
|
|
@ -29,9 +29,6 @@
|
|||
//! for conversion to/from various other string types. Eventually these types
|
||||
//! will offer a full-fledged string API.
|
||||
|
||||
#![unstable(feature = "os_str",
|
||||
reason = "recently added as part of path/io reform")]
|
||||
|
||||
use borrow::{Borrow, Cow, ToOwned};
|
||||
use ffi::CString;
|
||||
use fmt::{self, Debug};
|
||||
|
@ -74,7 +71,7 @@ impl OsString {
|
|||
///
|
||||
/// On Windows system, only UTF-8 byte sequences will successfully
|
||||
/// convert; non UTF-8 data will produce `None`.
|
||||
#[unstable(feature = "convert", reason = "recently added")]
|
||||
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||
pub fn from_bytes<B>(bytes: B) -> Option<OsString> where B: Into<Vec<u8>> {
|
||||
#[cfg(unix)]
|
||||
fn from_bytes_inner(vec: Vec<u8>) -> Option<OsString> {
|
||||
|
@ -258,7 +255,7 @@ impl OsStr {
|
|||
/// On Windows systems, this returns `None` unless the `OsStr` is
|
||||
/// valid unicode, in which case it produces UTF-8-encoded
|
||||
/// data. This may entail checking validity.
|
||||
#[unstable(feature = "convert", reason = "recently added")]
|
||||
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||
pub fn to_bytes(&self) -> Option<&[u8]> {
|
||||
if cfg!(windows) {
|
||||
self.to_str().map(|s| s.as_bytes())
|
||||
|
@ -274,7 +271,7 @@ impl OsStr {
|
|||
/// This is a convenience for creating a `CString` from
|
||||
/// `self.to_bytes()`, and inherits the platform behavior of the
|
||||
/// `to_bytes` method.
|
||||
#[unstable(feature = "convert", reason = "recently added")]
|
||||
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
|
||||
pub fn to_cstring(&self) -> Option<CString> {
|
||||
self.to_bytes().and_then(|b| CString::new(b).ok())
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ pub struct DirEntry(fs_imp::DirEntry);
|
|||
#[unstable(feature = "fs_walk",
|
||||
reason = "the precise semantics and defaults for a recursive walk \
|
||||
may change and this may end up accounting for files such \
|
||||
as symlinks differently")]
|
||||
as symlinks differently",
|
||||
issue = "27707")]
|
||||
pub struct WalkDir {
|
||||
cur: Option<ReadDir>,
|
||||
stack: Vec<io::Result<ReadDir>>,
|
||||
|
@ -154,7 +155,8 @@ pub struct FileType(fs_imp::FileType);
|
|||
/// A builder used to create directories in various manners.
|
||||
///
|
||||
/// This builder also supports platform-specific options.
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||
issue = "27710")]
|
||||
pub struct DirBuilder {
|
||||
inner: fs_imp::DirBuilder,
|
||||
recursive: bool,
|
||||
|
@ -949,7 +951,8 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
|||
|
||||
/// Returns the canonical form of a path with all intermediate components
|
||||
/// normalized and symbolic links resolved.
|
||||
#[unstable(feature = "fs_canonicalize", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_canonicalize", reason = "recently added API",
|
||||
issue = "27706")]
|
||||
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
||||
fs_imp::canonicalize(path.as_ref())
|
||||
}
|
||||
|
@ -1107,13 +1110,14 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
|
|||
#[unstable(feature = "fs_walk",
|
||||
reason = "the precise semantics and defaults for a recursive walk \
|
||||
may change and this may end up accounting for files such \
|
||||
as symlinks differently")]
|
||||
as symlinks differently",
|
||||
issue = "27707")]
|
||||
pub fn walk_dir<P: AsRef<Path>>(path: P) -> io::Result<WalkDir> {
|
||||
let start = try!(read_dir(path));
|
||||
Ok(WalkDir { cur: Some(start), stack: Vec::new() })
|
||||
}
|
||||
|
||||
#[unstable(feature = "fs_walk")]
|
||||
#[unstable(feature = "fs_walk", issue = "27707")]
|
||||
impl Iterator for WalkDir {
|
||||
type Item = io::Result<DirEntry>;
|
||||
|
||||
|
@ -1146,7 +1150,8 @@ impl Iterator for WalkDir {
|
|||
#[unstable(feature = "path_ext",
|
||||
reason = "The precise set of methods exposed on this trait may \
|
||||
change and some methods may be removed. For stable code, \
|
||||
see the std::fs::metadata function.")]
|
||||
see the std::fs::metadata function.",
|
||||
issue = "27725")]
|
||||
pub trait PathExt {
|
||||
/// Gets information on the file, directory, etc at this path.
|
||||
///
|
||||
|
@ -1242,7 +1247,8 @@ pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions)
|
|||
fs_imp::set_perm(path.as_ref(), perm.0)
|
||||
}
|
||||
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||
issue = "27710")]
|
||||
impl DirBuilder {
|
||||
/// Creates a new set of options with default mode/security settings for all
|
||||
/// platforms and also non-recursive.
|
||||
|
|
|
@ -150,7 +150,8 @@ pub enum ErrorKind {
|
|||
/// Any I/O error not part of this list.
|
||||
#[unstable(feature = "io_error_internals",
|
||||
reason = "better expressed through extensible enums that this \
|
||||
enum cannot be exhaustively matched against")]
|
||||
enum cannot be exhaustively matched against",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
__Nonexhaustive,
|
||||
}
|
||||
|
|
|
@ -647,7 +647,8 @@ pub trait Read {
|
|||
/// ```
|
||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||
of where errors happen is currently \
|
||||
unclear and may change")]
|
||||
unclear and may change",
|
||||
issue = "27802")]
|
||||
fn chars(self) -> Chars<Self> where Self: Sized {
|
||||
Chars { inner: self }
|
||||
}
|
||||
|
@ -754,7 +755,8 @@ pub trait Read {
|
|||
/// ```
|
||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||
of where errors happen is currently \
|
||||
unclear and may change")]
|
||||
unclear and may change",
|
||||
issue = "27802")]
|
||||
fn tee<W: Write>(self, out: W) -> Tee<Self, W> where Self: Sized {
|
||||
Tee { reader: self, writer: out }
|
||||
}
|
||||
|
@ -1016,7 +1018,8 @@ pub trait Write {
|
|||
/// ```
|
||||
#[unstable(feature = "io", reason = "the semantics of a partial read/write \
|
||||
of where errors happen is currently \
|
||||
unclear and may change")]
|
||||
unclear and may change",
|
||||
issue = "27802")]
|
||||
fn broadcast<W: Write>(self, other: W) -> Broadcast<Self, W>
|
||||
where Self: Sized
|
||||
{
|
||||
|
@ -1401,13 +1404,15 @@ pub trait BufRead: Read {
|
|||
/// writer. Please see the documentation of `broadcast()` for more details.
|
||||
///
|
||||
/// [broadcast]: trait.Write.html#method.broadcast
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast",
|
||||
issue = "27802")]
|
||||
pub struct Broadcast<T, U> {
|
||||
first: T,
|
||||
second: U,
|
||||
}
|
||||
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast",
|
||||
issue = "27802")]
|
||||
impl<T: Write, U: Write> Write for Broadcast<T, U> {
|
||||
fn write(&mut self, data: &[u8]) -> Result<usize> {
|
||||
let n = try!(self.first.write(data));
|
||||
|
@ -1509,13 +1514,15 @@ impl<T: BufRead> BufRead for Take<T> {
|
|||
/// Please see the documentation of `tee()` for more details.
|
||||
///
|
||||
/// [tee]: trait.Read.html#method.tee
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee",
|
||||
issue = "27802")]
|
||||
pub struct Tee<R, W> {
|
||||
reader: R,
|
||||
writer: W,
|
||||
}
|
||||
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::tee",
|
||||
issue = "27802")]
|
||||
impl<R: Read, W: Write> Read for Tee<R, W> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
||||
let n = try!(self.reader.read(buf));
|
||||
|
@ -1556,7 +1563,8 @@ impl<R: Read> Iterator for Bytes<R> {
|
|||
/// Please see the documentation of `chars()` for more details.
|
||||
///
|
||||
/// [chars]: trait.Read.html#method.chars
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||
issue = "27802")]
|
||||
pub struct Chars<R> {
|
||||
inner: R,
|
||||
}
|
||||
|
@ -1564,7 +1572,8 @@ pub struct Chars<R> {
|
|||
/// An enumeration of possible errors that can be generated from the `Chars`
|
||||
/// adapter.
|
||||
#[derive(Debug)]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||
issue = "27802")]
|
||||
pub enum CharsError {
|
||||
/// Variant representing that the underlying stream was read successfully
|
||||
/// but it did not contain valid utf8 data.
|
||||
|
@ -1574,7 +1583,8 @@ pub enum CharsError {
|
|||
Other(Error),
|
||||
}
|
||||
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||
issue = "27802")]
|
||||
impl<R: Read> Iterator for Chars<R> {
|
||||
type Item = result::Result<char, CharsError>;
|
||||
|
||||
|
@ -1606,7 +1616,8 @@ impl<R: Read> Iterator for Chars<R> {
|
|||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||
issue = "27802")]
|
||||
impl std_error::Error for CharsError {
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
|
@ -1622,7 +1633,8 @@ impl std_error::Error for CharsError {
|
|||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars")]
|
||||
#[unstable(feature = "io", reason = "awaiting stability of Read::chars",
|
||||
issue = "27802")]
|
||||
impl fmt::Display for CharsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
|
|
|
@ -531,7 +531,8 @@ impl<'a> Write for StderrLock<'a> {
|
|||
/// output handle is to the process's stderr stream.
|
||||
#[unstable(feature = "set_stdio",
|
||||
reason = "this function may disappear completely or be replaced \
|
||||
with a more general mechanism")]
|
||||
with a more general mechanism",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||
use panicking::LOCAL_STDERR;
|
||||
|
@ -554,7 +555,8 @@ pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
|||
/// output handle is to the process's stdout stream.
|
||||
#[unstable(feature = "set_stdio",
|
||||
reason = "this function may disappear completely or be replaced \
|
||||
with a more general mechanism")]
|
||||
with a more general mechanism",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
||||
use mem;
|
||||
|
@ -567,7 +569,8 @@ pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> {
|
|||
}
|
||||
|
||||
#[unstable(feature = "print",
|
||||
reason = "implementation detail which may disappear or be replaced at any time")]
|
||||
reason = "implementation detail which may disappear or be replaced at any time",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub fn _print(args: fmt::Arguments) {
|
||||
let result = LOCAL_STDOUT.with(|s| {
|
||||
|
|
|
@ -398,7 +398,7 @@ mod rand;
|
|||
// but it may be stabilized long-term. As a result we're exposing a hidden,
|
||||
// unstable module so we can get our build working.
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "rand")]
|
||||
#[unstable(feature = "rand", issue = "0")]
|
||||
pub mod __rand {
|
||||
pub use rand::{thread_rng, ThreadRng, Rng};
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ pub struct SocketAddrV6 { inner: libc::sockaddr_in6 }
|
|||
|
||||
impl SocketAddr {
|
||||
/// Creates a new socket address from the (ip, port) pair.
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||
pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
|
||||
match ip {
|
||||
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
|
||||
|
@ -57,7 +57,7 @@ impl SocketAddr {
|
|||
}
|
||||
|
||||
/// Returns the IP address associated with this socket address.
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||
pub fn ip(&self) -> IpAddr {
|
||||
match *self {
|
||||
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#![unstable(feature = "ip", reason = "extra functionality has not been \
|
||||
scrutinized to the level that it should \
|
||||
be stable")]
|
||||
be stable",
|
||||
issue = "27709")]
|
||||
|
||||
use prelude::v1::*;
|
||||
|
||||
|
@ -22,7 +23,7 @@ use sys_common::{AsInner, FromInner};
|
|||
use net::{hton, ntoh};
|
||||
|
||||
/// An IP address, either a IPv4 or IPv6 address.
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition")]
|
||||
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)]
|
||||
pub enum IpAddr {
|
||||
/// Representation of an IPv4 address.
|
||||
|
|
|
@ -84,12 +84,14 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
|
|||
/// An iterator over `SocketAddr` values returned from a host lookup operation.
|
||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||
iterator and returning socket \
|
||||
addresses")]
|
||||
addresses",
|
||||
issue = "27705")]
|
||||
pub struct LookupHost(net_imp::LookupHost);
|
||||
|
||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||
iterator and returning socket \
|
||||
addresses")]
|
||||
addresses",
|
||||
issue = "27705")]
|
||||
impl Iterator for LookupHost {
|
||||
type Item = io::Result<SocketAddr>;
|
||||
fn next(&mut self) -> Option<io::Result<SocketAddr>> { self.0.next() }
|
||||
|
@ -116,7 +118,8 @@ impl Iterator for LookupHost {
|
|||
/// ```
|
||||
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
|
||||
iterator and returning socket \
|
||||
addresses")]
|
||||
addresses",
|
||||
issue = "27705")]
|
||||
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
||||
net_imp::lookup_host(host).map(LookupHost)
|
||||
}
|
||||
|
@ -126,7 +129,8 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
|
|||
/// This function may perform a DNS query to resolve `addr` and may also inspect
|
||||
/// system configuration to resolve the specified address. If the address
|
||||
/// cannot be resolved, it is returned in string format.
|
||||
#[unstable(feature = "lookup_addr", reason = "recent addition")]
|
||||
#[unstable(feature = "lookup_addr", reason = "recent addition",
|
||||
issue = "27705")]
|
||||
pub fn lookup_addr(addr: &IpAddr) -> io::Result<String> {
|
||||
net_imp::lookup_addr(addr)
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![unstable(feature = "tcp", reason = "remaining functions have not been \
|
||||
scrutinized enough to be stabilized")]
|
||||
|
||||
use prelude::v1::*;
|
||||
use io::prelude::*;
|
||||
|
||||
|
@ -133,7 +130,8 @@ impl TcpStream {
|
|||
/// If the value specified is `None`, then `read` calls will block
|
||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||
/// method.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||
self.0.set_read_timeout(dur)
|
||||
}
|
||||
|
@ -143,7 +141,8 @@ impl TcpStream {
|
|||
/// If the value specified is `None`, then `write` calls will block
|
||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||
/// method.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||
self.0.set_write_timeout(dur)
|
||||
}
|
||||
|
@ -155,7 +154,8 @@ impl TcpStream {
|
|||
/// # Note
|
||||
///
|
||||
/// Some platforms do not provide access to the current timeout.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
||||
self.0.read_timeout()
|
||||
}
|
||||
|
@ -167,7 +167,8 @@ impl TcpStream {
|
|||
/// # Note
|
||||
///
|
||||
/// Some platforms do not provide access to the current timeout.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
||||
self.0.write_timeout()
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![unstable(feature = "udp", reason = "remaining functions have not been \
|
||||
scrutinized enough to be stabilized")]
|
||||
|
||||
use fmt;
|
||||
use io::{self, Error, ErrorKind};
|
||||
use net::{ToSocketAddrs, SocketAddr};
|
||||
|
@ -100,7 +97,8 @@ impl UdpSocket {
|
|||
/// If the value specified is `None`, then `read` calls will block
|
||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||
/// method.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||
self.0.set_read_timeout(dur)
|
||||
}
|
||||
|
@ -110,7 +108,8 @@ impl UdpSocket {
|
|||
/// If the value specified is `None`, then `write` calls will block
|
||||
/// indefinitely. It is an error to pass the zero `Duration` to this
|
||||
/// method.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
|
||||
self.0.set_write_timeout(dur)
|
||||
}
|
||||
|
@ -118,7 +117,8 @@ impl UdpSocket {
|
|||
/// Returns the read timeout of this socket.
|
||||
///
|
||||
/// If the timeout is `None`, then `read` calls will block indefinitely.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
|
||||
self.0.read_timeout()
|
||||
}
|
||||
|
@ -126,7 +126,8 @@ impl UdpSocket {
|
|||
/// Returns the write timeout of this socket.
|
||||
///
|
||||
/// If the timeout is `None`, then `write` calls will block indefinitely.
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added")]
|
||||
#[unstable(feature = "socket_timeout", reason = "RFC 1047 - recently added",
|
||||
issue = "27773")]
|
||||
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
|
||||
self.0.write_timeout()
|
||||
}
|
||||
|
|
|
@ -124,7 +124,8 @@ mod cmath {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl f32 {
|
||||
/// Parses a float as with a given radix
|
||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
|
||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API",
|
||||
issue = "27736")]
|
||||
pub fn from_str_radix(s: &str, radix: u32) -> Result<f32, ParseFloatError> {
|
||||
num::Float::from_str_radix(s, radix)
|
||||
}
|
||||
|
@ -251,7 +252,8 @@ impl f32 {
|
|||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
/// [floating-point]: ../../../../../reference.html#machine-types
|
||||
#[unstable(feature = "float_extras", reason = "signature is undecided")]
|
||||
#[unstable(feature = "float_extras", reason = "signature is undecided",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn integer_decode(self) -> (u64, i16, i8) {
|
||||
num::Float::integer_decode(self)
|
||||
|
@ -607,7 +609,8 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
|
||||
#[unstable(feature = "float_extras", reason = "desirability is unclear",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
|
||||
|
||||
|
@ -624,7 +627,8 @@ impl f32 {
|
|||
///
|
||||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras", reason = "desirability is unclear")]
|
||||
#[unstable(feature = "float_extras", reason = "desirability is unclear",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn to_radians(self) -> f32 { num::Float::to_radians(self) }
|
||||
|
||||
|
@ -640,7 +644,8 @@ impl f32 {
|
|||
/// assert!(abs_difference <= f32::EPSILON);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "pending integer conventions")]
|
||||
reason = "pending integer conventions",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn ldexp(x: f32, exp: isize) -> f32 {
|
||||
unsafe { cmath::ldexpf(x, exp as c_int) }
|
||||
|
@ -668,7 +673,8 @@ impl f32 {
|
|||
/// assert!(abs_difference_1 <= f32::EPSILON);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "pending integer conventions")]
|
||||
reason = "pending integer conventions",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn frexp(self) -> (f32, isize) {
|
||||
unsafe {
|
||||
|
@ -693,7 +699,8 @@ impl f32 {
|
|||
/// assert!(abs_diff <= f32::EPSILON);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "unsure about its place in the world")]
|
||||
reason = "unsure about its place in the world",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn next_after(self, other: f32) -> f32 {
|
||||
unsafe { cmath::nextafterf(self, other) }
|
||||
|
|
|
@ -80,7 +80,8 @@ mod cmath {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl f64 {
|
||||
/// Parses a float as with a given radix
|
||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
|
||||
#[unstable(feature = "float_from_str_radix", reason = "recently moved API",
|
||||
issue = "27736")]
|
||||
pub fn from_str_radix(s: &str, radix: u32) -> Result<f64, ParseFloatError> {
|
||||
num::Float::from_str_radix(s, radix)
|
||||
}
|
||||
|
@ -205,7 +206,8 @@ impl f64 {
|
|||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
/// [floating-point]: ../../../../../reference.html#machine-types
|
||||
#[unstable(feature = "float_extras", reason = "signature is undecided")]
|
||||
#[unstable(feature = "float_extras", reason = "signature is undecided",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
|
||||
|
||||
|
@ -575,7 +577,8 @@ impl f64 {
|
|||
/// assert!(abs_difference < 1e-10);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "pending integer conventions")]
|
||||
reason = "pending integer conventions",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn ldexp(x: f64, exp: isize) -> f64 {
|
||||
unsafe { cmath::ldexp(x, exp as c_int) }
|
||||
|
@ -601,7 +604,8 @@ impl f64 {
|
|||
/// assert!(abs_difference_1 < 1e-10);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "pending integer conventions")]
|
||||
reason = "pending integer conventions",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn frexp(self) -> (f64, isize) {
|
||||
unsafe {
|
||||
|
@ -624,7 +628,8 @@ impl f64 {
|
|||
/// assert!(abs_diff < 1e-10);
|
||||
/// ```
|
||||
#[unstable(feature = "float_extras",
|
||||
reason = "unsure about its place in the world")]
|
||||
reason = "unsure about its place in the world",
|
||||
issue = "27752")]
|
||||
#[inline]
|
||||
pub fn next_after(self, other: f64) -> f64 {
|
||||
unsafe { cmath::nextafter(self, other) }
|
||||
|
|
|
@ -49,9 +49,11 @@
|
|||
#[repr(u8)]
|
||||
#[stable(feature = "raw_os", since = "1.1.0")]
|
||||
pub enum c_void {
|
||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist")]
|
||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
||||
issue = "0")]
|
||||
#[doc(hidden)] __variant1,
|
||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist")]
|
||||
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
|
||||
issue = "0")]
|
||||
#[doc(hidden)] __variant2,
|
||||
}
|
||||
|
||||
|
|
|
@ -725,7 +725,7 @@ impl<'a> Components<'a> {
|
|||
}
|
||||
|
||||
/// Examine the next component without consuming it.
|
||||
#[unstable(feature = "path_components_peek")]
|
||||
#[unstable(feature = "path_components_peek", issue = "27727")]
|
||||
pub fn peek(&self) -> Option<Component<'a>> {
|
||||
self.clone().next()
|
||||
}
|
||||
|
@ -1358,7 +1358,9 @@ impl Path {
|
|||
/// Prefixes are relevant only for Windows paths, and consist of volumes
|
||||
/// like `C:`, UNC prefixes like `\\server`, and others described in more
|
||||
/// detail in `std::os::windows::PathExt`.
|
||||
#[unstable(feature = "path_prefix", reason = "uncertain whether to expose this convenience")]
|
||||
#[unstable(feature = "path_prefix",
|
||||
reason = "uncertain whether to expose this convenience",
|
||||
issue = "27722")]
|
||||
pub fn prefix(&self) -> Option<Prefix> {
|
||||
self.components().prefix
|
||||
}
|
||||
|
@ -1441,7 +1443,8 @@ impl Path {
|
|||
///
|
||||
/// If `base` is not a prefix of `self` (i.e. `starts_with`
|
||||
/// returns false), then `relative_from` returns `None`.
|
||||
#[unstable(feature = "path_relative_from", reason = "see #23284")]
|
||||
#[unstable(feature = "path_relative_from", reason = "see #23284",
|
||||
issue = "23284")]
|
||||
pub fn relative_from<'a, P: ?Sized + AsRef<Path>>(&'a self, base: &'a P) -> Option<&Path>
|
||||
{
|
||||
iter_after(self.components(), base.as_ref().components()).map(|c| c.as_path())
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
|
||||
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
|
||||
|
||||
#![unstable(feature = "rand")]
|
||||
#![unstable(feature = "rand", issue = "0")]
|
||||
|
||||
use cell::RefCell;
|
||||
use io;
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
#![unstable(feature = "rt",
|
||||
reason = "this public module should not exist and is highly likely \
|
||||
to disappear")]
|
||||
to disappear",
|
||||
issue = "0")]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use prelude::v1::*;
|
||||
|
|
|
@ -76,7 +76,8 @@ pub struct Condvar { inner: Box<StaticCondvar> }
|
|||
/// static CVAR: StaticCondvar = CONDVAR_INIT;
|
||||
/// ```
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub struct StaticCondvar {
|
||||
inner: sys::Condvar,
|
||||
mutex: AtomicUsize,
|
||||
|
@ -84,7 +85,8 @@ pub struct StaticCondvar {
|
|||
|
||||
/// Constant initializer for a statically allocated condition variable.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub const CONDVAR_INIT: StaticCondvar = StaticCondvar::new();
|
||||
|
||||
impl Condvar {
|
||||
|
@ -173,7 +175,8 @@ impl Condvar {
|
|||
///
|
||||
/// Like `wait`, the lock specified will be re-acquired when this function
|
||||
/// returns, regardless of whether the timeout elapsed or not.
|
||||
#[unstable(feature = "wait_timeout", reason = "waiting for Duration")]
|
||||
#[unstable(feature = "wait_timeout", reason = "waiting for Duration",
|
||||
issue = "27772")]
|
||||
pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>,
|
||||
dur: Duration)
|
||||
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
||||
|
@ -190,7 +193,8 @@ impl Condvar {
|
|||
/// that the implementation will repeatedly wait while the duration has not
|
||||
/// passed and the provided function returns `false`.
|
||||
#[unstable(feature = "wait_timeout_with",
|
||||
reason = "unsure if this API is broadly needed or what form it should take")]
|
||||
reason = "unsure if this API is broadly needed or what form it should take",
|
||||
issue = "27748")]
|
||||
pub fn wait_timeout_with<'a, T, F>(&self,
|
||||
guard: MutexGuard<'a, T>,
|
||||
dur: Duration,
|
||||
|
@ -234,7 +238,8 @@ impl Drop for Condvar {
|
|||
impl StaticCondvar {
|
||||
/// Creates a new condition variable
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub const fn new() -> StaticCondvar {
|
||||
StaticCondvar {
|
||||
inner: sys::Condvar::new(),
|
||||
|
@ -247,7 +252,8 @@ impl StaticCondvar {
|
|||
///
|
||||
/// See `Condvar::wait`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>)
|
||||
-> LockResult<MutexGuard<'a, T>> {
|
||||
let poisoned = unsafe {
|
||||
|
@ -268,7 +274,8 @@ impl StaticCondvar {
|
|||
///
|
||||
/// See `Condvar::wait_timeout`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn wait_timeout_ms<'a, T>(&'static self, guard: MutexGuard<'a, T>, ms: u32)
|
||||
-> LockResult<(MutexGuard<'a, T>, bool)> {
|
||||
self.wait_timeout(guard, Duration::from_millis(ms as u64))
|
||||
|
@ -279,7 +286,8 @@ impl StaticCondvar {
|
|||
///
|
||||
/// See `Condvar::wait_timeout`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn wait_timeout<'a, T>(&'static self,
|
||||
guard: MutexGuard<'a, T>,
|
||||
timeout: Duration)
|
||||
|
@ -305,7 +313,8 @@ impl StaticCondvar {
|
|||
///
|
||||
/// See `Condvar::wait_timeout_with`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn wait_timeout_with<'a, T, F>(&'static self,
|
||||
guard: MutexGuard<'a, T>,
|
||||
dur: Duration,
|
||||
|
@ -351,14 +360,16 @@ impl StaticCondvar {
|
|||
///
|
||||
/// See `Condvar::notify_one`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } }
|
||||
|
||||
/// Wakes up all blocked threads on this condvar.
|
||||
///
|
||||
/// See `Condvar::notify_all`.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } }
|
||||
|
||||
/// Deallocates all resources associated with this static condvar.
|
||||
|
@ -368,7 +379,8 @@ impl StaticCondvar {
|
|||
/// users of the condvar. This method is required to be called to not leak
|
||||
/// memory on all platforms.
|
||||
#[unstable(feature = "static_condvar",
|
||||
reason = "may be merged with Condvar in the future")]
|
||||
reason = "may be merged with Condvar in the future",
|
||||
issue = "27717")]
|
||||
pub unsafe fn destroy(&'static self) {
|
||||
self.inner.destroy()
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
module will likely be replaced, and it is currently \
|
||||
unknown how much API breakage that will cause. The ability \
|
||||
to select over a number of channels will remain forever, \
|
||||
but no guarantees beyond this are being made")]
|
||||
but no guarantees beyond this are being made",
|
||||
issue = "27800")]
|
||||
|
||||
|
||||
use core::cell::{Cell, UnsafeCell};
|
||||
|
|
|
@ -151,7 +151,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
|
|||
/// // lock is unlocked here.
|
||||
/// ```
|
||||
#[unstable(feature = "static_mutex",
|
||||
reason = "may be merged with Mutex in the future")]
|
||||
reason = "may be merged with Mutex in the future",
|
||||
issue = "27717")]
|
||||
pub struct StaticMutex {
|
||||
lock: sys::Mutex,
|
||||
poison: poison::Flag,
|
||||
|
@ -177,7 +178,8 @@ 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 = "static_mutex",
|
||||
reason = "may be merged with Mutex in the future")]
|
||||
reason = "may be merged with Mutex in the future",
|
||||
issue = "27717")]
|
||||
pub const MUTEX_INIT: StaticMutex = StaticMutex::new();
|
||||
|
||||
impl<T> Mutex<T> {
|
||||
|
@ -271,7 +273,8 @@ unsafe impl Sync for Dummy {}
|
|||
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
||||
|
||||
#[unstable(feature = "static_mutex",
|
||||
reason = "may be merged with Mutex in the future")]
|
||||
reason = "may be merged with Mutex in the future",
|
||||
issue = "27717")]
|
||||
impl StaticMutex {
|
||||
/// Creates a new mutex in an unlocked state ready for use.
|
||||
pub const fn new() -> StaticMutex {
|
||||
|
|
|
@ -98,7 +98,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
|
|||
/// unsafe { LOCK.destroy() } // free all resources
|
||||
/// ```
|
||||
#[unstable(feature = "static_rwlock",
|
||||
reason = "may be merged with RwLock in the future")]
|
||||
reason = "may be merged with RwLock in the future",
|
||||
issue = "27717")]
|
||||
pub struct StaticRwLock {
|
||||
lock: sys::RWLock,
|
||||
poison: poison::Flag,
|
||||
|
@ -106,7 +107,8 @@ pub struct StaticRwLock {
|
|||
|
||||
/// Constant initialization for a statically-initialized rwlock.
|
||||
#[unstable(feature = "static_rwlock",
|
||||
reason = "may be merged with RwLock in the future")]
|
||||
reason = "may be merged with RwLock in the future",
|
||||
issue = "27717")]
|
||||
pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock::new();
|
||||
|
||||
/// RAII structure used to release the shared read access of a lock when
|
||||
|
@ -285,7 +287,8 @@ unsafe impl Sync for Dummy {}
|
|||
static DUMMY: Dummy = Dummy(UnsafeCell::new(()));
|
||||
|
||||
#[unstable(feature = "static_rwlock",
|
||||
reason = "may be merged with RwLock in the future")]
|
||||
reason = "may be merged with RwLock in the future",
|
||||
issue = "27717")]
|
||||
impl StaticRwLock {
|
||||
/// Creates a new rwlock.
|
||||
pub const fn new() -> StaticRwLock {
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#![unstable(feature = "semaphore",
|
||||
reason = "the interaction between semaphores and the acquisition/release \
|
||||
of resources is currently unclear")]
|
||||
of resources is currently unclear",
|
||||
issue = "27798")]
|
||||
|
||||
use ops::Drop;
|
||||
use sync::{Mutex, Condvar};
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
#![unstable(feature = "reentrant_mutex", reason = "new API")]
|
||||
|
||||
#![unstable(feature = "reentrant_mutex", reason = "new API",
|
||||
issue = "27738")]
|
||||
|
||||
use prelude::v1::*;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
//! ```
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![unstable(feature = "thread_local_internals")]
|
||||
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||
#![allow(dead_code)] // sys isn't exported yet
|
||||
|
||||
use sync::atomic::{self, AtomicUsize, Ordering};
|
||||
|
|
|
@ -22,43 +22,43 @@ use sys::fs::MetadataExt as UnixMetadataExt;
|
|||
use sys;
|
||||
use sys_common::{FromInner, AsInner, AsInnerMut};
|
||||
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const USER_READ: raw::mode_t = 0o400;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const USER_WRITE: raw::mode_t = 0o200;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const USER_EXECUTE: raw::mode_t = 0o100;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const USER_RWX: raw::mode_t = 0o700;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const GROUP_READ: raw::mode_t = 0o040;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const GROUP_WRITE: raw::mode_t = 0o020;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const GROUP_EXECUTE: raw::mode_t = 0o010;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const GROUP_RWX: raw::mode_t = 0o070;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const OTHER_READ: raw::mode_t = 0o004;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const OTHER_WRITE: raw::mode_t = 0o002;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const OTHER_EXECUTE: raw::mode_t = 0o001;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const OTHER_RWX: raw::mode_t = 0o007;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const ALL_READ: raw::mode_t = 0o444;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const ALL_WRITE: raw::mode_t = 0o222;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const ALL_EXECUTE: raw::mode_t = 0o111;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const ALL_RWX: raw::mode_t = 0o777;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const SETUID: raw::mode_t = 0o4000;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const SETGID: raw::mode_t = 0o2000;
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API")]
|
||||
#[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
|
||||
pub const STICKY_BIT: raw::mode_t = 0o1000;
|
||||
|
||||
/// Unix-specific extensions to `Permissions`
|
||||
|
@ -178,7 +178,8 @@ impl MetadataExt for fs::Metadata {
|
|||
}
|
||||
|
||||
/// Add special unix types (block/char device, fifo and socket)
|
||||
#[unstable(feature = "file_type_ext", reason = "recently added API")]
|
||||
#[unstable(feature = "file_type_ext", reason = "recently added API",
|
||||
issue = "27796")]
|
||||
pub trait FileTypeExt {
|
||||
/// Returns whether this file type is a block device.
|
||||
fn is_block_device(&self) -> bool;
|
||||
|
@ -190,7 +191,8 @@ pub trait FileTypeExt {
|
|||
fn is_socket(&self) -> bool;
|
||||
}
|
||||
|
||||
#[unstable(feature = "file_type_ext", reason = "recently added API")]
|
||||
#[unstable(feature = "file_type_ext", reason = "recently added API",
|
||||
issue = "27796")]
|
||||
impl FileTypeExt for fs::FileType {
|
||||
fn is_block_device(&self) -> bool { self.as_inner().is(libc::S_IFBLK) }
|
||||
fn is_char_device(&self) -> bool { self.as_inner().is(libc::S_IFCHR) }
|
||||
|
@ -240,7 +242,8 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
|
|||
sys::fs::symlink(src.as_ref(), dst.as_ref())
|
||||
}
|
||||
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API")]
|
||||
#[unstable(feature = "dir_builder", reason = "recently added API",
|
||||
issue = "27710")]
|
||||
/// An extension trait for `fs::DirBuilder` for unix-specific options.
|
||||
pub trait DirBuilderExt {
|
||||
/// Sets the mode to create new directories with. This option defaults to
|
||||
|
|
|
@ -61,7 +61,8 @@ pub trait FromRawFd {
|
|||
|
||||
/// A trait to express the ability to consume an object and acquire ownership of
|
||||
/// its raw file descriptor.
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||
issue = "27797")]
|
||||
pub trait IntoRawFd {
|
||||
/// Consumes this object, returning the raw underlying file descriptor.
|
||||
///
|
||||
|
|
|
@ -32,15 +32,17 @@ pub trait CommandExt {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn gid(&mut self, id: gid_t) -> &mut process::Command;
|
||||
|
||||
/// Create a new session (cf. `setsid(2)`) for the child process. This means that the child is
|
||||
/// the leader of a new process group. The parent process remains the child reaper of the new
|
||||
/// process.
|
||||
/// Create a new session (cf. `setsid(2)`) for the child process. This means
|
||||
/// that the child is the leader of a new process group. The parent process
|
||||
/// remains the child reaper of the new process.
|
||||
///
|
||||
/// This is not enough to create a daemon process. The *init* process should be the child
|
||||
/// reaper of a daemon. This can be achieved if the parent process exit. Moreover, a daemon
|
||||
/// should not have a controlling terminal. To acheive this, a session leader (the child) must
|
||||
/// spawn another process (the daemon) in the same session.
|
||||
#[unstable(feature = "process_session_leader", reason = "recently added")]
|
||||
/// This is not enough to create a daemon process. The *init* process should
|
||||
/// be the child reaper of a daemon. This can be achieved if the parent
|
||||
/// process exit. Moreover, a daemon should not have a controlling terminal.
|
||||
/// To acheive this, a session leader (the child) must spawn another process
|
||||
/// (the daemon) in the same session.
|
||||
#[unstable(feature = "process_session_leader", reason = "recently added",
|
||||
issue = "27811")]
|
||||
fn session_leader(&mut self, on: bool) -> &mut process::Command;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ pub trait FromRawHandle {
|
|||
|
||||
/// A trait to express the ability to consume an object and acquire ownership of
|
||||
/// its raw `HANDLE`.
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||
issue = "27797")]
|
||||
pub trait IntoRawHandle {
|
||||
/// Consumes this object, returning the raw underlying handle.
|
||||
///
|
||||
|
@ -110,7 +111,8 @@ pub trait FromRawSocket {
|
|||
|
||||
/// A trait to express the ability to consume an object and acquire ownership of
|
||||
/// its raw `SOCKET`.
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API")]
|
||||
#[unstable(feature = "into_raw_os", reason = "recently added API",
|
||||
issue = "27797")]
|
||||
pub trait IntoRawSocket {
|
||||
/// Consumes this object, returning the raw underlying socket.
|
||||
///
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
//! Thread local storage
|
||||
|
||||
#![unstable(feature = "thread_local_internals")]
|
||||
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||
|
||||
use cell::UnsafeCell;
|
||||
|
||||
|
@ -137,7 +137,8 @@ macro_rules! thread_local {
|
|||
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "thread_local_internals",
|
||||
reason = "should not be necessary")]
|
||||
reason = "should not be necessary",
|
||||
issue = "0")]
|
||||
#[macro_export]
|
||||
#[allow_internal_unstable]
|
||||
macro_rules! __thread_local_inner {
|
||||
|
@ -153,7 +154,8 @@ macro_rules! __thread_local_inner {
|
|||
|
||||
/// Indicator of the state of a thread local storage key.
|
||||
#[unstable(feature = "thread_local_state",
|
||||
reason = "state querying was recently added")]
|
||||
reason = "state querying was recently added",
|
||||
issue = "27716")]
|
||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||
pub enum LocalKeyState {
|
||||
/// All keys are in this state whenever a thread starts. Keys will
|
||||
|
@ -185,7 +187,8 @@ pub enum LocalKeyState {
|
|||
impl<T: 'static> LocalKey<T> {
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "thread_local_internals",
|
||||
reason = "recently added to create a key")]
|
||||
reason = "recently added to create a key",
|
||||
issue = "0")]
|
||||
pub const fn new(inner: fn() -> &'static __KeyInner<T>,
|
||||
init: fn() -> T) -> LocalKey<T> {
|
||||
LocalKey {
|
||||
|
@ -248,7 +251,8 @@ impl<T: 'static> LocalKey<T> {
|
|||
/// to be able to be accessed. Keys in the `Destroyed` state will panic on
|
||||
/// any call to `with`.
|
||||
#[unstable(feature = "thread_local_state",
|
||||
reason = "state querying was recently added")]
|
||||
reason = "state querying was recently added",
|
||||
issue = "27716")]
|
||||
pub fn state(&'static self) -> LocalKeyState {
|
||||
unsafe {
|
||||
match (self.inner)().get() {
|
||||
|
|
|
@ -167,7 +167,6 @@ use any::Any;
|
|||
use cell::UnsafeCell;
|
||||
use fmt;
|
||||
use io;
|
||||
use marker::PhantomData;
|
||||
use rt::{self, unwind};
|
||||
use sync::{Mutex, Condvar, Arc};
|
||||
use sys::thread as imp;
|
||||
|
@ -186,7 +185,8 @@ pub use self::local::{LocalKey, LocalKeyState};
|
|||
|
||||
#[unstable(feature = "scoped_tls",
|
||||
reason = "scoped TLS has yet to have wide enough use to fully \
|
||||
consider stabilizing its interface")]
|
||||
consider stabilizing its interface",
|
||||
issue = "27715")]
|
||||
pub use self::scoped_tls::ScopedKey;
|
||||
|
||||
#[doc(hidden)] pub use self::local::__KeyInner as __LocalKeyInner;
|
||||
|
@ -375,7 +375,8 @@ pub fn panicking() -> bool {
|
|||
/// });
|
||||
/// assert!(result.is_err());
|
||||
/// ```
|
||||
#[unstable(feature = "catch_panic", reason = "recent API addition")]
|
||||
#[unstable(feature = "catch_panic", reason = "recent API addition",
|
||||
issue = "27719")]
|
||||
pub fn catch_panic<F, R>(f: F) -> Result<R>
|
||||
where F: FnOnce() -> R + Send + 'static
|
||||
{
|
||||
|
@ -409,7 +410,8 @@ pub fn sleep_ms(ms: u32) {
|
|||
/// signal being received or a spurious wakeup. Platforms which do not support
|
||||
/// nanosecond precision for sleeping will have `dur` rounded up to the nearest
|
||||
/// granularity of time they can sleep for.
|
||||
#[unstable(feature = "thread_sleep", reason = "waiting on Duration")]
|
||||
#[unstable(feature = "thread_sleep", reason = "waiting on Duration",
|
||||
issue = "27771")]
|
||||
pub fn sleep(dur: Duration) {
|
||||
imp::Thread::sleep(dur)
|
||||
}
|
||||
|
@ -479,7 +481,8 @@ pub fn park_timeout_ms(ms: u32) {
|
|||
///
|
||||
/// Platforms which do not support nanosecond precision for sleeping will have
|
||||
/// `dur` rounded up to the nearest granularity of time they can sleep for.
|
||||
#[unstable(feature = "park_timeout", reason = "waiting on Duration")]
|
||||
#[unstable(feature = "park_timeout", reason = "waiting on Duration",
|
||||
issue = "27771")]
|
||||
pub fn park_timeout(dur: Duration) {
|
||||
let thread = current();
|
||||
let mut guard = thread.inner.lock.lock().unwrap();
|
||||
|
@ -552,7 +555,7 @@ impl thread_info::NewThread for Thread {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// JoinHandle and JoinGuard
|
||||
// JoinHandle
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Indicates the manner in which a thread exited.
|
||||
|
@ -578,7 +581,7 @@ struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>);
|
|||
unsafe impl<T: Send> Send for Packet<T> {}
|
||||
unsafe impl<T: Sync> Sync for Packet<T> {}
|
||||
|
||||
/// Inner representation for JoinHandle and JoinGuard
|
||||
/// Inner representation for JoinHandle
|
||||
struct JoinInner<T> {
|
||||
native: Option<imp::Thread>,
|
||||
thread: Thread,
|
||||
|
@ -596,8 +599,7 @@ impl<T> JoinInner<T> {
|
|||
|
||||
/// An owned permission to join on a thread (block on its termination).
|
||||
///
|
||||
/// Unlike a `JoinGuard`, a `JoinHandle` *detaches* the child thread
|
||||
/// when it is dropped, rather than automatically joining on drop.
|
||||
/// A `JoinHandle` *detaches* the child thread when it is dropped.
|
||||
///
|
||||
/// Due to platform restrictions, it is not possible to `Clone` this
|
||||
/// handle: the ability to join a child thread is a uniquely-owned
|
||||
|
@ -622,63 +624,9 @@ impl<T> JoinHandle<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// An RAII-style guard that will block until thread termination when dropped.
|
||||
///
|
||||
/// The type `T` is the return type for the thread's main function.
|
||||
///
|
||||
/// Joining on drop is necessary to ensure memory safety when stack
|
||||
/// data is shared between a parent and child thread.
|
||||
///
|
||||
/// Due to platform restrictions, it is not possible to `Clone` this
|
||||
/// handle: the ability to join a child thread is a uniquely-owned
|
||||
/// permission.
|
||||
#[must_use = "thread will be immediately joined if `JoinGuard` is not used"]
|
||||
#[unstable(feature = "scoped",
|
||||
reason = "memory unsafe if destructor is avoided, see #24292")]
|
||||
pub struct JoinGuard<'a, T: Send + 'a> {
|
||||
inner: JoinInner<T>,
|
||||
_marker: PhantomData<&'a T>,
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {}
|
||||
|
||||
impl<'a, T: Send + 'a> JoinGuard<'a, T> {
|
||||
/// Extracts a handle to the thread this guard will join on.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn thread(&self) -> &Thread {
|
||||
&self.inner.thread
|
||||
}
|
||||
|
||||
/// Waits for the associated thread to finish, returning the result of the
|
||||
/// thread's calculation.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics on the child thread are propagated by panicking the parent.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn join(mut self) -> T {
|
||||
match self.inner.join() {
|
||||
Ok(res) => res,
|
||||
Err(_) => panic!("child thread {:?} panicked", self.thread()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "scoped",
|
||||
reason = "memory unsafe if destructor is avoided, see #24292")]
|
||||
impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> {
|
||||
fn drop(&mut self) {
|
||||
if self.inner.native.is_some() && self.inner.join().is_err() {
|
||||
panic!("child thread {:?} panicked", self.thread());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _assert_sync_and_send() {
|
||||
fn _assert_both<T: Send + Sync>() {}
|
||||
_assert_both::<JoinHandle<()>>();
|
||||
_assert_both::<JoinGuard<()>>();
|
||||
_assert_both::<Thread>();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
//! });
|
||||
//! ```
|
||||
|
||||
#![unstable(feature = "thread_local_internals")]
|
||||
#![unstable(feature = "thread_local_internals", issue = "0")]
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use self::imp::KeyInner as __KeyInner;
|
||||
|
@ -54,7 +54,8 @@ pub use self::imp::KeyInner as __KeyInner;
|
|||
/// their contents.
|
||||
#[unstable(feature = "scoped_tls",
|
||||
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||
stabilizing its interface")]
|
||||
stabilizing its interface",
|
||||
issue = "27715")]
|
||||
pub struct ScopedKey<T:'static> { inner: fn() -> &'static imp::KeyInner<T> }
|
||||
|
||||
/// Declare a new scoped thread local storage key.
|
||||
|
@ -116,7 +117,8 @@ macro_rules! __scoped_thread_local_inner {
|
|||
|
||||
#[unstable(feature = "scoped_tls",
|
||||
reason = "scoped TLS has yet to have wide enough use to fully consider \
|
||||
stabilizing its interface")]
|
||||
stabilizing its interface",
|
||||
issue = "27715")]
|
||||
impl<T> ScopedKey<T> {
|
||||
#[doc(hidden)]
|
||||
pub const fn new(inner: fn() -> &'static imp::KeyInner<T>) -> ScopedKey<T> {
|
||||
|
|
|
@ -64,7 +64,8 @@ impl Duration {
|
|||
#[unstable(feature = "duration_span",
|
||||
reason = "unsure if this is the right API or whether it should \
|
||||
wait for a more general \"moment in time\" \
|
||||
abstraction")]
|
||||
abstraction",
|
||||
issue = "27799")]
|
||||
pub fn span<F>(f: F) -> Duration where F: FnOnce() {
|
||||
let start = SteadyTime::now();
|
||||
f();
|
||||
|
|
Loading…
Reference in New Issue