diff options
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/any.rs | 2 | ||||
| -rw-r--r-- | src/libcore/array.rs | 4 | ||||
| -rw-r--r-- | src/libcore/cell.rs | 10 | ||||
| -rw-r--r-- | src/libcore/intrinsics.rs | 5 | ||||
| -rw-r--r-- | src/libcore/iter.rs | 31 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 4 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 6 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 4 | ||||
| -rw-r--r-- | src/libcore/tuple.rs | 1 |
9 files changed, 34 insertions, 33 deletions
diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 40c2d82bf4b..462b6771b4a 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -27,7 +27,7 @@ //! # Examples //! //! Consider a situation where we want to log out a value passed to a function. -//! We know the value we're working on implements Show, but we don't know its +//! We know the value we're working on implements Debug, but we don't know its //! concrete type. We want to give special treatment to certain types: in this //! case printing out the length of String values prior to their value. //! We don't know the concrete type of our value at compile time, so we need to diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 5c4567e567b..a596fe4a588 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -49,7 +49,7 @@ macro_rules! array_impls { } impl<'a, T> IntoIterator for &'a [T; $N] { - type Iter = Iter<'a, T>; + type IntoIter = Iter<'a, T>; fn into_iter(self) -> Iter<'a, T> { self.iter() @@ -57,7 +57,7 @@ macro_rules! array_impls { } impl<'a, T> IntoIterator for &'a mut [T; $N] { - type Iter = IterMut<'a, T>; + type IntoIter = IterMut<'a, T>; fn into_iter(self) -> IterMut<'a, T> { self.iter_mut() diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index c82d8c531d2..050b34508ff 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -1,4 +1,4 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -151,7 +151,7 @@ use option::Option::{None, Some}; /// A mutable memory location that admits only `Copy` data. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](index.html) for more. #[stable(feature = "rust1", since = "1.0.0")] pub struct Cell<T> { value: UnsafeCell<T>, @@ -259,7 +259,7 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> { /// A mutable memory location with dynamically checked borrow rules /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](index.html) for more. #[stable(feature = "rust1", since = "1.0.0")] pub struct RefCell<T> { value: UnsafeCell<T>, @@ -534,7 +534,7 @@ impl<'b> Clone for BorrowRef<'b> { /// Wraps a borrowed reference to a value in a `RefCell` box. /// A wrapper type for an immutably borrowed value from a `RefCell<T>`. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](index.html) for more. #[stable(feature = "rust1", since = "1.0.0")] pub struct Ref<'b, T:'b> { // FIXME #12808: strange name to try to avoid interfering with @@ -595,7 +595,7 @@ impl<'b> BorrowRefMut<'b> { /// A wrapper type for a mutably borrowed value from a `RefCell<T>`. /// -/// See the [module-level documentation](../index.html) for more. +/// See the [module-level documentation](index.html) for more. #[stable(feature = "rust1", since = "1.0.0")] pub struct RefMut<'b, T:'b> { // FIXME #12808: strange name to try to avoid interfering with diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 125e8a0e814..5562845e11d 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -222,12 +222,11 @@ extern "rust-intrinsic" { /// Unsafely transforms a value of one type into a value of another type. /// - /// Both types must have the same size and alignment, and this guarantee - /// is enforced at compile-time. + /// Both types must have the same size. /// /// # Examples /// - /// ```rust + /// ``` /// use std::mem; /// /// let v: &[u8] = unsafe { mem::transmute("L") }; diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 5df64cfaada..7740cd6867c 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -120,14 +120,15 @@ pub trait FromIterator<A> { /// Conversion into an `Iterator` pub trait IntoIterator { - type Iter: Iterator; + type IntoIter: Iterator; /// Consumes `Self` and returns an iterator over it - fn into_iter(self) -> Self::Iter; + #[stable(feature = "rust1", since = "1.0.0")] + fn into_iter(self) -> Self::IntoIter; } impl<I> IntoIterator for I where I: Iterator { - type Iter = I; + type IntoIter = I; fn into_iter(self) -> I { self @@ -967,10 +968,9 @@ pub trait IteratorExt: Iterator + Sized { /// Creates an iterator that clones the elements it yields. Useful for converting an /// Iterator<&T> to an Iterator<T>. #[unstable(feature = "core", reason = "recent addition")] - fn cloned<T, D>(self) -> Cloned<Self> where - Self: Iterator<Item=D>, - D: Deref<Target=T>, - T: Clone, + fn cloned(self) -> Cloned<Self> where + Self::Item: Deref, + <Self::Item as Deref>::Output: Clone, { Cloned { it: self } } @@ -2646,13 +2646,7 @@ impl<A: Int> Iterator for RangeStepInclusive<A> { macro_rules! range_exact_iter_impl { ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] - impl ExactSizeIterator for ::ops::Range<$t> { - #[inline] - fn len(&self) -> usize { - debug_assert!(self.end >= self.start); - (self.end - self.start) as usize - } - } + impl ExactSizeIterator for ::ops::Range<$t> { } )*) } @@ -2673,9 +2667,12 @@ impl<A: Int> Iterator for ::ops::Range<A> { #[inline] fn size_hint(&self) -> (usize, Option<usize>) { - debug_assert!(self.end >= self.start); - let hint = (self.end - self.start).to_uint(); - (hint.unwrap_or(0), hint) + if self.start >= self.end { + (0, Some(0)) + } else { + let length = (self.end - self.start).to_uint(); + (length.unwrap_or(0), length) + } } } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index df4942b509b..a122bcb2c7a 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -141,6 +141,10 @@ pub mod hash; pub mod fmt; pub mod error; +#[doc(primitive = "bool")] +mod bool { +} + // note: does not need to be public mod tuple; mod array; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index ba1eae551ff..bf801a88ca5 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -522,21 +522,21 @@ impl<T> PartialOrd for *mut T { /// Useful for building abstractions like `Vec<T>` or `Box<T>`, which /// internally use raw pointers to manage the memory that they own. #[unstable(feature = "core", reason = "recently added to this module")] -pub struct Unique<T>(pub *mut T); +pub struct Unique<T: ?Sized>(pub *mut T); /// `Unique` pointers are `Send` if `T` is `Send` because the data they /// reference is unaliased. Note that this aliasing invariant is /// unenforced by the type system; the abstraction using the /// `Unique` must enforce it. #[unstable(feature = "core", reason = "recently added to this module")] -unsafe impl<T:Send> Send for Unique<T> { } +unsafe impl<T: Send + ?Sized> Send for Unique<T> { } /// `Unique` pointers are `Sync` if `T` is `Sync` because the data they /// reference is unaliased. Note that this aliasing invariant is /// unenforced by the type system; the abstraction using the /// `Unique` must enforce it. #[unstable(feature = "core", reason = "recently added to this module")] -unsafe impl<T:Sync> Sync for Unique<T> { } +unsafe impl<T: Sync + ?Sized> Sync for Unique<T> { } impl<T> Unique<T> { /// Returns a null Unique. diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index fc51920ec6b..459addb09fd 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -628,7 +628,7 @@ impl<'a, T> Default for &'a [T] { // impl<'a, T> IntoIterator for &'a [T] { - type Iter = Iter<'a, T>; + type IntoIter = Iter<'a, T>; fn into_iter(self) -> Iter<'a, T> { self.iter() @@ -636,7 +636,7 @@ impl<'a, T> IntoIterator for &'a [T] { } impl<'a, T> IntoIterator for &'a mut [T] { - type Iter = IterMut<'a, T>; + type IntoIter = IterMut<'a, T>; fn into_iter(self) -> IterMut<'a, T> { self.iter_mut() diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 64c2964eb7c..72b2d5dc188 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -34,6 +34,7 @@ //! * `Default` #![stable(feature = "rust1", since = "1.0.0")] +#![doc(primitive = "tuple")] use clone::Clone; use cmp::*; |
