core: Split apart the global core feature

This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.

A few minor APIs were deprecated along the way:

* Iterator::reverse_in_place
* marker::NoCopy
This commit is contained in:
Alex Crichton 2015-06-09 11:18:03 -07:00
parent e7a5a1c33a
commit c14d86fd3f
54 changed files with 381 additions and 290 deletions

View File

@ -10,9 +10,9 @@
//! A pointer type for heap allocation.
//!
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of heap allocation in
//! Rust. Boxes provide ownership for this allocation, and drop their contents when they go out of
//! scope.
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of
//! heap allocation in Rust. Boxes provide ownership for this allocation, and
//! drop their contents when they go out of scope.
//!
//! # Examples
//!
@ -39,15 +39,17 @@
//!
//! This will print `Cons(1, Cons(2, Nil))`.
//!
//! Recursive structures must be boxed, because if the definition of `Cons` looked like this:
//! Recursive structures must be boxed, because if the definition of `Cons`
//! looked like this:
//!
//! ```rust,ignore
//! Cons(T, List<T>),
//! ```
//!
//! It wouldn't work. This is because the size of a `List` depends on how many elements are in the
//! list, and so we don't know how much memory to allocate for a `Cons`. By introducing a `Box`,
//! which has a defined size, we know how big `Cons` needs to be.
//! It wouldn't work. This is because the size of a `List` depends on how many
//! elements are in the list, and so we don't know how much memory to allocate
//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
//! big `Cons` needs to be.
#![stable(feature = "rust1", since = "1.0.0")]
@ -355,7 +357,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
/// }
/// ```
#[rustc_paren_sugar]
#[unstable(feature = "core", reason = "Newly introduced")]
#[unstable(feature = "fnbox", reason = "Newly introduced")]
pub trait FnBox<A> {
type Output;

View File

@ -60,26 +60,32 @@
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "alloc"]
#![unstable(feature = "alloc")]
#![feature(staged_api)]
#![staged_api]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![doc(test(no_crate_inject))]
#![feature(no_std)]
html_root_url = "http://doc.rust-lang.org/nightly/",
test(no_crate_inject))]
#![no_std]
#![feature(allocator)]
#![feature(box_syntax)]
#![feature(coerce_unsized)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(custom_attribute)]
#![feature(fundamental)]
#![feature(lang_items)]
#![feature(box_syntax)]
#![feature(no_std)]
#![feature(nonzero)]
#![feature(optin_builtin_traits)]
#![feature(raw)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(core)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(unsize)]
#![cfg_attr(test, feature(test, alloc, rustc_private))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
feature(libc))]

View File

@ -32,7 +32,9 @@
#![feature(alloc)]
#![feature(box_syntax)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(ptr_as_ref)]
#![feature(raw)]
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![cfg_attr(test, feature(test))]

View File

@ -21,26 +21,42 @@
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![doc(test(no_crate_inject))]
html_playground_url = "http://play.rust-lang.org/",
test(no_crate_inject))]
#![allow(trivial_casts)]
#![cfg_attr(test, allow(deprecated))] // rand
#![feature(alloc)]
#![feature(box_syntax)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(copy_lifetime)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(iter_cmp)]
#![feature(iter_idx)]
#![feature(iter_order)]
#![feature(iter_product)]
#![feature(iter_sum)]
#![feature(lang_items)]
#![feature(num_bits_bytes)]
#![feature(pattern)]
#![feature(ptr_as_ref)]
#![feature(raw)]
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(step_by)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(step_by)]
#![feature(str_char)]
#![feature(slice_patterns)]
#![feature(utf8_error)]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(test, allow(deprecated))] // rand
#![cfg_attr(not(test), feature(str_words))]
#![feature(no_std)]

View File

@ -92,7 +92,7 @@ use marker::{Reflect, Sized};
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Any: Reflect + 'static {
/// Gets the `TypeId` of `self`.
#[unstable(feature = "core",
#[unstable(feature = "get_type_id",
reason = "this method will likely be replaced by an associated static")]
fn get_type_id(&self) -> TypeId;
}

View File

