about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2015-02-18 23:50:21 +1100
commitdfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (patch)
treee9c32f2e58b3462a23dd9c472d2f236640b78811 /src/libcore
parent6c065fc8cb036785f61ff03e05c1563cbb2dd081 (diff)
parent47f91a9484eceef10536d4caac6ef578cd254567 (diff)
downloadrust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.tar.gz
rust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.zip
Manual merge of #22475 - alexcrichton:rollup, r=alexcrichton
 One windows bot failed spuriously.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/array.rs24
-rw-r--r--src/libcore/atomic.rs4
-rw-r--r--src/libcore/cell.rs25
-rw-r--r--src/libcore/cmp.rs273
-rw-r--r--src/libcore/fmt/mod.rs1
-rw-r--r--src/libcore/iter.rs30
-rw-r--r--src/libcore/lib.rs22
-rw-r--r--src/libcore/marker.rs18
-rw-r--r--src/libcore/mem.rs16
-rw-r--r--src/libcore/nonzero.rs4
-rw-r--r--src/libcore/option.rs2
-rw-r--r--src/libcore/slice.rs24
12 files changed, 269 insertions, 174 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs
index abaa7594d04..838ca4e478b 100644
--- a/src/libcore/array.rs
+++ b/src/libcore/array.rs
@@ -48,17 +48,7 @@ macro_rules! array_impls {
                 }
             }
 
-            // NOTE(stage0): remove impl after a snapshot
-            #[cfg(stage0)]
-            impl<'a, T> IntoIterator for &'a [T; $N] {
-                type IntoIter = Iter<'a, T>;
-
-                fn into_iter(self) -> Iter<'a, T> {
-                    self.iter()
-                }
-            }
-
-            #[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+            #[stable(feature = "rust1", since = "1.0.0")]
             impl<'a, T> IntoIterator for &'a [T; $N] {
                 type Item = &'a T;
                 type IntoIter = Iter<'a, T>;
@@ -68,17 +58,7 @@ macro_rules! array_impls {
                 }
             }
 
