auto merge of #14668 : aochagavia/rust/pr3, r=alexcrichton

Closes https://github.com/mozilla/rust/issues/14577
Closes https://github.com/mozilla/rust/issues/14639
This commit is contained in:
bors 2014-06-06 03:01:57 -07:00
commit 76baa5f086
3 changed files with 12 additions and 4 deletions

View file

@ -782,11 +782,11 @@ impl<T> Vec<T> {
self.as_mut_slice().sort_by(compare) self.as_mut_slice().sort_by(compare)
} }
/// Returns a slice of `self` between `start` and `end`. /// Returns a slice of self spanning the interval [`start`, `end`).
/// ///
/// # Failure /// # Failure
/// ///
/// Fails when `start` or `end` point outside the bounds of `self`, or when /// Fails when the slice (or part of it) is outside the bounds of self, or when
/// `start` > `end`. /// `start` > `end`.
/// ///
/// # Example /// # Example

View file

@ -366,9 +366,9 @@ impl<T> Container for ~[T] {
/// Extension methods for vectors /// Extension methods for vectors
pub trait ImmutableVector<'a, T> { pub trait ImmutableVector<'a, T> {
/** /**
* Returns a slice of self between `start` and `end`. * Returns a slice of self spanning the interval [`start`, `end`).
* *
* Fails when `start` or `end` point outside the bounds of self, * Fails when the slice (or part of it) is outside the bounds of self,
* or when `start` > `end`. * or when `start` > `end`.
*/ */
fn slice(&self, start: uint, end: uint) -> &'a [T]; fn slice(&self, start: uint, end: uint) -> &'a [T];

View file

@ -653,6 +653,8 @@ impl FromStrRadix for BigUint {
impl BigUint { impl BigUint {
/// Creates and initializes a `BigUint`. /// Creates and initializes a `BigUint`.
///
/// The digits are be in base 2^32.
#[inline] #[inline]
pub fn new(v: Vec<BigDigit>) -> BigUint { pub fn new(v: Vec<BigDigit>) -> BigUint {
// omit trailing zeros // omit trailing zeros
@ -665,6 +667,8 @@ impl BigUint {
} }
/// Creates and initializes a `BigUint`. /// Creates and initializes a `BigUint`.
///
/// The digits are be in base 2^32.
#[inline] #[inline]
pub fn from_slice(slice: &[BigDigit]) -> BigUint { pub fn from_slice(slice: &[BigDigit]) -> BigUint {
return BigUint::new(Vec::from_slice(slice)); return BigUint::new(Vec::from_slice(slice));
@ -1315,12 +1319,16 @@ impl<R: Rng> RandBigInt for R {
impl BigInt { impl BigInt {
/// Creates and initializes a BigInt. /// Creates and initializes a BigInt.
///
/// The digits are be in base 2^32.
#[inline] #[inline]
pub fn new(sign: Sign, v: Vec<BigDigit>) -> BigInt { pub fn new(sign: Sign, v: Vec<BigDigit>) -> BigInt {
BigInt::from_biguint(sign, BigUint::new(v)) BigInt::from_biguint(sign, BigUint::new(v))
} }
/// Creates and initializes a `BigInt`. /// Creates and initializes a `BigInt`.
///
/// The digits are be in base 2^32.
#[inline] #[inline]
pub fn from_biguint(sign: Sign, data: BigUint) -> BigInt { pub fn from_biguint(sign: Sign, data: BigUint) -> BigInt {
if sign == Zero || data.is_zero() { if sign == Zero || data.is_zero() {