@ -12,9 +12,10 @@
//! up to a certain length. Eventually we should able to generalize
//! to all lengths.
#![unstable(feature = "core")] // not yet reviewed
#![doc(primitive = "array")]
#![unstable(feature = "fixed_size_array",
reason = "traits and impls are better expressed through generic \
integer constants")]
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
@ -30,7 +31,6 @@ use slice::{Iter, IterMut, SliceExt};
///
/// This trait can be used to implement other traits on fixed-size arrays
/// without causing much metadata bloat.
#[unstable(feature = "core")]
pub trait FixedSizeArray<T> {
/// Converts the array to immutable slice
fn as_slice(&self) -> &[T];
@ -42,7 +42,6 @@ pub trait FixedSizeArray<T> {
macro_rules! array_impls {
($($N:expr)+) => {
$(
#[unstable(feature = "core")]
impl<T> FixedSizeArray<T> for [T; $N] {
#[inline]
fn as_slice(&self) -> &[T] {
@ -54,8 +53,6 @@ macro_rules! array_impls {
}
}
#[unstable(feature = "array_as_ref",
reason = "should ideally be implemented for all fixed-sized arrays")]
impl<T> AsRef<[T]> for [T; $N] {
#[inline]
fn as_ref(&self) -> &[T] {
@ -63,8 +60,6 @@ macro_rules! array_impls {
}
}
#[unstable(feature = "array_as_ref",
reason = "should ideally be implemented for all fixed-sized arrays")]
impl<T> AsMut<[T]> for [T; $N] {
#[inline]
fn as_mut(&mut self) -> &mut [T] {

View File

@ -229,7 +229,7 @@ impl<T:Copy> Cell<T> {
/// let uc = unsafe { c.as_unsafe_cell() };
/// ```
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "as_unsafe_cell")]
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
&self.value
}
@ -277,7 +277,7 @@ pub struct RefCell<T: ?Sized> {
/// An enumeration of values returned from the `state` method on a `RefCell<T>`.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[unstable(feature = "std_misc")]
#[unstable(feature = "borrow_state")]
pub enum BorrowState {
/// The cell is currently being read, there is at least one active `borrow`.
Reading,
@ -339,7 +339,7 @@ impl<T: ?Sized> RefCell<T> {
///
/// The returned value can be dispatched on to determine if a call to
/// `borrow` or `borrow_mut` would succeed.
#[unstable(feature = "std_misc")]
#[unstable(feature = "borrow_state")]
#[inline]
pub fn borrow_state(&self) -> BorrowState {
match self.borrow.get() {
@ -448,7 +448,7 @@ impl<T: ?Sized> RefCell<T> {
///
/// This function is `unsafe` because `UnsafeCell`'s field is public.
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "as_unsafe_cell")]
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
&self.value
}
@ -564,9 +564,10 @@ impl<'b, T: ?Sized> Ref<'b, T> {
///
/// The `RefCell` is already immutably borrowed, so this cannot fail.
///
/// This is an associated function that needs to be used as `Ref::clone(...)`.
/// A `Clone` implementation or a method would interfere with the widespread
/// use of `r.borrow().clone()` to clone the contents of a `RefCell`.
/// This is an associated function that needs to be used as
/// `Ref::clone(...)`. A `Clone` implementation or a method would interfere
/// with the widespread use of `r.borrow().clone()` to clone the contents of
/// a `RefCell`.
#[unstable(feature = "cell_extras",
reason = "likely to be moved to a method, pending language changes")]
#[inline]
@ -582,8 +583,8 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// The `RefCell` is already immutably borrowed, so this cannot fail.
///
/// This is an associated function that needs to be used as `Ref::map(...)`.
/// A method would interfere with methods of the same name on the contents of a `RefCell`
/// used through `Deref`.
/// A method would interfere with methods of the same name on the contents
/// of a `RefCell` used through `Deref`.
///
/// # Example
///
@ -607,13 +608,14 @@ impl<'b, T: ?Sized> Ref<'b, T> {
}
}
/// Make a new `Ref` for a optional component of the borrowed data, e.g. an enum variant.
/// Make a new `Ref` for a optional component of the borrowed data, e.g. an
/// enum variant.
///
/// The `RefCell` is already immutably borrowed, so this cannot fail.
///
/// This is an associated function that needs to be used as `Ref::filter_map(...)`.
/// A method would interfere with methods of the same name on the contents of a `RefCell`
/// used through `Deref`.
/// This is an associated function that needs to be used as
/// `Ref::filter_map(...)`. A method would interfere with methods of the
/// same name on the contents of a `RefCell` used through `Deref`.
///
/// # Example
///
@ -639,13 +641,14 @@ impl<'b, T: ?Sized> Ref<'b, T> {
}
impl<'b, T: ?Sized> RefMut<'b, T> {
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum variant.
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
/// variant.
///
/// The `RefCell` is already mutably borrowed, so this cannot fail.
///
/// This is an associated function that needs to be used as `RefMut::map(...)`.
/// A method would interfere with methods of the same name on the contents of a `RefCell`
/// used through `Deref`.
/// This is an associated function that needs to be used as
/// `RefMut::map(...)`. A method would interfere with methods of the same
/// name on the contents of a `RefCell` used through `Deref`.
///
/// # Example
///
@ -673,13 +676,14 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
}
}
/// Make a new `RefMut` for a optional component of the borrowed data, e.g. an enum variant.
/// Make a new `RefMut` for a optional component of the borrowed data, e.g.
/// an enum variant.
///
/// The `RefCell` is already mutably borrowed, so this cannot fail.
///
/// This is an associated function that needs to be used as `RefMut::filter_map(...)`.
/// A method would interfere with methods of the same name on the contents of a `RefCell`
/// used through `Deref`.
/// This is an associated function that needs to be used as
/// `RefMut::filter_map(...)`. A method would interfere with methods of the
/// same name on the contents of a `RefCell` used through `Deref`.
///
/// # Example
///
@ -690,7 +694,9 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
/// let c = RefCell::new(Ok(5));
/// {
/// let b1: RefMut<Result<u32, ()>> = c.borrow_mut();
/// let mut b2: RefMut<u32> = RefMut::filter_map(b1, |o| o.as_mut().ok()).unwrap();
/// let mut b2: RefMut<u32> = RefMut::filter_map(b1, |o| {
/// o.as_mut().ok()
/// }).unwrap();
/// assert_eq!(*b2, 5);
/// *b2 = 42;
/// }

View File

@ -14,6 +14,7 @@
#![allow(non_snake_case)]
#![doc(primitive = "char")]
#![stable(feature = "rust1", since = "1.0.0")]
use iter::Iterator;
use mem::transmute;
@ -131,6 +132,8 @@ pub fn from_digit(num: u32, radix: u32) -> Option<char> {
// unicode/char.rs, not here
#[allow(missing_docs)] // docs in libunicode/u_char.rs
#[doc(hidden)]
#[unstable(feature = "core_char_ext",
reason = "the stable interface is `impl char` in later crate")]
pub trait CharExt {
fn is_digit(self, radix: u32) -> bool;
fn to_digit(self, radix: u32) -> Option<u32>;
@ -220,6 +223,8 @@ impl CharExt for char {
/// If the buffer is not large enough, nothing will be written into it
/// and a `None` will be returned.
#[inline]
#[unstable(feature = "char_internals",
reason = "this function should not be exposed publicly")]
pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
// Marked #[inline] to allow llvm optimizing it away
if code < MAX_ONE_B && !dst.is_empty() {
@ -251,6 +256,8 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
/// If the buffer is not large enough, nothing will be written into it
/// and a `None` will be returned.
#[inline]
#[unstable(feature = "char_internals",
reason = "this function should not be exposed publicly")]
pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option<usize> {
// Marked #[inline] to allow llvm optimizing it away
if (ch & 0xFFFF) == ch && !dst.is_empty() {

View File

@ -89,29 +89,28 @@ clone_impl! { char }
macro_rules! extern_fn_clone {
($($A:ident),*) => (
#[unstable(feature = "core",
reason = "this may not be sufficient for fns with region parameters")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
/// Returns a copy of a function pointer.
#[inline]
fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($A,)* ReturnType> Clone for extern "C" fn($($A),*) -> ReturnType {
/// Returns a copy of a function pointer.
#[inline]
fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($A,)* ReturnType> Clone for unsafe extern "Rust" fn($($A),*) -> ReturnType {
/// Returns a copy of a function pointer.
#[inline]
fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self }
}
#[unstable(feature = "core", reason = "brand new")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<$($A,)* ReturnType> Clone for unsafe extern "C" fn($($A),*) -> ReturnType {
/// Returns a copy of a function pointer.
#[inline]

View File

@ -10,10 +10,10 @@
//! Functionality for ordering and comparison.
//!
//! This module defines both `PartialOrd` and `PartialEq` traits which are used by the compiler to
//! implement comparison operators. Rust programs may implement `PartialOrd` to overload the `<`,
//! `<=`, `>`, and `>=` operators, and may implement `PartialEq` to overload the `==` and `!=`
//! operators.
//! This module defines both `PartialOrd` and `PartialEq` traits which are used
//! by the compiler to implement comparison operators. Rust programs may
//! implement `PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators,
//! and may implement `PartialEq` to overload the `==` and `!=` operators.
#![stable(feature = "rust1", since = "1.0.0")]
@ -22,29 +22,31 @@ use self::Ordering::*;
use marker::Sized;
use option::Option::{self, Some, None};
/// Trait for equality comparisons which are [partial equivalence relations](
/// http://en.wikipedia.org/wiki/Partial_equivalence_relation).
/// Trait for equality comparisons which are [partial equivalence
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
///
/// This trait allows for partial equality, for types that do not have a full equivalence relation.
/// For example, in floating point numbers `NaN != NaN`, so floating point types implement
/// `PartialEq` but not `Eq`.
/// This trait allows for partial equality, for types that do not have a full
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
/// so floating point types implement `PartialEq` but not `Eq`.
///
/// Formally, the equality must be (for all `a`, `b` and `c`):
///
/// - symmetric: `a == b` implies `b == a`; and
/// - transitive: `a == b` and `b == c` implies `a == c`.
///
/// Note that these requirements mean that the trait itself must be implemented symmetrically and
/// transitively: if `T: PartialEq<U>` and `U: PartialEq<V>` then `U: PartialEq<T>` and `T:
/// PartialEq<V>`.
/// Note that these requirements mean that the trait itself must be implemented
/// symmetrically and transitively: if `T: PartialEq<U>` and `U: PartialEq<V>`
/// then `U: PartialEq<T>` and `T: PartialEq<V>`.
///
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined in terms of it by
/// default. Any manual implementation of `ne` *must* respect the rule that `eq` is a strict
/// inverse of `ne`; that is, `!(a == b)` if and only if `a != b`.
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined
/// in terms of it by default. Any manual implementation of `ne` *must* respect
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
/// only if `a != b`.
#[lang = "eq"]
#[stable(feature = "rust1", since = "1.0.0")]
pub trait PartialEq<Rhs: ?Sized = Self> {
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
/// This method tests for `self` and `other` values to be equal, and is used
/// by `==`.
#[stable(feature = "rust1", since = "1.0.0")]
fn eq(&self, other: &Rhs) -> bool;
@ -396,7 +398,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
/// assert_eq!(result, None);
/// ```
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "cmp_partial")]
pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
match v1.partial_cmp(&v2) {
Some(Less) | Some(Equal) => Some(v1),
@ -429,7 +431,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
/// assert_eq!(result, None);
/// ```
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "cmp_partial")]
pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
match v1.partial_cmp(&v2) {
Some(Equal) | Some(Less) => Some(v2),

View File

@ -10,11 +10,12 @@
//! Traits for conversions between types.
//!
//! The traits in this module provide a general way to talk about conversions from one type to
//! another. They follow the standard Rust conventions of `as`/`into`/`from`.
//! The traits in this module provide a general way to talk about conversions
//! from one type to another. They follow the standard Rust conventions of
//! `as`/`into`/`from`.
//!
//! Like many traits, these are often used as bounds for generic functions, to support arguments of
//! multiple types.
//! Like many traits, these are often used as bounds for generic functions, to
//! support arguments of multiple types.
//!
//! See each trait for usage examples.

View File

@ -33,7 +33,7 @@ pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap}
mod num;
mod builders;
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
#[doc(hidden)]
pub mod rt {
pub mod v1;
@ -146,7 +146,7 @@ enum Void {}
/// compile time it is ensured that the function and the value have the correct
/// types, and then this struct is used to canonicalize arguments to one type.
#[derive(Copy)]
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
#[doc(hidden)]
pub struct ArgumentV1<'a> {
value: &'a Void,
@ -166,7 +166,7 @@ impl<'a> ArgumentV1<'a> {
}
#[doc(hidden)]
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
pub fn new<'b, T>(x: &'b T,
f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
unsafe {
@ -178,7 +178,7 @@ impl<'a> ArgumentV1<'a> {
}
#[doc(hidden)]
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
pub fn from_usize(x: &usize) -> ArgumentV1 {
ArgumentV1::new(x, ArgumentV1::show_usize)
}
@ -201,7 +201,7 @@ impl<'a> Arguments<'a> {
/// When using the format_args!() macro, this function is used to generate the
/// Arguments structure.
#[doc(hidden)] #[inline]
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
pub fn new_v1(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
Arguments {
@ -218,7 +218,7 @@ impl<'a> Arguments<'a> {
/// created with `argumentusize`. However, failing to do so doesn't cause
/// unsafety, but will ignore invalid .
#[doc(hidden)] #[inline]
#[unstable(feature = "core", reason = "internal to format_args!")]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!")]
pub fn new_v1_formatted(pieces: &'a [&'a str],
args: &'a [ArgumentV1<'a>],
fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
@ -742,19 +742,19 @@ impl<'a> Formatter<'a> {
pub fn flags(&self) -> u32 { self.flags }
/// Character used as 'fill' whenever there is alignment
#[unstable(feature = "core", reason = "method was just created")]
#[unstable(feature = "fmt_flags", reason = "method was just created")]
pub fn fill(&self) -> char { self.fill }
/// Flag indicating what form of alignment was requested
#[unstable(feature = "core", reason = "method was just created")]
#[unstable(feature = "fmt_flags", reason = "method was just created")]
pub fn align(&self) -> Alignment { self.align }
/// Optionally specified integer width that the output should be
#[unstable(feature = "core", reason = "method was just created")]
#[unstable(feature = "fmt_flags", reason = "method was just created")]
pub fn width(&self) -> Option<usize> { self.width }
/// Optionally specified precision for numeric types
#[unstable(feature = "core", reason = "method was just created")]
#[unstable(feature = "fmt_flags", reason = "method was just created")]
pub fn precision(&self) -> Option<usize> { self.precision }
/// Creates a `DebugStruct` builder designed to assist with creation of

View File

@ -127,7 +127,7 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x,
/// A radix with in the range of `2..36`.
#[derive(Clone, Copy, PartialEq)]
#[unstable(feature = "core",
#[unstable(feature = "fmt_radix",
reason = "may be renamed or move to a different module")]
pub struct Radix {
base: u8,
@ -152,7 +152,7 @@ impl GenericRadix for Radix {
}
/// A helper type for formatting radixes.
#[unstable(feature = "core",
#[unstable(feature = "fmt_radix",
reason = "may be renamed or move to a different module")]
#[derive(Copy, Clone)]
pub struct RadixFmt<T, R>(T, R);
@ -166,7 +166,7 @@ pub struct RadixFmt<T, R>(T, R);
/// use std::fmt::radix;
/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string());
/// ```
#[unstable(feature = "core",
#[unstable(feature = "fmt_radix",
reason = "may be renamed or move to a different module")]
pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
RadixFmt(x, Radix::new(base))

View File

@ -14,8 +14,6 @@
//! These definitions are similar to their `ct` equivalents, but differ in that
//! these can be statically allocated and are slightly optimized for the runtime
#![unstable(feature = "core", reason = "internal to format_args!")]
#[derive(Copy, Clone)]
pub struct Argument {
pub position: Position,

View File

@ -89,7 +89,8 @@ pub trait Hash {
fn hash<H: Hasher>(&self, state: &mut H);
/// Feeds a slice of this type into the state provided.
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hash_slice",
reason = "module was recently redesigned")]
fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where Self: Sized {
for piece in data {
piece.hash(state);
@ -110,29 +111,29 @@ pub trait Hasher {
/// Write a single `u8` into this hasher
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_u8(&mut self, i: u8) { self.write(&[i]) }
/// Write a single `u16` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_u16(&mut self, i: u16) {
self.write(&unsafe { mem::transmute::<_, [u8; 2]>(i) })
}
/// Write a single `u32` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_u32(&mut self, i: u32) {
self.write(&unsafe { mem::transmute::<_, [u8; 4]>(i) })
}
/// Write a single `u64` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_u64(&mut self, i: u64) {
self.write(&unsafe { mem::transmute::<_, [u8; 8]>(i) })
}
/// Write a single `usize` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_usize(&mut self, i: usize) {
if cfg!(target_pointer_width = "32") {
self.write_u32(i as u32)
@ -143,23 +144,23 @@ pub trait Hasher {
/// Write a single `i8` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_i8(&mut self, i: i8) { self.write_u8(i as u8) }
/// Write a single `i16` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_i16(&mut self, i: i16) { self.write_u16(i as u16) }
/// Write a single `i32` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_i32(&mut self, i: i32) { self.write_u32(i as u32) }
/// Write a single `i64` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_i64(&mut self, i: i64) { self.write_u64(i as u64) }
/// Write a single `isize` into this hasher.
#[inline]
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hasher_write", reason = "module was recently redesigned")]
fn write_isize(&mut self, i: isize) { self.write_usize(i as usize) }
}
@ -167,7 +168,9 @@ pub trait Hasher {
///
/// The specified value will be hashed with this hasher and then the resulting
/// hash will be returned.
#[unstable(feature = "hash", reason = "module was recently redesigned")]
#[unstable(feature = "hash_default",
reason = "not the most ergonomic interface unless `H` is defaulted \
to SipHasher, but perhaps not ready to commit to that")]
pub fn hash<T: Hash, H: Hasher + Default>(value: &T) -> u64 {
let mut h: H = Default::default();
value.hash(&mut h);

View File

@ -39,7 +39,10 @@
//! guaranteed to happen in order. This is the standard mode for working
//! with atomic types and is equivalent to Java's `volatile`.
#![unstable(feature = "core")]
#![unstable(feature = "core_intrinsics",
reason = "intrinsics are unlikely to ever be stabilized, instead \
they should be used through stabilized interfaces \
in the rest of the standard library")]
#![allow(missing_docs)]
use marker::Sized;
@ -141,10 +144,10 @@ extern "rust-intrinsic" {
/// A compiler-only memory barrier.
///
/// Memory accesses will never be reordered across this barrier by the compiler,
/// but no instructions will be emitted for it. This is appropriate for operations
/// on the same thread that may be preempted, such as when interacting with signal
/// handlers.
/// Memory accesses will never be reordered across this barrier by the
/// compiler, but no instructions will be emitted for it. This is
/// appropriate for operations on the same thread that may be preempted,
/// such as when interacting with signal handlers.
pub fn atomic_singlethreadfence();
pub fn atomic_singlethreadfence_acq();
pub fn atomic_singlethreadfence_rel();

View File

@ -51,8 +51,8 @@
//! }
//! ```
//!
//! Because `Iterator`s implement `IntoIterator`, this `for` loop syntax can be applied to any
//! iterator over any type.
//! Because `Iterator`s implement `IntoIterator`, this `for` loop syntax can be
//! applied to any iterator over any type.
#![stable(feature = "rust1", since = "1.0.0")]
@ -837,7 +837,9 @@ pub trait Iterator {
/// let a = [1, 1, 1, 1];
/// assert_eq!(a.iter().min_max(), MinMax(&1, &1));
/// ```
#[unstable(feature = "core", reason = "return type may change")]
#[unstable(feature = "iter_min_max",
reason = "return type may change or may wish to have a closure \
based version as well")]
fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord
{
let (mut min, mut max) = match self.next() {
@ -897,7 +899,7 @@ pub trait Iterator {
/// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10);
/// ```
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "iter_cmp",
reason = "may want to produce an Ordering directly; see #15311")]
fn max_by<B: Ord, F>(self, f: F) -> Option<Self::Item> where
Self: Sized,
@ -925,7 +927,7 @@ pub trait Iterator {
/// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0);
/// ```
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "iter_cmp",
reason = "may want to produce an Ordering directly; see #15311")]
fn min_by<B: Ord, F>(self, f: F) -> Option<Self::Item> where
Self: Sized,
@ -1041,6 +1043,8 @@ pub trait Iterator {
/// Use an iterator to reverse a container in place.
#[unstable(feature = "core",
reason = "uncertain about placement or widespread use")]
#[deprecated(since = "1.2.0",
reason = "not performant enough to justify inclusion")]
fn reverse_in_place<'a, T: 'a>(&mut self) where
Self: Sized + Iterator<Item=&'a mut T> + DoubleEndedIterator
{
@ -1062,7 +1066,7 @@ pub trait Iterator {
/// let it = a.iter();
/// assert_eq!(it.sum::<i32>(), 15);
/// ```
#[unstable(feature="core")]
#[unstable(feature="iter_sum", reason = "bounds recently changed")]
fn sum<S=<Self as Iterator>::Item>(self) -> S where
S: Add<Self::Item, Output=S> + Zero,
Self: Sized,
@ -1083,7 +1087,7 @@ pub trait Iterator {
/// assert_eq!(factorial(1), 1);
/// assert_eq!(factorial(5), 120);
/// ```
#[unstable(feature="core")]
#[unstable(feature="iter_product", reason = "bounds recently changed")]
fn product<P=<Self as Iterator>::Item>(self) -> P where
P: Mul<Self::Item, Output=P> + One,
Self: Sized,
@ -1223,7 +1227,7 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
/// `DoubleEndedIterator`. Calling `next()` or `next_back()` on a
/// `RandomAccessIterator` reduces the indexable range accordingly. That is,
/// `it.idx(1)` will become `it.idx(0)` after `it.next()` is called.
#[unstable(feature = "core",
#[unstable(feature = "iter_idx",
reason = "not widely used, may be better decomposed into Index \
and ExactSizeIterator")]
pub trait RandomAccessIterator: Iterator {
@ -1304,7 +1308,7 @@ impl<I> DoubleEndedIterator for Rev<I> where I: DoubleEndedIterator {
fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next() }
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Rev<I>
where I: DoubleEndedIterator + RandomAccessIterator
{
@ -1324,7 +1328,7 @@ impl<I> RandomAccessIterator for Rev<I>
/// `MinMaxResult` is an enum returned by `min_max`. See `Iterator::min_max` for
/// more detail.
#[derive(Clone, PartialEq, Debug)]
#[unstable(feature = "core",
#[unstable(feature = "iter_min_max",
reason = "unclear whether such a fine-grained result is widely useful")]
pub enum MinMaxResult<T> {
/// Empty iterator
@ -1338,6 +1342,7 @@ pub enum MinMaxResult<T> {
MinMax(T, T)
}
#[unstable(feature = "iter_min_max", reason = "type is unstable")]
impl<T: Clone> MinMaxResult<T> {
/// `into_option` creates an `Option` of type `(T,T)`. The returned `Option`
/// has variant `None` if and only if the `MinMaxResult` has variant
@ -1360,7 +1365,6 @@ impl<T: Clone> MinMaxResult<T> {
/// let r = MinMax(1, 2);
/// assert_eq!(r.into_option(), Some((1, 2)));
/// ```
#[unstable(feature = "core", reason = "type is unstable")]
pub fn into_option(self) -> Option<(T,T)> {
match self {
NoElements => None,
@ -1407,7 +1411,7 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned<I>
where I: ExactSizeIterator<Item=&'a T>, T: Clone
{}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<'a, I, T: 'a> RandomAccessIterator for Cloned<I>
where I: RandomAccessIterator<Item=&'a T>, T: Clone
{
@ -1454,7 +1458,7 @@ impl<I> Iterator for Cycle<I> where I: Clone + Iterator {
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Cycle<I> where
I: Clone + RandomAccessIterator,
{
@ -1568,7 +1572,7 @@ impl<A, B> DoubleEndedIterator for Chain<A, B> where
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<A, B> RandomAccessIterator for Chain<A, B> where
A: RandomAccessIterator,
B: RandomAccessIterator<Item = A::Item>,
@ -1656,7 +1660,7 @@ impl<A, B> DoubleEndedIterator for Zip<A, B> where
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<A, B> RandomAccessIterator for Zip<A, B> where
A: RandomAccessIterator,
B: RandomAccessIterator
@ -1710,7 +1714,7 @@ impl<B, I: DoubleEndedIterator, F> DoubleEndedIterator for Map<I, F> where
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<B, I: RandomAccessIterator, F> RandomAccessIterator for Map<I, F> where
F: FnMut(I::Item) -> B,
{
@ -1884,7 +1888,7 @@ impl<I> DoubleEndedIterator for Enumerate<I> where
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Enumerate<I> where I: RandomAccessIterator {
#[inline]
fn indexable(&self) -> usize {
@ -2134,7 +2138,7 @@ impl<I> Iterator for Skip<I> where I: Iterator {
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
#[inline]
fn indexable(&self) -> usize {
@ -2206,7 +2210,7 @@ impl<I> Iterator for Take<I> where I: Iterator{
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
#[inline]
fn indexable(&self) -> usize {
@ -2236,7 +2240,8 @@ pub struct Scan<I, St, F> {
f: F,
/// The current internal state to be passed to the closure next.
#[unstable(feature = "core")]
#[unstable(feature = "scan_state",
reason = "public fields are otherwise rare in the stdlib")]
pub state: St,
}
@ -2406,7 +2411,7 @@ impl<I> DoubleEndedIterator for Fuse<I> where I: DoubleEndedIterator {
}
// Allow RandomAccessIterators to be fused without affecting random-access behavior
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
#[inline]
fn indexable(&self) -> usize {
@ -2427,7 +2432,7 @@ impl<I> Fuse<I> {
/// `.next_back()` will call the underlying iterator again even if it
/// previously returned `None`.
#[inline]
#[unstable(feature = "core", reason = "seems marginal")]
#[unstable(feature = "iter_reset_fuse", reason = "seems marginal")]
pub fn reset_fuse(&mut self) {
self.done = false
}
@ -2481,7 +2486,7 @@ impl<I: DoubleEndedIterator, F> DoubleEndedIterator for Inspect<I, F>
}
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
where F: FnMut(&I::Item),
{
@ -2531,16 +2536,16 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
/// println!("{}", i);
/// }
/// ```
#[unstable(feature = "core")]
#[unstable(feature = "iter_unfold")]
#[derive(Clone)]
pub struct Unfold<St, F> {
f: F,
/// Internal state that will be passed to the closure on the next iteration
#[unstable(feature = "core")]
#[unstable(feature = "iter_unfold")]
pub state: St,
}
#[unstable(feature = "core")]
#[unstable(feature = "iter_unfold")]
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
/// Creates a new iterator with the specified closure as the "iterator
/// function" and an initial state to eventually pass to the closure
@ -2767,7 +2772,7 @@ impl<A> Iterator for StepBy<A, RangeFrom<A>> where
/// An iterator over the range [start, stop]
#[derive(Clone)]
#[unstable(feature = "core",
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters")]
pub struct RangeInclusive<A> {
range: ops::Range<A>,
@ -2776,7 +2781,7 @@ pub struct RangeInclusive<A> {
/// Returns an iterator over the range [start, stop].
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters")]
pub fn range_inclusive<A>(start: A, stop: A) -> RangeInclusive<A>
where A: Step + One + Clone
@ -2787,7 +2792,7 @@ pub fn range_inclusive<A>(start: A, stop: A) -> RangeInclusive<A>
}
}
#[unstable(feature = "core",
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters")]
impl<A> Iterator for RangeInclusive<A> where
A: PartialEq + Step + One + Clone,
@ -2820,7 +2825,7 @@ impl<A> Iterator for RangeInclusive<A> where
}
}
#[unstable(feature = "core",
#[unstable(feature = "range_inclusive",
reason = "likely to be replaced by range notation and adapters")]
impl<A> DoubleEndedIterator for RangeInclusive<A> where
A: PartialEq + Step + One + Clone,
@ -2973,7 +2978,7 @@ impl<A: Clone> DoubleEndedIterator for Repeat<A> {
fn next_back(&mut self) -> Option<A> { self.idx(0) }
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<A: Clone> RandomAccessIterator for Repeat<A> {
#[inline]
fn indexable(&self) -> usize { usize::MAX }
@ -2985,12 +2990,12 @@ type IterateState<T, F> = (F, Option<T>, bool);
/// An iterator that repeatedly applies a given function, starting
/// from a given seed value.
#[unstable(feature = "core")]
#[unstable(feature = "iter_iterate")]
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
/// Creates a new iterator that produces an infinite sequence of
/// repeated applications of the given function `f`.
#[unstable(feature = "core")]
#[unstable(feature = "iter_iterate")]
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
T: Clone,
F: FnMut(T) -> T,
@ -3123,7 +3128,7 @@ pub fn once<T>(value: T) -> Once<T> {
///
/// If two sequences are equal up until the point where one ends,
/// the shorter sequence compares less.
#[unstable(feature = "core", reason = "needs review and revision")]
#[unstable(feature = "iter_order", reason = "needs review and revision")]
pub mod order {
use cmp;
use cmp::{Eq, Ord, PartialOrd, PartialEq};

View File

@ -49,7 +49,9 @@
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "core"]
#![unstable(feature = "core")]
#![unstable(feature = "core",
reason = "the libcore library has not yet been scrutinized for \
stabilization in terms of structure and naming")]
#![staged_api]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
@ -63,7 +65,8 @@
#![allow(raw_pointer_derive)]
#![deny(missing_docs)]
#![feature(intrinsics, lang_items)]
#![feature(intrinsics)]
#![feature(lang_items)]
#![feature(on_unimplemented)]
#![feature(simd)]
#![feature(staged_api)]
@ -75,6 +78,7 @@
#![feature(reflect)]
#![feature(custom_attribute)]
#![feature(const_fn)]
#![feature(allow_internal_unstable)]
#[macro_use]
mod macros;

View File

@ -10,6 +10,7 @@
/// Entry point of thread panic, for details, see std::macros
#[macro_export]
#[allow_internal_unstable]
macro_rules! panic {
() => (
panic!("explicit panic")

View File

@ -54,7 +54,7 @@ pub trait Sized {
}
/// Types that can be "unsized" to a dynamically sized type.
#[unstable(feature = "core")]
#[unstable(feature = "unsize")]
#[lang="unsize"]
pub trait Unsize<T> {
// Empty.
@ -223,7 +223,10 @@ impl<T> !Sync for *mut T { }
/// ensure that they are never copied, even if they lack a destructor.
#[unstable(feature = "core",
reason = "likely to change with new variance strategy")]
#[deprecated(since = "1.2.0",
reason = "structs are by default not copyable")]
#[lang = "no_copy_bound"]
#[allow(deprecated)]
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct NoCopy;
@ -410,7 +413,8 @@ mod impls {
///
/// [1]: http://en.wikipedia.org/wiki/Parametricity
#[rustc_reflect_like]
#[unstable(feature = "core", reason = "requires RFC and more experience")]
#[unstable(feature = "reflect_marker",
reason = "requires RFC and more experience")]
#[allow(deprecated)]
#[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \
ensure all type parameters are bounded by `Any`"]

View File

@ -459,7 +459,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
/// Transforms lifetime of the second pointer to match the first.
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "copy_lifetime",
reason = "this function may be removed in the future due to its \
questionable utility")]
pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,
@ -469,7 +469,7 @@ pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,
/// Transforms lifetime of the second mutable pointer to match the first.
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "copy_lifetime",
reason = "this function may be removed in the future due to its \
questionable utility")]
pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,

View File

@ -9,6 +9,8 @@
// except according to those terms.
//! Exposes the NonZero lang item which provides optimization hints.
#![unstable(feature = "nonzero",
reason = "needs an RFC to flesh out the design")]
use marker::Sized;
use ops::{CoerceUnsized, Deref};
@ -33,7 +35,6 @@ unsafe impl Zeroable for u64 {}
/// NULL or 0 that might allow certain optimizations.
#[lang = "non_zero"]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
#[unstable(feature = "core")]
pub struct NonZero<T: Zeroable>(T);
impl<T: Zeroable> NonZero<T> {

View File

@ -71,7 +71,8 @@ pub mod consts {
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
/// pi * 2.0
#[unstable(feature = "core", reason = "unclear naming convention/usefulness")]
#[unstable(feature = "float_consts",
reason = "unclear naming convention/usefulness")]
pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32;
/// pi/2.0
@ -135,7 +136,6 @@ pub mod consts {
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
}
#[unstable(feature = "core", reason = "trait is unstable")]
impl Float for f32 {
#[inline]
fn nan() -> f32 { NAN }

View File

@ -71,7 +71,8 @@ pub mod consts {
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
/// pi * 2.0
#[unstable(feature = "core", reason = "unclear naming convention/usefulness")]
#[unstable(feature = "float_consts",
reason = "unclear naming convention/usefulness")]
pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64;
/// pi/2.0
@ -135,7 +136,6 @@ pub mod consts {
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
}
#[unstable(feature = "core", reason = "trait is unstable")]
impl Float for f64 {
#[inline]
fn nan() -> f64 { NAN }

View File

@ -126,6 +126,8 @@ functions.
// while this is extensively documented, this is in principle private which is
// only made public for testing. do not expose us.
#![doc(hidden)]
#![unstable(feature = "flt2dec",
reason = "internal routines only exposed for testing")]
use prelude::*;
use i16;

View File

@ -14,11 +14,13 @@ macro_rules! int_module { ($T:ty, $bits:expr) => (
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `mem::size_of` function.
#[unstable(feature = "core")]
#[unstable(feature = "num_bits_bytes",
reason = "may want to be an associated function")]
pub const BITS : usize = $bits;
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
// calling the `mem::size_of` function.
#[unstable(feature = "core")]
#[unstable(feature = "num_bits_bytes",
reason = "may want to be an associated function")]
pub const BYTES : usize = ($bits / 8);
// FIXME(#11621): Should be deprecated once CTFE is implemented in favour of

View File

@ -41,10 +41,7 @@ use str::{FromStr, StrExt};
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)]
pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T);
#[unstable(feature = "core", reason = "may be removed or relocated")]
pub mod wrapping;
#[unstable(feature = "core", reason = "internal routines only exposed for testing")]
pub mod flt2dec;
/// Types that have a "zero" value.
@ -471,7 +468,7 @@ macro_rules! int_impl {
/// to `-MIN`, a positive value that is too large to represent
/// in the type. In such a case, this function returns `MIN`
/// itself..
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_div(self, rhs: Self) -> Self {
self.overflowing_div(rhs).0
@ -484,7 +481,7 @@ macro_rules! int_impl {
/// implementation artifacts make `x % y` illegal for `MIN /
/// -1` on a signed type illegal (where `MIN` is the negative
/// minimal value). In such a case, this function returns `0`.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_rem(self, rhs: Self) -> Self {
self.overflowing_rem(rhs).0
@ -498,7 +495,7 @@ macro_rules! int_impl {
/// negative minimal value for the type); this is a positive
/// value that is too large to represent in the type. In such
/// a case, this function returns `MIN` itself.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
@ -507,7 +504,7 @@ macro_rules! int_impl {
/// Panic-free bitwise shift-left; yields `self << mask(rhs)`,
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_shl(self, rhs: u32) -> Self {
self.overflowing_shl(rhs).0
@ -516,7 +513,7 @@ macro_rules! int_impl {
/// Panic-free bitwise shift-left; yields `self >> mask(rhs)`,
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_shr(self, rhs: u32) -> Self {
self.overflowing_shr(rhs).0
@ -1041,7 +1038,7 @@ macro_rules! uint_impl {
/// to `-MIN`, a positive value that is too large to represent
/// in the type. In such a case, this function returns `MIN`
/// itself..
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_div(self, rhs: Self) -> Self {
self.overflowing_div(rhs).0
@ -1054,7 +1051,7 @@ macro_rules! uint_impl {
/// implementation artifacts make `x % y` illegal for `MIN /
/// -1` on a signed type illegal (where `MIN` is the negative
/// minimal value). In such a case, this function returns `0`.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_rem(self, rhs: Self) -> Self {
self.overflowing_rem(rhs).0
@ -1068,7 +1065,7 @@ macro_rules! uint_impl {
/// negative minimal value for the type); this is a positive
/// value that is too large to represent in the type. In such
/// a case, this function returns `MIN` itself.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_neg(self) -> Self {
self.overflowing_neg().0
@ -1077,7 +1074,7 @@ macro_rules! uint_impl {
/// Panic-free bitwise shift-left; yields `self << mask(rhs)`,
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_shl(self, rhs: u32) -> Self {
self.overflowing_shl(rhs).0
@ -1086,7 +1083,7 @@ macro_rules! uint_impl {
/// Panic-free bitwise shift-left; yields `self >> mask(rhs)`,
/// where `mask` removes any high-order bits of `rhs` that
/// would cause the shift to exceed the bitwidth of the type.
#[unstable(feature = "core", since = "1.0.0")]
#[unstable(feature = "num_wrapping")]
#[inline(always)]
pub fn wrapping_shr(self, rhs: u32) -> Self {
self.overflowing_shr(rhs).0
@ -1262,6 +1259,8 @@ pub enum FpCategory {
/// A built-in floating point number.
#[doc(hidden)]
#[unstable(feature = "core_float",
reason = "stable interface is via `impl f{32,64}` in later crates")]
pub trait Float {
/// Returns the NaN value.
fn nan() -> Self;
@ -1512,7 +1511,9 @@ enum IntErrorKind {
}
impl ParseIntError {
#[unstable(feature = "core", reason = "available through Error trait")]
#[unstable(feature = "int_error_internals",
reason = "available through Error trait and this method should \
not be exposed publicly")]
pub fn description(&self) -> &str {
match self.kind {
IntErrorKind::Empty => "cannot parse integer from empty string",
@ -1535,10 +1536,14 @@ impl fmt::Display for ParseIntError {
#[stable(feature = "rust1", since = "1.0.0")]
pub struct ParseFloatError {
#[doc(hidden)]
#[unstable(feature = "float_error_internals",
reason = "should not be exposed publicly")]
pub __kind: FloatErrorKind
}
#[derive(Debug, Clone, PartialEq)]
#[unstable(feature = "float_error_internals",
reason = "should not be exposed publicly")]
pub enum FloatErrorKind {
Empty,
Invalid,

View File

@ -12,9 +12,11 @@
macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
#[unstable(feature = "core")]
#[unstable(feature = "num_bits_bytes",
reason = "may want to be an associated function")]
pub const BITS : usize = $bits;
#[unstable(feature = "core")]
#[unstable(feature = "num_bits_bytes",
reason = "may want to be an associated function")]
pub const BYTES : usize = ($bits / 8);
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -10,6 +10,7 @@
#![allow(missing_docs)]
#![allow(deprecated)]
#![unstable(feature = "wrapping", reason = "may be removed or relocated")]
use super::Wrapping;
@ -30,7 +31,6 @@ use intrinsics::{i64_mul_with_overflow, u64_mul_with_overflow};
use ::{i8,i16,i32,i64};
#[unstable(feature = "core", reason = "may be removed, renamed, or relocated")]
pub trait OverflowingOps {
fn overflowing_add(self, rhs: Self) -> (Self, bool);
fn overflowing_sub(self, rhs: Self) -> (Self, bool);

View File

@ -29,8 +29,8 @@
//!
//! # Examples
//!
//! This example creates a `Point` struct that implements `Add` and `Sub`, and then
//! demonstrates adding and subtracting two `Point`s.
//! This example creates a `Point` struct that implements `Add` and `Sub`, and
//! then demonstrates adding and subtracting two `Point`s.
//!
//! ```rust
//! use std::ops::{Add, Sub};
@ -62,21 +62,21 @@
//! }
//! ```
//!
//! See the documentation for each trait for a minimum implementation that prints
//! something to the screen.
//! See the documentation for each trait for a minimum implementation that
//! prints something to the screen.
#![stable(feature = "rust1", since = "1.0.0")]
use marker::{Sized, Unsize};
use fmt;
/// The `Drop` trait is used to run some code when a value goes out of scope. This
/// is sometimes called a 'destructor'.
/// The `Drop` trait is used to run some code when a value goes out of scope.
/// This is sometimes called a 'destructor'.
///
/// # Examples
///
/// A trivial implementation of `Drop`. The `drop` method is called when `_x` goes
/// out of scope, and therefore `main` prints `Dropping!`.
/// A trivial implementation of `Drop`. The `drop` method is called when `_x`
/// goes out of scope, and therefore `main` prints `Dropping!`.
///
/// ```
/// struct HasDrop;
@ -103,8 +103,7 @@ pub trait Drop {
// based on "op T" where T is expected to be `Copy`able
macro_rules! forward_ref_unop {
(impl $imp:ident, $method:ident for $t:ty) => {
#[unstable(feature = "core",
reason = "recently added, waiting for dust to settle")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> $imp for &'a $t {
type Output = <$t as $imp>::Output;
@ -120,8 +119,7 @@ macro_rules! forward_ref_unop {
// based on "T op U" where T and U are expected to be `Copy`able
macro_rules! forward_ref_binop {
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
#[unstable(feature = "core",
reason = "recently added, waiting for dust to settle")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> $imp<$u> for &'a $t {
type Output = <$t as $imp<$u>>::Output;
@ -131,8 +129,7 @@ macro_rules! forward_ref_binop {
}
}
#[unstable(feature = "core",
reason = "recently added, waiting for dust to settle")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> $imp<&'a $u> for $t {
type Output = <$t as $imp<$u>>::Output;
@ -142,8 +139,7 @@ macro_rules! forward_ref_binop {
}
}
#[unstable(feature = "core",
reason = "recently added, waiting for dust to settle")]
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> $imp<&'a $u> for &'b $t {
type Output = <$t as $imp<$u>>::Output;
@ -1210,7 +1206,7 @@ mod impls {
/// Trait that indicates that this is a pointer or a wrapper for one,
/// where unsizing can be performed on the pointee.
#[unstable(feature = "core")]
#[unstable(feature = "coerce_unsized")]
#[lang="coerce_unsized"]
pub trait CoerceUnsized<T> {
// Empty.

View File

@ -285,7 +285,7 @@ impl<T> Option<T> {
/// assert_eq!(x, Some("Dirt"));
/// ```
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "as_slice",
reason = "waiting for mut conventions")]
pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
match *self {

View File

@ -29,6 +29,9 @@
//! library, but the location of this may change over time.
#![allow(dead_code, missing_docs)]
#![unstable(feature = "core_panic",
reason = "internal details of the implementation of the `panic!` \
and related macros")]
use fmt;

View File

@ -24,6 +24,10 @@
//! use core::prelude::*;
//! ```
#![unstable(feature = "core_prelude",
reason = "the libcore prelude has not been scrutinized and \
stabilized yet")]
// Reexported core operators
pub use marker::{Copy, Send, Sized, Sync};
pub use ops::{Drop, Fn, FnMut, FnOnce};
@ -32,7 +36,6 @@ pub use ops::{Drop, Fn, FnMut, FnOnce};
pub use mem::drop;
// Reexported types and traits
pub use char::CharExt;
pub use clone::Clone;
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};

View File

@ -204,7 +204,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
///
/// This is unsafe for the same reasons that `read` is unsafe.
#[inline(always)]
#[unstable(feature = "core",
#[unstable(feature = "read_and_zero",
reason = "may play a larger role in std::ptr future extensions")]
pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
// Copy the data out from `dest`:
@ -219,7 +219,7 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
/// Variant of read_and_zero that writes the specific drop-flag byte
/// (which may be more appropriate than zero).
#[inline(always)]
#[unstable(feature = "core",
#[unstable(feature = "filling_drop",
reason = "may play a larger role in std::ptr future extensions")]
pub unsafe fn read_and_drop<T>(dest: *mut T) -> T {
// Copy the data out from `dest`:
@ -267,9 +267,10 @@ impl<T: ?Sized> *const T {
/// null-safety, it is important to note that this is still an unsafe
/// operation because the returned value could be pointing to invalid
/// memory.
#[unstable(feature = "core",
reason = "Option is not clearly the right return type, and we may want \
to tie the return lifetime to a borrow of the raw pointer")]
#[unstable(feature = "ptr_as_ref",
reason = "Option is not clearly the right return type, and we \
may want to tie the return lifetime to a borrow of \
the raw pointer")]
#[inline]
pub unsafe fn as_ref<'a>(&self) -> Option<&'a T> where T: Sized {
if self.is_null() {
@ -314,9 +315,10 @@ impl<T: ?Sized> *mut T {
/// null-safety, it is important to note that this is still an unsafe
/// operation because the returned value could be pointing to invalid
/// memory.
#[unstable(feature = "core",
reason = "Option is not clearly the right return type, and we may want \
to tie the return lifetime to a borrow of the raw pointer")]
#[unstable(feature = "ptr_as_ref",
reason = "Option is not clearly the right return type, and we \
may want to tie the return lifetime to a borrow of \
the raw pointer")]
#[inline]
pub unsafe fn as_ref<'a>(&self) -> Option<&'a T> where T: Sized {
if self.is_null() {
@ -347,7 +349,7 @@ impl<T: ?Sized> *mut T {
///
/// As with `as_ref`, this is unsafe because it cannot verify the validity
/// of the returned pointer.
#[unstable(feature = "core",
#[unstable(feature = "ptr_as_ref",
reason = "return value does not necessarily convey all possible \
information")]
#[inline]
@ -507,7 +509,7 @@ impl<T: ?Sized> PartialOrd for *mut T {
/// modified without a unique path to the `Unique` reference. Useful
/// for building abstractions like `Vec<T>` or `Box<T>`, which
/// internally use raw pointers to manage the memory that they own.
#[unstable(feature = "unique")]
#[unstable(feature = "unique", reason = "needs an RFC to flesh out design")]
pub struct Unique<T: ?Sized> {
pointer: NonZero<*const T>,
_marker: PhantomData<T>,
@ -527,21 +529,19 @@ unsafe impl<T: Send + ?Sized> Send for Unique<T> { }
#[unstable(feature = "unique")]
unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { }
#[unstable(feature = "unique")]
impl<T: ?Sized> Unique<T> {
/// Creates a new `Unique`.
#[unstable(feature = "unique")]
pub unsafe fn new(ptr: *mut T) -> Unique<T> {
Unique { pointer: NonZero::new(ptr), _marker: PhantomData }
}
/// Dereferences the content.
#[unstable(feature = "unique")]
pub unsafe fn get(&self) -> &T {
&**self.pointer
}
/// Mutably dereferences the content.
#[unstable(feature = "unique")]
pub unsafe fn get_mut(&mut self) -> &mut T {
&mut ***self
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
#![allow(missing_docs)]
#![unstable(feature = "core")]
#![unstable(feature = "raw")]
//! Contains struct definitions for the layout of compiler built-in types.
//!

View File

@ -434,7 +434,7 @@ impl<T, E> Result<T, E> {
/// assert!(x.as_mut_slice().is_empty());
/// ```
#[inline]
#[unstable(feature = "core",
#[unstable(feature = "as_slice",
reason = "waiting for mut conventions")]
pub fn as_mut_slice(&mut self) -> &mut [T] {
match *self {
@ -966,7 +966,8 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
/// If an `Err` is encountered, it is immediately returned.
/// Otherwise, the folded value is returned.
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "result_fold",
reason = "unclear if this function should exist")]
pub fn fold<T,
V,
E,

View File

@ -33,10 +33,12 @@
//! These are all experimental. The interface may change entirely, without
//! warning.
#![unstable(feature = "core_simd",
reason = "needs an RFC to flesh out the design")]
#![allow(non_camel_case_types)]
#![allow(missing_docs)]
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
@ -45,26 +47,22 @@ pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
pub i8, pub i8, pub i8, pub i8,
pub i8, pub i8, pub i8, pub i8);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
pub i16, pub i16, pub i16, pub i16);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i64x2(pub i64, pub i64);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
@ -73,32 +71,27 @@ pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
pub u8, pub u8, pub u8, pub u8,
pub u8, pub u8, pub u8, pub u8);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
pub u16, pub u16, pub u16, pub u16);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u64x2(pub u64, pub u64);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Clone, Debug)]
#[repr(C)]