-            // NOTE(stage0): remove impl after a snapshot
-            #[cfg(stage0)]
-            impl<'a, T> IntoIterator for &'a mut [T; $N] {
-                type IntoIter = IterMut<'a, T>;
-
-                fn into_iter(self) -> IterMut<'a, T> {
-                    self.iter_mut()
-                }
-            }
-
-            #[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+            #[stable(feature = "rust1", since = "1.0.0")]
             impl<'a, T> IntoIterator for &'a mut [T; $N] {
                 type Item = &'a mut T;
                 type IntoIter = IterMut<'a, T>;
diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs
index 32e8cffcae4..05d864accc1 100644
--- a/src/libcore/atomic.rs
+++ b/src/libcore/atomic.rs
@@ -42,13 +42,13 @@
 //! ```
 //! use std::sync::Arc;
 //! use std::sync::atomic::{AtomicUsize, Ordering};
-//! use std::thread::Thread;
+//! use std::thread;
 //!
 //! fn main() {
 //!     let spinlock = Arc::new(AtomicUsize::new(1));
 //!
 //!     let spinlock_clone = spinlock.clone();
-//!     Thread::spawn(move|| {
+//!     thread::spawn(move|| {
 //!         spinlock_clone.store(0, Ordering::SeqCst);
 //!     });
 //!
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index cf293ded13f..eb138e6142b 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -78,12 +78,12 @@
 //! use std::cell::RefCell;
 //!
 //! struct Graph {
-//!     edges: Vec<(uint, uint)>,
-//!     span_tree_cache: RefCell<Option<Vec<(uint, uint)>>>
+//!     edges: Vec<(i32, i32)>,
+//!     span_tree_cache: RefCell<Option<Vec<(i32, i32)>>>
 //! }
 //!
 //! impl Graph {
-//!     fn minimum_spanning_tree(&self) -> Vec<(uint, uint)> {
+//!     fn minimum_spanning_tree(&self) -> Vec<(i32, i32)> {
 //!         // Create a new scope to contain the lifetime of the
 //!         // dynamic borrow
 //!         {
@@ -104,7 +104,7 @@
 //!         // This is the major hazard of using `RefCell`.
 //!         self.minimum_spanning_tree()
 //!     }
-//! #   fn calc_span_tree(&self) -> Vec<(uint, uint)> { vec![] }
+//! #   fn calc_span_tree(&self) -> Vec<(i32, i32)> { vec![] }
 //! }
 //! ```
 //!
@@ -125,7 +125,7 @@
 //!
 //! struct RcBox<T> {
 //!     value: T,
-//!     refcount: Cell<uint>
+//!     refcount: Cell<usize>
 //! }
 //!
 //! impl<T> Clone for Rc<T> {
@@ -279,8 +279,8 @@ pub enum BorrowState {
 }
 
 // Values [1, MAX-1] represent the number of `Ref` active
-// (will not outgrow its range since `uint` is the size of the address space)
-type BorrowFlag = uint;
+// (will not outgrow its range since `usize` is the size of the address space)
+type BorrowFlag = usize;
 const UNUSED: BorrowFlag = 0;
 const WRITING: BorrowFlag = -1;
 
@@ -375,9 +375,9 @@ impl<T> RefCell<T> {
     ///
     /// ```
     /// use std::cell::RefCell;
-    /// use std::thread::Thread;
+    /// use std::thread;
     ///
-    /// let result = Thread::scoped(move || {
+    /// let result = thread::spawn(move || {
     ///    let c = RefCell::new(5);
     ///    let m = c.borrow_mut();
     ///
@@ -436,9 +436,9 @@ impl<T> RefCell<T> {
     ///
     /// ```
     /// use std::cell::RefCell;
-    /// use std::thread::Thread;
+    /// use std::thread;
     ///
-    /// let result = Thread::scoped(move || {
+    /// let result = thread::spawn(move || {
     ///    let c = RefCell::new(5);
     ///    let m = c.borrow_mut();
     ///
@@ -649,8 +649,7 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
 ///
 /// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
 /// recommended to access its fields directly, `get` should be used instead.
-#[cfg_attr(stage0, lang="unsafe")]  // NOTE: remove after next snapshot
-#[cfg_attr(not(stage0), lang="unsafe_cell")]
+#[lang="unsafe_cell"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct UnsafeCell<T> {
     /// Wrapped value
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 1ebd2df5814..19ec245300d 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -8,35 +8,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Defines the `PartialOrd` and `PartialEq` comparison traits.
+//! 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.
 //!
-//! For example, to define a type with a customized definition for the PartialEq
-//! operators, you could do the following:
+//! For example, to define a type with a customized definition for the PartialEq operators, you
+//! could do the following:
 //!
-//! ```rust
+//! ```
 //! use core::num::SignedInt;
 //!
-//! // Our type.
-//! struct SketchyNum {
-//!     num : int
+//! struct FuzzyNum {
+//!     num: i32,
 //! }
 //!
-//! // Our implementation of `PartialEq` to support `==` and `!=`.
-//! impl PartialEq for SketchyNum {
+//! impl PartialEq for FuzzyNum {
 //!     // Our custom eq allows numbers which are near each other to be equal! :D
-//!     fn eq(&self, other: &SketchyNum) -> bool {
+//!     fn eq(&self, other: &FuzzyNum) -> bool {
 //!         (self.num - other.num).abs() < 5
 //!     }
 //! }
 //!
 //! // Now these binary operators will work when applied!
-//! assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
-//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
+//! assert!(FuzzyNum { num: 37 } == FuzzyNum { num: 34 });
+//! assert!(FuzzyNum { num: 25 } != FuzzyNum { num: 57 });
 //! ```
 
 #![stable(feature = "rust1", since = "1.0.0")]
@@ -49,24 +47,22 @@ use option::Option::{self, Some, None};
 /// 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:
+/// 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")]
 #[old_orphan_check]
@@ -84,12 +80,15 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
 /// Trait for equality comparisons which are [equivalence relations](
 /// https://en.wikipedia.org/wiki/Equivalence_relation).
 ///
-/// This means, that in addition to `a == b` and `a != b` being strict
-/// inverses, the equality must be (for all `a`, `b` and `c`):
+/// This means, that in addition to `a == b` and `a != b` being strict inverses, the equality must
+/// be (for all `a`, `b` and `c`):
 ///
 /// - reflexive: `a == a`;
 /// - symmetric: `a == b` implies `b == a`; and
 /// - transitive: `a == b` and `b == c` implies `a == c`.
+///
+/// This property cannot be checked by the compiler, and therefore `Eq` implies
+/// `PartialEq`, and has no extra methods.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Eq: PartialEq<Self> {
     // FIXME #13101: this method is used solely by #[deriving] to
@@ -101,10 +100,26 @@ pub trait Eq: PartialEq<Self> {
     // This should never be implemented by hand.
     #[doc(hidden)]
     #[inline(always)]
+    #[stable(feature = "rust1", since = "1.0.0")]
     fn assert_receiver_is_total_eq(&self) {}
 }
 
-/// An ordering is, e.g, a result of a comparison between two values.
+/// An `Ordering` is the result of a comparison between two values.
+///
+/// # Examples
+///
+/// ```
+/// use std::cmp::Ordering;
+///
+/// let result = 1.cmp(&2);
+/// assert_eq!(Ordering::Less, result);
+///
+/// let result = 1.cmp(&1);
+/// assert_eq!(Ordering::Equal, result);
+///
+/// let result = 2.cmp(&1);
+/// assert_eq!(Ordering::Greater, result);
+/// ```
 #[derive(Clone, Copy, PartialEq, Debug)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Ordering {
@@ -120,17 +135,28 @@ pub enum Ordering {
 }
 
 impl Ordering {
-    /// Reverse the `Ordering`, so that `Less` becomes `Greater` and
-    /// vice versa.
+    /// Reverse the `Ordering`.
     ///
-    /// # Example
+    /// * `Less` becomes `Greater`.
+    /// * `Greater` becomes `Less`.
+    /// * `Equal` becomes `Equal`.
     ///
-    /// ```rust
-    /// use std::cmp::Ordering::{Less, Equal, Greater};
+    /// # Examples
     ///
-    /// assert_eq!(Less.reverse(), Greater);
-    /// assert_eq!(Equal.reverse(), Equal);
-    /// assert_eq!(Greater.reverse(), Less);
+    /// Basic behavior:
+    ///
+    /// ```
+    /// use std::cmp::Ordering;
+    ///
+    /// assert_eq!(Ordering::Less.reverse(), Ordering::Greater);
+    /// assert_eq!(Ordering::Equal.reverse(), Ordering::Equal);
+    /// assert_eq!(Ordering::Greater.reverse(), Ordering::Less);
+    /// ```
+    ///
+    /// This method can be used to reverse a comparison:
+    ///
+    /// ```
+    /// use std::cmp::Ordering;
     ///
     /// let mut data: &mut [_] = &mut [2, 10, 5, 8];
     ///
@@ -155,28 +181,27 @@ impl Ordering {
     }
 }
 
-/// Trait for types that form a [total order](
-/// https://en.wikipedia.org/wiki/Total_order).
+/// Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).
 ///
 /// An order is a total order if it is (for all `a`, `b` and `c`):
 ///
-/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is
-///   true; and
-/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
-///   both `==` and `>`.
+/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is true; and
+/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait Ord: Eq + PartialOrd<Self> {
-    /// This method returns an ordering between `self` and `other` values.
+    /// This method returns an `Ordering` between `self` and `other`.
     ///
-    /// By convention, `self.cmp(&other)` returns the ordering matching
-    /// the expression `self <operator> other` if true.  For example:
+    /// By convention, `self.cmp(&other)` returns the ordering matching the expression
+    /// `self <operator> other` if true.
+    ///
+    /// # Examples
     ///
     /// ```
-    /// use std::cmp::Ordering::{Less, Equal, Greater};
+    /// use std::cmp::Ordering;
     ///
-    /// assert_eq!( 5.cmp(&10), Less);     // because 5 < 10
-    /// assert_eq!(10.cmp(&5),  Greater);  // because 10 > 5
-    /// assert_eq!( 5.cmp(&5),  Equal);    // because 5 == 5
+    /// assert_eq!(5.cmp(&10), Ordering::Less);
+    /// assert_eq!(10.cmp(&5), Ordering::Greater);
+    /// assert_eq!(5.cmp(&5), Ordering::Equal);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn cmp(&self, other: &Self) -> Ordering;
@@ -208,30 +233,60 @@ impl PartialOrd for Ordering {
 /// The comparison must satisfy, for all `a`, `b` and `c`:
 ///
 /// - antisymmetry: if `a < b` then `!(a > b)` and vice versa; and
-/// - transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for
-///   both `==` and `>`.
+/// - transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
 ///
-/// Note that these requirements mean that the trait itself must be
-/// implemented symmetrically and transitively: if `T: PartialOrd<U>`
-/// and `U: PartialOrd<V>` then `U: PartialOrd<T>` and `T:
+/// Note that these requirements mean that the trait itself must be implemented symmetrically and
+/// transitively: if `T: PartialOrd<U>` and `U: PartialOrd<V>` then `U: PartialOrd<T>` and `T:
 /// PartialOrd<V>`.
 ///
-/// PartialOrd only requires implementation of the `partial_cmp` method,
-/// with the others generated from default implementations.
+/// PartialOrd only requires implementation of the `partial_cmp` method, with the others generated
+/// from default implementations.
 ///
-/// However it remains possible to implement the others separately for types
-/// which do not have a total order. For example, for floating point numbers,
-/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
-/// 5.11).
+/// However it remains possible to implement the others separately for types which do not have a
+/// total order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==
+/// false` (cf. IEEE 754-2008 section 5.11).
 #[lang="ord"]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
-    /// This method returns an ordering between `self` and `other` values
-    /// if one exists.
+    /// This method returns an ordering between `self` and `other` values if one exists.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::cmp::Ordering;
+    ///
+    /// let result = 1.0.partial_cmp(&2.0);
+    /// assert_eq!(result, Some(Ordering::Less));
+    ///
+    /// let result = 1.0.partial_cmp(&1.0);
+    /// assert_eq!(result, Some(Ordering::Equal));
+    ///
+    /// let result = 2.0.partial_cmp(&1.0);
+    /// assert_eq!(result, Some(Ordering::Greater));
+    /// ```
+    ///
+    /// When comparison is impossible:
+    ///
+    /// ```
+    /// let result = std::f64::NAN.partial_cmp(&1.0);
+    /// assert_eq!(result, None);
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
 
     /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::cmp::Ordering;
+    ///
+    /// let result = 1.0 < 2.0;
+    /// assert_eq!(result, true);
+    ///
+    /// let result = 2.0 < 1.0;
+    /// assert_eq!(result, false);
+    /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn lt(&self, other: &Rhs) -> bool {
@@ -241,7 +296,18 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
         }
     }
 
-    /// This method tests less than or equal to (`<=`).
+    /// This method tests less than or equal to (for `self` and `other`) and is used by the `<=`
+    /// operator.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let result = 1.0 <= 2.0;
+    /// assert_eq!(result, true);
+    ///
+    /// let result = 2.0 <= 2.0;
+    /// assert_eq!(result, true);
+    /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn le(&self, other: &Rhs) -> bool {
@@ -251,7 +317,17 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
         }
     }
 
-    /// This method tests greater than (`>`).
+    /// This method tests greater than (for `self` and `other`) and is used by the `>` operator.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let result = 1.0 > 2.0;
+    /// assert_eq!(result, false);
+    ///
+    /// let result = 2.0 > 2.0;
+    /// assert_eq!(result, false);
+    /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn gt(&self, other: &Rhs) -> bool {
@@ -261,7 +337,18 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
         }
     }
 
-    /// This method tests greater than or equal to (`>=`).
+    /// This method tests greater than or equal to (for `self` and `other`) and is used by the `>=`
+    /// operator.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let result = 2.0 >= 1.0;
+    /// assert_eq!(result, true);
+    ///
+    /// let result = 2.0 >= 2.0;
+    /// assert_eq!(result, true);
+    /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn ge(&self, other: &Rhs) -> bool {
@@ -273,6 +360,15 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
 }
 
 /// Compare and return the minimum of two values.
+///
+/// # Examples
+///
+/// ```
+/// use std::cmp;
+///
+/// assert_eq!(1, cmp::min(1, 2));
+/// assert_eq!(2, cmp::min(2, 2));
+/// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn min<T: Ord>(v1: T, v2: T) -> T {
@@ -280,6 +376,15 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
 }
 
 /// Compare and return the maximum of two values.
+///
+/// # Examples
+///
+/// ```
+/// use std::cmp;
+///
+/// assert_eq!(2, cmp::max(1, 2));
+/// assert_eq!(2, cmp::max(2, 2));
+/// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn max<T: Ord>(v1: T, v2: T) -> T {
@@ -289,6 +394,24 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
 /// Compare and return the minimum of two values if there is one.
 ///
 /// Returns the first argument if the comparison determines them to be equal.
+///
+/// # Examples
+///
+/// ```
+/// use std::cmp;
+///
+/// assert_eq!(Some(1), cmp::partial_min(1, 2));
+/// assert_eq!(Some(2), cmp::partial_min(2, 2));
+/// ```
+///
+/// When comparison is impossible:
+///
+/// ```
+/// use std::cmp;
+///
+/// let result = cmp::partial_min(std::f64::NAN, 1.0);
+/// assert_eq!(result, None);
+/// ```
 #[inline]
 #[unstable(feature = "core")]
 pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
@@ -302,6 +425,24 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
 /// Compare and return the maximum of two values if there is one.
 ///
 /// Returns the first argument if the comparison determines them to be equal.
+///
+/// # Examples
+///
+/// ```
+/// use std::cmp;
+///
+/// assert_eq!(Some(2), cmp::partial_max(1, 2));
+/// assert_eq!(Some(2), cmp::partial_max(2, 2));
+/// ```
+///
+/// When comparison is impossible:
+///
+/// ```
+/// use std::cmp;
+///
+/// let result = cmp::partial_max(std::f64::NAN, 1.0);
+/// assert_eq!(result, None);
+/// ```
 #[inline]
 #[unstable(feature = "core")]
 pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 09733df3539..67c8c9fec09 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -197,6 +197,7 @@ impl<'a> Arguments<'a> {
     /// created with `argumentuint`. However, failing to do so doesn't cause
     /// unsafety, but will ignore invalid .
     #[doc(hidden)] #[inline]
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn new_v1_formatted(pieces: &'a [&'a str],
                             args: &'a [ArgumentV1<'a>],
                             fmt: &'a [rt::v1::Argument]) -> Arguments<'a> {
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 03c473ed967..fffba1561a3 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -118,21 +118,13 @@ pub trait FromIterator<A> {
     fn from_iter<T: Iterator<Item=A>>(iterator: T) -> Self;
 }
 
-// NOTE(stage0): remove trait after a snapshot
-#[cfg(stage0)]
 /// Conversion into an `Iterator`
+#[stable(feature = "rust1", since = "1.0.0")]
 pub trait IntoIterator {
-    type IntoIter: Iterator;
-
-    /// Consumes `Self` and returns an iterator over it
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn into_iter(self) -> Self::IntoIter;
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
-/// Conversion into an `Iterator`
-pub trait IntoIterator {
     type Item;
+
+    #[stable(feature = "rust1", since = "1.0.0")]
     type IntoIter: Iterator<Item=Self::Item>;
 
     /// Consumes `Self` and returns an iterator over it
@@ -140,17 +132,7 @@ pub trait IntoIterator {
     fn into_iter(self) -> Self::IntoIter;
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<I> IntoIterator for I where I: Iterator {
-    type IntoIter = I;
-
-    fn into_iter(self) -> I {
-        self
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<I: Iterator> IntoIterator for I {
     type Item = I::Item;
     type IntoIter = I;
@@ -2374,7 +2356,7 @@ impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
 /// iteration
 #[derive(Clone)]
 #[unstable(feature = "core",
-           reason = "may be renamed or replaced by range notation adapaters")]
+           reason = "may be renamed or replaced by range notation adapters")]
 pub struct Counter<A> {
     /// The current state the counter is at (next value to be yielded)
     state: A,
@@ -2385,7 +2367,7 @@ pub struct Counter<A> {
 /// Creates a new counter with the specified start/step
 #[inline]
 #[unstable(feature = "core",
-           reason = "may be renamed or replaced by range notation adapaters")]
+           reason = "may be renamed or replaced by range notation adapters")]
 pub fn count<A>(start: A, step: A) -> Counter<A> {
     Counter{state: start, step: step}
 }
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 7243bd4f0cb..f0c60ffe4bf 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -67,6 +67,7 @@
 #![feature(simd, unsafe_destructor)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
+#![feature(rustc_attrs)]
 
 #[macro_use]
 mod macros;
@@ -153,25 +154,16 @@ mod array;
 mod core {
     pub use panicking;
     pub use fmt;
-    #[cfg(not(stage0))] pub use clone;
-    #[cfg(not(stage0))] pub use cmp;
-    #[cfg(not(stage0))] pub use hash;
-    #[cfg(not(stage0))] pub use marker;
-    #[cfg(not(stage0))] pub use option;
-    #[cfg(not(stage0))] pub use iter;
+    pub use clone;
+    pub use cmp;
+    pub use hash;
+    pub use marker;
+    pub use option;
+    pub use iter;
 }
 
 #[doc(hidden)]
 mod std {
-    // NOTE: remove after next snapshot
-    #[cfg(stage0)] pub use clone;
-    #[cfg(stage0)] pub use cmp;
-    #[cfg(stage0)] pub use hash;
-    #[cfg(stage0)] pub use marker;
-    #[cfg(stage0)] pub use option;
-    #[cfg(stage0)] pub use fmt;
-    #[cfg(stage0)] pub use iter;
-
     // range syntax
     pub use ops;
 }
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index da93d4f6ca4..56e1c5dedc1 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -32,9 +32,19 @@ use clone::Clone;
            reason = "will be overhauled with new lifetime rules; see RFC 458")]
 #[lang="send"]
 #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
