Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplement documentation fixes for fail!() -> panic!() #18880

Merged
merged 2 commits into from
Nov 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ impl Bitv {

/// Retrieves the value at index `i`.
///
/// # Failure
/// # Panics
///
/// Fails if `i` is out of bounds.
/// Panics if `i` is out of bounds.
///
/// # Example
///
Expand All @@ -283,9 +283,9 @@ impl Bitv {

/// Sets the value of a bit at a index `i`.
///
/// # Failure
/// # Panics
///
/// Fails if `i` is out of bounds.
/// Panics if `i` is out of bounds.
///
/// # Example
///
Expand Down Expand Up @@ -351,9 +351,9 @@ impl Bitv {
/// Sets `self` to the union of `self` and `other`. Both bitvectors must be
/// the same length. Returns `true` if `self` changed.
///
/// # Failure
/// # Panics
///
/// Fails if the bitvectors are of different lengths.
/// Panics if the bitvectors are of different lengths.
///
/// # Example
///
Expand Down Expand Up @@ -381,9 +381,9 @@ impl Bitv {
/// Sets `self` to the intersection of `self` and `other`. Both bitvectors
/// must be the same length. Returns `true` if `self` changed.
///
/// # Failure
/// # Panics
///
/// Fails if the bitvectors are of different lengths.
/// Panics if the bitvectors are of different lengths.
///
/// # Example
///
Expand Down Expand Up @@ -411,9 +411,9 @@ impl Bitv {
/// element of `other` at the same index. Both bitvectors must be the same
/// length. Returns `true` if `self` changed.
///
/// # Failure
/// # Panics
///
/// Fails if the bitvectors are of different length.
/// Panics if the bitvectors are of different length.
///
/// # Example
///
Expand Down Expand Up @@ -578,9 +578,9 @@ impl Bitv {
/// Compares a `Bitv` to a slice of `bool`s.
/// Both the `Bitv` and slice must have the same length.
///
/// # Failure
/// # Panics
///
/// Fails if the the `Bitv` and slice are of different length.
/// Panics if the the `Bitv` and slice are of different length.
///
/// # Example
///
Expand Down Expand Up @@ -716,7 +716,7 @@ impl Bitv {

/// Shortens by one element and returns the removed element.
///
/// # Failure
/// # Panics
///
/// Assert if empty.
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,9 @@ impl String {

/// Shortens a string to the specified length.
///
/// # Failure
/// # Panics
///
/// Fails if `new_len` > current length,
/// Panics if `new_len` > current length,
/// or if `new_len` is not a character boundary.
///
/// # Example
Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ impl<T> Vec<T> {

/// Appends an element to the back of a collection.
///
/// # Failure
/// # Panics
///
/// Fails if the number of elements in the vector overflows a `uint`.
/// Panics if the number of elements in the vector overflows a `uint`.
///
/// # Example
///
Expand Down Expand Up @@ -1476,9 +1476,9 @@ impl<T> Vec<T> {
/// Converts a `Vec<T>` to a `Vec<U>` where `T` and `U` have the same
/// size and in case they are not zero-sized the same minimal alignment.
///
/// # Failure
/// # Panics
///
/// Fails if `T` and `U` have differing sizes or are not zero-sized and
/// Panics if `T` and `U` have differing sizes or are not zero-sized and
/// have differing minimal alignments.
///
/// # Example
Expand Down
36 changes: 18 additions & 18 deletions src/libcore/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ impl AtomicBool {

/// Load the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Release` or `AcqRel`.
/// Panics if `order` is `Release` or `AcqRel`.
#[inline]
pub fn load(&self, order: Ordering) -> bool {
unsafe { atomic_load(self.v.get() as *const uint, order) > 0 }
}

/// Store the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Acquire` or `AcqRel`.
/// Panics if `order` is `Acquire` or `AcqRel`.
#[inline]
pub fn store(&self, val: bool, order: Ordering) {
let val = if val { UINT_TRUE } else { 0 };
Expand Down Expand Up @@ -313,19 +313,19 @@ impl AtomicInt {

/// Load the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Release` or `AcqRel`.
/// Panics if `order` is `Release` or `AcqRel`.
#[inline]
pub fn load(&self, order: Ordering) -> int {
unsafe { atomic_load(self.v.get() as *const int, order) }
}

/// Store the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Acquire` or `AcqRel`.
/// Panics if `order` is `Acquire` or `AcqRel`.
#[inline]
pub fn store(&self, val: int, order: Ordering) {
unsafe { atomic_store(self.v.get(), val, order); }
Expand Down Expand Up @@ -435,19 +435,19 @@ impl AtomicUint {

/// Load the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Release` or `AcqRel`.
/// Panics if `order` is `Release` or `AcqRel`.
#[inline]
pub fn load(&self, order: Ordering) -> uint {
unsafe { atomic_load(self.v.get() as *const uint, order) }
}

/// Store the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Acquire` or `AcqRel`.
/// Panics if `order` is `Acquire` or `AcqRel`.
#[inline]
pub fn store(&self, val: uint, order: Ordering) {
unsafe { atomic_store(self.v.get(), val, order); }
Expand Down Expand Up @@ -557,9 +557,9 @@ impl<T> AtomicPtr<T> {

/// Load the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Release` or `AcqRel`.
/// Panics if `order` is `Release` or `AcqRel`.
#[inline]
pub fn load(&self, order: Ordering) -> *mut T {
unsafe {
Expand All @@ -569,9 +569,9 @@ impl<T> AtomicPtr<T> {

/// Store the value
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Acquire` or `AcqRel`.
/// Panics if `order` is `Acquire` or `AcqRel`.
#[inline]
pub fn store(&self, ptr: *mut T, order: Ordering) {
unsafe { atomic_store(self.p.get(), ptr as uint, order); }
Expand Down Expand Up @@ -729,9 +729,9 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
///
/// Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings.
///
/// # Failure
/// # Panics
///
/// Fails if `order` is `Relaxed`
/// Panics if `order` is `Relaxed`
#[inline]
#[stable]
pub fn fence(order: Ordering) {
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ impl<T> RefCell<T> {
/// The borrow lasts until the returned `Ref` exits scope. Multiple
/// immutable borrows can be taken out at the same time.
///
/// # Failure
/// # Panics
///
/// Fails if the value is currently mutably borrowed.
/// Panics if the value is currently mutably borrowed.
#[unstable]
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
match self.try_borrow() {
Expand Down Expand Up @@ -307,9 +307,9 @@ impl<T> RefCell<T> {
/// The borrow lasts until the returned `RefMut` exits scope. The value
/// cannot be borrowed while this borrow is active.
///
/// # Failure
/// # Panics
///
/// Fails if the value is currently borrowed.
/// Panics if the value is currently borrowed.
#[unstable]
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
match self.try_borrow_mut() {
Expand Down
24 changes: 12 additions & 12 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ pub fn from_u32(i: u32) -> Option<char> {
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
/// otherwise.
///
/// # Failure
/// # Panics
///
/// Fails if given a `radix` > 36.
/// Panics if given a `radix` > 36.
///
/// # Note
///
Expand All @@ -113,9 +113,9 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
/// 'b' or 'B', 11, etc. Returns none if the `char` does not
/// refer to a digit in the given radix.
///
/// # Failure
/// # Panics
///
/// Fails if given a `radix` outside the range `[0..36]`.
/// Panics if given a `radix` outside the range `[0..36]`.
///
#[inline]
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
Expand All @@ -140,9 +140,9 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
/// Returns `Some(char)` if `num` represents one digit under `radix`,
/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
///
/// # Failure
/// # Panics
///
/// Fails if given an `radix` > 36.
/// Panics if given an `radix` > 36.
///
#[inline]
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
Expand Down Expand Up @@ -240,9 +240,9 @@ pub trait Char {
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
/// otherwise.
///
/// # Failure
/// # Panics
///
/// Fails if given a radix > 36.
/// Panics if given a radix > 36.
fn is_digit_radix(&self, radix: uint) -> bool;

/// Converts a character to the corresponding digit.
Expand All @@ -253,9 +253,9 @@ pub trait Char {
/// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns
/// none if the character does not refer to a digit in the given radix.
///
/// # Failure
/// # Panics
///
/// Fails if given a radix outside the range [0..36].
/// Panics if given a radix outside the range [0..36].
fn to_digit(&self, radix: uint) -> Option<uint>;

/// Converts a number to the character representing it.
Expand All @@ -265,9 +265,9 @@ pub trait Char {
/// Returns `Some(char)` if `num` represents one digit under `radix`,
/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
///
/// # Failure
/// # Panics
///
/// Fails if given a radix > 36.
/// Panics if given a radix > 36.
fn from_digit(num: uint, radix: uint) -> Option<Self>;

/// Returns the hexadecimal Unicode escape of a character.
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
* - `f` - A closure to invoke with the bytes representing the
* float.
*
* # Failure
* - Fails if `radix` < 2 or `radix` > 36.
* - Fails if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
* # Panics
* - Panics if `radix` < 2 or `radix` > 36.
* - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
* between digit and exponent sign `'e'`.
* - Fails if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
* - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
* between digit and exponent sign `'p'`.
*/
pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
Expand Down
Loading