View File

@ -64,6 +64,8 @@ use raw::Slice as RawSlice;
/// Extension methods for slices.
#[allow(missing_docs)] // docs in libcollections
#[doc(hidden)]
#[unstable(feature = "core_slice_ext",
reason = "stable interface provided by `impl [T]` in later crates")]
pub trait SliceExt {
type Item;
@ -148,7 +150,6 @@ macro_rules! slice_ref {
}};
}
#[unstable(feature = "core")]
impl<T> SliceExt for [T] {
type Item = T;
@ -256,7 +257,6 @@ impl<T> SliceExt for [T] {
self.repr().data
}
#[unstable(feature = "core")]
fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where
F: FnMut(&T) -> Ordering
{
@ -437,12 +437,10 @@ impl<T> SliceExt for [T] {
m >= n && needle == &self[m-n..]
}
#[unstable(feature = "core")]
fn binary_search(&self, x: &T) -> Result<usize, usize> where T: Ord {
self.binary_search_by(|p| p.cmp(x))
}
#[unstable(feature = "core")]
fn next_permutation(&mut self) -> bool where T: Ord {
// These cases only have 1 permutation each, so we can't do anything.
if self.len() < 2 { return false; }
@ -473,7 +471,6 @@ impl<T> SliceExt for [T] {
true
}
#[unstable(feature = "core")]
fn prev_permutation(&mut self) -> bool where T: Ord {
// These cases only have 1 permutation each, so we can't do anything.
if self.len() < 2 { return false; }
@ -774,7 +771,7 @@ impl<'a, T> Iter<'a, T> {
///
/// This has the same lifetime as the original slice, and so the
/// iterator can continue to be used while this exists.
#[unstable(feature = "core")]
#[unstable(feature = "iter_to_slice")]
pub fn as_slice(&self) -> &'a [T] {
make_slice!(self.ptr, self.end)
}
@ -804,7 +801,7 @@ impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } }
}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<'a, T> RandomAccessIterator for Iter<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -842,7 +839,7 @@ impl<'a, T> IterMut<'a, T> {
/// to consume the iterator. Consider using the `Slice` and
/// `SliceMut` implementations for obtaining slices with more
/// restricted lifetimes that do not consume the iterator.
#[unstable(feature = "core")]
#[unstable(feature = "iter_to_slice")]
pub fn into_slice(self) -> &'a mut [T] {
make_mut_slice!(self.ptr, self.end)
}
@ -1176,7 +1173,7 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<'a, T> RandomAccessIterator for Windows<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -1263,7 +1260,7 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
#[unstable(feature = "core", reason = "trait is experimental")]
#[unstable(feature = "iter_idx", reason = "trait is experimental")]
impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
#[inline]
fn indexable(&self) -> usize {
@ -1349,7 +1346,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}
//
/// Converts a pointer to A into a slice of length 1 (without copying).
#[unstable(feature = "core")]
#[unstable(feature = "ref_slice")]
pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
unsafe {
from_raw_parts(s, 1)
@ -1357,7 +1354,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
}
/// Converts a pointer to A into a slice of length 1 (without copying).
#[unstable(feature = "core")]
#[unstable(feature = "ref_slice")]
pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
unsafe {
from_raw_parts_mut(s, 1)
@ -1415,7 +1412,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
//
/// Operations on `[u8]`.
#[unstable(feature = "core", reason = "needs review")]
#[unstable(feature = "slice_bytes", reason = "needs review")]
pub mod bytes {
use ptr;
use slice::SliceExt;
@ -1503,7 +1500,7 @@ impl<T: PartialOrd> PartialOrd for [T] {
}
/// Extension methods for slices containing integers.
#[unstable(feature = "core")]
#[unstable(feature = "int_slice")]
pub trait IntSliceExt<U, S> {
/// Converts the slice to an immutable slice of unsigned integers with the same width.
fn as_unsigned<'a>(&'a self) -> &'a [U];
@ -1518,7 +1515,7 @@ pub trait IntSliceExt<U, S> {
macro_rules! impl_int_slice {
($u:ty, $s:ty, $t:ty) => {
#[unstable(feature = "core")]
#[unstable(feature = "int_slice")]
impl IntSliceExt<$u, $s> for [$t] {
#[inline]
fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }

View File

@ -13,6 +13,7 @@
//! For more details, see std::str
#![doc(primitive = "str")]
#![stable(feature = "rust1", since = "1.0.0")]
use self::OldSearcher::{TwoWay, TwoWayLong};
use self::pattern::Pattern;
@ -191,7 +192,7 @@ fn unwrap_or_0(opt: Option<&u8>) -> u8 {
/// Reads the next code point out of a byte iterator (assuming a
/// UTF-8-like encoding).
#[unstable(feature = "core")]
#[unstable(feature = "str_internals")]
#[inline]
pub fn next_code_point(bytes: &mut slice::Iter<u8>) -> Option<u32> {
// Decode UTF-8
@ -226,7 +227,7 @@ pub fn next_code_point(bytes: &mut slice::Iter<u8>) -> Option<u32> {
/// Reads the last code point out of a byte iterator (assuming a
/// UTF-8-like encoding).
#[unstable(feature = "core")]
#[unstable(feature = "str_internals")]
#[inline]
pub fn next_code_point_reverse(bytes: &mut slice::Iter<u8>) -> Option<u32> {
// Decode UTF-8
@ -738,7 +739,7 @@ generate_pattern_iterators! {
#[doc="Created with the method `.rmatch_indices()`."]
struct RMatchIndices;
stability:
#[unstable(feature = "core",
#[unstable(feature = "str_internals",
reason = "type may be removed or have its iterator impl changed")]
internal:
MatchIndicesInternal yielding ((usize, usize));
@ -779,7 +780,7 @@ generate_pattern_iterators! {
#[doc="Created with the method `.rmatches()`."]
struct RMatches;
stability:
#[unstable(feature = "core", reason = "type got recently added")]
#[unstable(feature = "str_internals", reason = "type got recently added")]
internal:
MatchesInternal yielding (&'a str);
delegate double ended;
@ -1470,6 +1471,8 @@ mod traits {
/// Methods for string slices
#[allow(missing_docs)]
#[doc(hidden)]
#[unstable(feature = "core_str_ext",
reason = "stable interface provided by `impl str` in later crates")]
pub trait StrExt {
// NB there are no docs here are they're all located on the StrExt trait in
// libcollections, not here.
@ -1870,7 +1873,7 @@ impl AsRef<[u8]> for str {
/// Pluck a code point out of a UTF-8-like byte slice and return the
/// index of the next code point.
#[inline]
#[unstable(feature = "core")]
#[unstable(feature = "str_internals")]
pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) {
if bytes[i] < 128 {
return (bytes[i] as u32, i + 1);

View File

@ -13,6 +13,9 @@
//! For more details, see the traits `Pattern`, `Searcher`,
//! `ReverseSearcher` and `DoubleEndedSearcher`.
#![unstable(feature = "pattern",
reason = "API not fully fleshed out and ready to be stabilized")]
use prelude::*;
// Pattern

View File

@ -1,13 +0,0 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <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.
//! Types dealing with unsafe actions.
use marker;

View File

@ -172,8 +172,7 @@
#![feature(alloc)]
#![feature(staged_api)]
#![feature(box_syntax)]
#![feature(core)]
#![feature(const_fn)]
#![feature(iter_cmp)]
#![feature(std_misc)]
use std::boxed;

View File

@ -29,7 +29,11 @@
#![unstable(feature = "rand",
reason = "use `rand` from crates.io")]
#![feature(core)]
#![feature(core_float)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(no_std)]
#![feature(num_bits_bytes)]
#![feature(staged_api)]
#![feature(step_by)]

View File

@ -123,9 +123,9 @@
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![feature(core)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(slice_bytes)]
#![cfg_attr(test, feature(test))]

View File

@ -30,21 +30,26 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(const_fn)]
#![feature(core)]
#![feature(duration)]
#![feature(duration_span)]
#![feature(fs_canonicalize)]
#![feature(hash)]
#![feature(hash_default)]
#![feature(into_cow)]
#![feature(iter_sum)]
#![feature(libc)]
#![feature(num_bits_bytes)]
#![feature(path_ext)]
#![feature(quote)]
#![feature(range_inclusive)]
#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_bytes)]
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(wrapping)]
#![cfg_attr(test, feature(test))]
#![allow(trivial_casts)]

View File

@ -34,14 +34,14 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rand)]
#![feature(path_ext)]
#![feature(step_by)]
#![feature(libc)]
#![feature(fs_canonicalize)]
#![feature(libc)]
#![feature(path_ext)]
#![feature(rand)]
#![feature(rustc_private)]
#![feature(slice_bytes)]
#![feature(staged_api)]
#![feature(step_by)]
#![cfg_attr(test, feature(test, rand))]
extern crate syntax;

View File

@ -32,9 +32,10 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![cfg_attr(stage0, feature(collections))]
#![feature(core)]
#![feature(collections)]
#![feature(num_bits_bytes)]
#![feature(quote)]
#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]

View File

@ -29,17 +29,23 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![feature(const_fn)]
#![feature(fs)]
#![feature(iter_cmp)]
#![feature(iter_sum)]
#![feature(iter_unfold)]
#![feature(libc)]
#![feature(path_ext)]
#![feature(path_ext)]
#![feature(path_relative_from)]
#![feature(path_relative_from)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(unicode)]
#![feature(path_ext)]
#![feature(path_relative_from)]
#![feature(std_misc)]
#![feature(unicode)]
#![feature(unicode)]
#![allow(trivial_casts)]

View File

@ -78,8 +78,10 @@ This API is completely unstable and subject to change.
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(collections, collections_drain)]
#![feature(core)]
#![feature(iter_cmp)]
#![feature(iter_sum)]
#![feature(quote)]
#![feature(ref_slice)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]

View File

@ -24,18 +24,24 @@
#![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "rustc_unicode"]
#![unstable(feature = "unicode")]
#![feature(lang_items)]
#![feature(staged_api)]
#![staged_api]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![feature(no_std)]
html_playground_url = "http://play.rust-lang.org/",
test(no_crate_inject))]
#![no_std]
#![feature(core)]
#![doc(test(no_crate_inject))]
#![feature(core_char_ext)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(iter_sum)]
#![feature(lang_items)]
#![feature(no_std)]
#![feature(staged_api)]
extern crate core;

View File

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

View File

@ -77,7 +77,7 @@ pub trait Error: Debug + Display + Reflect {
/// Get the `TypeId` of `self`
#[doc(hidden)]
#[unstable(feature = "core",
#[unstable(feature = "error_type_id",
reason = "unclear whether to commit to this public implementation detail")]
fn type_id(&self) -> TypeId where Self: 'static {
TypeId::of::<Self>()