+#[cfg(stage0)]
 pub unsafe trait Send: 'static {
     // empty.
 }
+/// Types able to be transferred across thread boundaries.
+#[unstable(feature = "core",
+           reason = "will be overhauled with new lifetime rules; see RFC 458")]
+#[lang="send"]
+#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
+#[cfg(not(stage0))]
+pub unsafe trait Send {
+    // empty.
+}
 
 /// Types with a constant size known at compile-time.
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -424,3 +434,11 @@ pub struct NoCopy;
 #[lang="managed_bound"]
 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
 pub struct Managed;
+
+#[cfg(not(stage0))]
+mod impls {
+    use super::{Send, Sync, Sized};
+
+    unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
+    unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
+}
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 51bf3c1648f..740997b7a24 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -43,7 +43,7 @@ pub use intrinsics::forget;
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn size_of<T>() -> uint {
+pub fn size_of<T>() -> usize {
     unsafe { intrinsics::size_of::<T>() }
 }
 
@@ -58,7 +58,7 @@ pub fn size_of<T>() -> uint {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn size_of_val<T>(_val: &T) -> uint {
+pub fn size_of_val<T>(_val: &T) -> usize {
     size_of::<T>()
 }
 
@@ -75,7 +75,7 @@ pub fn size_of_val<T>(_val: &T) -> uint {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn min_align_of<T>() -> uint {
+pub fn min_align_of<T>() -> usize {
     unsafe { intrinsics::min_align_of::<T>() }
 }
 
@@ -90,7 +90,7 @@ pub fn min_align_of<T>() -> uint {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn min_align_of_val<T>(_val: &T) -> uint {
+pub fn min_align_of_val<T>(_val: &T) -> usize {
     min_align_of::<T>()
 }
 
@@ -108,7 +108,7 @@ pub fn min_align_of_val<T>(_val: &T) -> uint {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn align_of<T>() -> uint {
+pub fn align_of<T>() -> usize {
     // We use the preferred alignment as the default alignment for a type. This
     // appears to be what clang migrated towards as well:
     //
@@ -130,7 +130,7 @@ pub fn align_of<T>() -> uint {
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn align_of_val<T>(_val: &T) -> uint {
+pub fn align_of_val<T>(_val: &T) -> usize {
     align_of::<T>()
 }
 
@@ -150,7 +150,7 @@ pub fn align_of_val<T>(_val: &T) -> uint {
 /// ```
 /// use std::mem;
 ///
-/// let x: int = unsafe { mem::zeroed() };
+/// let x: i32 = unsafe { mem::zeroed() };
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -171,7 +171,7 @@ pub unsafe fn zeroed<T>() -> T {
 /// ```
 /// use std::mem;
 ///
-/// let x: int = unsafe { mem::uninitialized() };
+/// let x: i32 = unsafe { mem::uninitialized() };
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs
index 3f83302742c..5644f763069 100644
--- a/src/libcore/nonzero.rs
+++ b/src/libcore/nonzero.rs
@@ -19,8 +19,8 @@ pub unsafe trait Zeroable {}
 unsafe impl<T> Zeroable for *const T {}
 unsafe impl<T> Zeroable for *mut T {}
 unsafe impl<T> Zeroable for Unique<T> { }
-unsafe impl Zeroable for int {}
-unsafe impl Zeroable for uint {}
+unsafe impl Zeroable for isize {}
+unsafe impl Zeroable for usize {}
 unsafe impl Zeroable for i8 {}
 unsafe impl Zeroable for u8 {}
 unsafe impl Zeroable for i16 {}
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 3dc94ba555f..9a89682127f 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -605,6 +605,8 @@ impl<T> Option<T> {
     /// Returns `None` if the option is `None`, otherwise calls `f` with the
     /// wrapped value and returns the result.
     ///
+    /// Some languages call this operation flatmap.
+    ///
     /// # Example
     ///
     /// ```
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index cd91843f359..bbfe7e58ef4 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -626,17 +626,7 @@ impl<'a, T> Default for &'a [T] {
 // Iterators
 //
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<'a, T> IntoIterator for &'a [T] {
-    type IntoIter = Iter<'a, T>;
-
-    fn into_iter(self) -> Iter<'a, T> {
-        self.iter()
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> IntoIterator for &'a [T] {
     type Item = &'a T;
     type IntoIter = Iter<'a, T>;
@@ -646,17 +636,7 @@ impl<'a, T> IntoIterator for &'a [T] {
     }
 }
 
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<'a, T> IntoIterator for &'a mut [T] {
-    type IntoIter = IterMut<'a, T>;
-
-    fn into_iter(self) -> IterMut<'a, T> {
-        self.iter_mut()
-    }
-}
-
-#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> IntoIterator for &'a mut [T] {
     type Item = &'a mut T;
     type IntoIter = IterMut<'a, T>;