rollup merge of #16835 : michaelsproul/doc-slice-failure

This commit is contained in:
Alex Crichton 2014-08-30 23:47:17 -07:00
commit 0bce667249

View File

@ -57,31 +57,31 @@ use raw::Slice as RawSlice;
// Extension traits // Extension traits
// //
/// Extension methods for vectors /// Extension methods for immutable slices.
#[unstable = "may merge with other traits; region parameter may disappear"] #[unstable = "may merge with other traits; region parameter may disappear"]
pub trait ImmutableSlice<'a, T> { pub trait ImmutableSlice<'a, T> {
/** /// Returns a subslice spanning the interval [`start`, `end`).
* Returns a slice of self spanning the interval [`start`, `end`). ///
* /// Fails when the end of the new slice lies beyond the end of the
* Fails when the slice (or part of it) is outside the bounds of self, /// original slice (i.e. when `end > self.len()`) or when `start > end`.
* or when `start` > `end`. ///
*/ /// Slicing with `start` equal to `end` yields an empty slice.
#[unstable] #[unstable]
fn slice(&self, start: uint, end: uint) -> &'a [T]; fn slice(&self, start: uint, end: uint) -> &'a [T];
/** /// Returns a subslice from `start` to the end of the slice.
* Returns a slice of self from `start` to the end of the vec. ///
* /// Fails when `start` is strictly greater than the length of the original slice.
* Fails when `start` points outside the bounds of self. ///
*/ /// Slicing from `self.len()` yields an empty slice.
#[unstable] #[unstable]
fn slice_from(&self, start: uint) -> &'a [T]; fn slice_from(&self, start: uint) -> &'a [T];
/** /// Returns a subslice from the start of the slice to `end`.
* Returns a slice of self from the start of the vec to `end`. ///
* /// Fails when `end` is strictly greater than the length of the original slice.
* Fails when `end` points outside the bounds of self. ///
*/ /// Slicing to `0` yields an empty slice.
#[unstable] #[unstable]
fn slice_to(&self, end: uint) -> &'a [T]; fn slice_to(&self, end: uint) -> &'a [T];
@ -486,21 +486,26 @@ pub trait MutableSlice<'a, T> {
/// Primarily intended for getting a &mut [T] from a [T, ..N]. /// Primarily intended for getting a &mut [T] from a [T, ..N].
fn as_mut_slice(self) -> &'a mut [T]; fn as_mut_slice(self) -> &'a mut [T];
/// Return a slice that points into another slice. /// Returns a mutable subslice spanning the interval [`start`, `end`).
///
/// Fails when the end of the new slice lies beyond the end of the
/// original slice (i.e. when `end > self.len()`) or when `start > end`.
///
/// Slicing with `start` equal to `end` yields an empty slice.
fn mut_slice(self, start: uint, end: uint) -> &'a mut [T]; fn mut_slice(self, start: uint, end: uint) -> &'a mut [T];
/** /// Returns a mutable subslice from `start` to the end of the slice.
* Returns a slice of self from `start` to the end of the vec. ///
* /// Fails when `start` is strictly greater than the length of the original slice.
* Fails when `start` points outside the bounds of self. ///
*/ /// Slicing from `self.len()` yields an empty slice.
fn mut_slice_from(self, start: uint) -> &'a mut [T]; fn mut_slice_from(self, start: uint) -> &'a mut [T];
/** /// Returns a mutable subslice from the start of the slice to `end`.
* Returns a slice of self from the start of the vec to `end`. ///
* /// Fails when `end` is strictly greater than the length of the original slice.
* Fails when `end` points outside the bounds of self. ///
*/ /// Slicing to `0` yields an empty slice.
fn mut_slice_to(self, end: uint) -> &'a mut [T]; fn mut_slice_to(self, end: uint) -> &'a mut [T];
/// Returns an iterator that allows modifying each value /// Returns an iterator that allows modifying each value