View File

@ -99,38 +99,52 @@
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/",
html_playground_url = "http://play.rust-lang.org/")]
#![doc(test(no_crate_inject, attr(deny(warnings))))]
#![doc(test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
html_playground_url = "http://play.rust-lang.org/",
test(no_crate_inject, attr(deny(warnings))),
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
#![feature(alloc)]
#![feature(allow_internal_unstable)]
#![feature(associated_consts)]
#![feature(borrow_state)]
#![feature(box_syntax)]
#![feature(char_internals)]
#![feature(collections)]
#![feature(core)]
#![feature(const_fn)]
#![feature(core)]
#![feature(core_float)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_simd)]
#![feature(fnbox)]
#![feature(int_error_internals)]
#![feature(into_cow)]
#![feature(iter_order)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(linkage, thread_local, asm)]
#![feature(macro_reexport)]
#![feature(no_std)]
#![feature(num_bits_bytes)]
#![feature(optin_builtin_traits)]
#![feature(rand)]
#![feature(raw)]
#![feature(reflect_marker)]
#![feature(slice_bytes)]
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unique)]
#![feature(unsafe_no_drop_flag, filling_drop)]
#![feature(wrapping)]
#![feature(zero_one)]
#![cfg_attr(test, feature(float_from_str_radix))]
#![cfg_attr(test, feature(test, rustc_private, std_misc))]
// Don't link to std. We are std.
#![feature(no_std)]
#![no_std]
#![allow(trivial_casts)]

View File

@ -28,8 +28,9 @@
#![feature(associated_consts)]
#![feature(collections)]
#![feature(collections_drain)]
#![feature(core)]
#![feature(filling_drop)]
#![feature(libc)]
#![feature(ref_slice)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(str_char)]