Skip to content

Commit 8bf77fa

Browse files
committed
Fix remaining documentation to reflect fail!() -> panic!()
Throughout the docs, "failure" was replaced with "panics" if it means a task panic. Otherwise, it remained as is, or changed to "errors" to clearly differentiate it from a task panic.
1 parent 5d29209 commit 8bf77fa

File tree

22 files changed

+134
-134
lines changed

22 files changed

+134
-134
lines changed

src/libcollections/bit.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ impl Bitv {
256256

257257
/// Retrieves the value at index `i`.
258258
///
259-
/// # Failure
259+
/// # Panics
260260
///
261-
/// Fails if `i` is out of bounds.
261+
/// Panics if `i` is out of bounds.
262262
///
263263
/// # Example
264264
///
@@ -283,9 +283,9 @@ impl Bitv {
283283

284284
/// Sets the value of a bit at a index `i`.
285285
///
286-
/// # Failure
286+
/// # Panics
287287
///
288-
/// Fails if `i` is out of bounds.
288+
/// Panics if `i` is out of bounds.
289289
///
290290
/// # Example
291291
///
@@ -351,9 +351,9 @@ impl Bitv {
351351
/// Sets `self` to the union of `self` and `other`. Both bitvectors must be
352352
/// the same length. Returns `true` if `self` changed.
353353
///
354-
/// # Failure
354+
/// # Panics
355355
///
356-
/// Fails if the bitvectors are of different lengths.
356+
/// Panics if the bitvectors are of different lengths.
357357
///
358358
/// # Example
359359
///
@@ -381,9 +381,9 @@ impl Bitv {
381381
/// Sets `self` to the intersection of `self` and `other`. Both bitvectors
382382
/// must be the same length. Returns `true` if `self` changed.
383383
///
384-
/// # Failure
384+
/// # Panics
385385
///
386-
/// Fails if the bitvectors are of different lengths.
386+
/// Panics if the bitvectors are of different lengths.
387387
///
388388
/// # Example
389389
///
@@ -411,9 +411,9 @@ impl Bitv {
411411
/// element of `other` at the same index. Both bitvectors must be the same
412412
/// length. Returns `true` if `self` changed.
413413
///
414-
/// # Failure
414+
/// # Panics
415415
///
416-
/// Fails if the bitvectors are of different length.
416+
/// Panics if the bitvectors are of different length.
417417
///
418418
/// # Example
419419
///
@@ -578,9 +578,9 @@ impl Bitv {
578578
/// Compares a `Bitv` to a slice of `bool`s.
579579
/// Both the `Bitv` and slice must have the same length.
580580
///
581-
/// # Failure
581+
/// # Panics
582582
///
583-
/// Fails if the the `Bitv` and slice are of different length.
583+
/// Panics if the the `Bitv` and slice are of different length.
584584
///
585585
/// # Example
586586
///
@@ -716,7 +716,7 @@ impl Bitv {
716716

717717
/// Shortens by one element and returns the removed element.
718718
///
719-
/// # Failure
719+
/// # Panics
720720
///
721721
/// Assert if empty.
722722
///

src/libcollections/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ impl String {
498498

499499
/// Shortens a string to the specified length.
500500
///
501-
/// # Failure
501+
/// # Panics
502502
///
503-
/// Fails if `new_len` > current length,
503+
/// Panics if `new_len` > current length,
504504
/// or if `new_len` is not a character boundary.
505505
///
506506
/// # Example

src/libcollections/vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,9 @@ impl<T> Vec<T> {
955955

956956
/// Appends an element to the back of a collection.
957957
///
958-
/// # Failure
958+
/// # Panics
959959
///
960-
/// Fails if the number of elements in the vector overflows a `uint`.
960+
/// Panics if the number of elements in the vector overflows a `uint`.
961961
///
962962
/// # Example
963963
///
@@ -1476,9 +1476,9 @@ impl<T> Vec<T> {
14761476
/// Converts a `Vec<T>` to a `Vec<U>` where `T` and `U` have the same
14771477
/// size and in case they are not zero-sized the same minimal alignment.
14781478
///
1479-
/// # Failure
1479+
/// # Panics
14801480
///
1481-
/// Fails if `T` and `U` have differing sizes or are not zero-sized and
1481+
/// Panics if `T` and `U` have differing sizes or are not zero-sized and
14821482
/// have differing minimal alignments.
14831483
///
14841484
/// # Example

src/libcore/atomic.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ impl AtomicBool {
102102

103103
/// Load the value
104104
///
105-
/// # Failure
105+
/// # Panics
106106
///
107-
/// Fails if `order` is `Release` or `AcqRel`.
107+
/// Panics if `order` is `Release` or `AcqRel`.
108108
#[inline]
109109
pub fn load(&self, order: Ordering) -> bool {
110110
unsafe { atomic_load(self.v.get() as *const uint, order) > 0 }
111111
}
112112

113113
/// Store the value
114114
///
115-
/// # Failure
115+
/// # Panics
116116
///
117-
/// Fails if `order` is `Acquire` or `AcqRel`.
117+
/// Panics if `order` is `Acquire` or `AcqRel`.
118118
#[inline]
119119
pub fn store(&self, val: bool, order: Ordering) {
120120
let val = if val { UINT_TRUE } else { 0 };
@@ -313,19 +313,19 @@ impl AtomicInt {
313313

314314
/// Load the value
315315
///
316-
/// # Failure
316+
/// # Panics
317317
///
318-
/// Fails if `order` is `Release` or `AcqRel`.
318+
/// Panics if `order` is `Release` or `AcqRel`.
319319
#[inline]
320320
pub fn load(&self, order: Ordering) -> int {
321321
unsafe { atomic_load(self.v.get() as *const int, order) }
322322
}
323323

324324
/// Store the value
325325
///
326-
/// # Failure
326+
/// # Panics
327327
///
328-
/// Fails if `order` is `Acquire` or `AcqRel`.
328+
/// Panics if `order` is `Acquire` or `AcqRel`.
329329
#[inline]
330330
pub fn store(&self, val: int, order: Ordering) {
331331
unsafe { atomic_store(self.v.get(), val, order); }
@@ -435,19 +435,19 @@ impl AtomicUint {
435435

436436
/// Load the value
437437
///
438-
/// # Failure
438+
/// # Panics
439439
///
440-
/// Fails if `order` is `Release` or `AcqRel`.
440+
/// Panics if `order` is `Release` or `AcqRel`.
441441
#[inline]
442442
pub fn load(&self, order: Ordering) -> uint {
443443
unsafe { atomic_load(self.v.get() as *const uint, order) }
444444
}
445445

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

558558
/// Load the value
559559
///
560-
/// # Failure
560+
/// # Panics
561561
///
562-
/// Fails if `order` is `Release` or `AcqRel`.
562+
/// Panics if `order` is `Release` or `AcqRel`.
563563
#[inline]
564564
pub fn load(&self, order: Ordering) -> *mut T {
565565
unsafe {
@@ -569,9 +569,9 @@ impl<T> AtomicPtr<T> {
569569

570570
/// Store the value
571571
///
572-
/// # Failure
572+
/// # Panics
573573
///
574-
/// Fails if `order` is `Acquire` or `AcqRel`.
574+
/// Panics if `order` is `Acquire` or `AcqRel`.
575575
#[inline]
576576
pub fn store(&self, ptr: *mut T, order: Ordering) {
577577
unsafe { atomic_store(self.p.get(), ptr as uint, order); }
@@ -729,9 +729,9 @@ unsafe fn atomic_xor<T>(dst: *mut T, val: T, order: Ordering) -> T {
729729
///
730730
/// Accepts `Acquire`, `Release`, `AcqRel` and `SeqCst` orderings.
731731
///
732-
/// # Failure
732+
/// # Panics
733733
///
734-
/// Fails if `order` is `Relaxed`
734+
/// Panics if `order` is `Relaxed`
735735
#[inline]
736736
#[stable]
737737
pub fn fence(order: Ordering) {

src/libcore/cell.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ impl<T> RefCell<T> {
274274
/// The borrow lasts until the returned `Ref` exits scope. Multiple
275275
/// immutable borrows can be taken out at the same time.
276276
///
277-
/// # Failure
277+
/// # Panics
278278
///
279-
/// Fails if the value is currently mutably borrowed.
279+
/// Panics if the value is currently mutably borrowed.
280280
#[unstable]
281281
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
282282
match self.try_borrow() {
@@ -307,9 +307,9 @@ impl<T> RefCell<T> {
307307
/// The borrow lasts until the returned `RefMut` exits scope. The value
308308
/// cannot be borrowed while this borrow is active.
309309
///
310-
/// # Failure
310+
/// # Panics
311311
///
312-
/// Fails if the value is currently borrowed.
312+
/// Panics if the value is currently borrowed.
313313
#[unstable]
314314
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
315315
match self.try_borrow_mut() {

src/libcore/char.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ pub fn from_u32(i: u32) -> Option<char> {
8787
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
8888
/// otherwise.
8989
///
90-
/// # Failure
90+
/// # Panics
9191
///
92-
/// Fails if given a `radix` > 36.
92+
/// Panics if given a `radix` > 36.
9393
///
9494
/// # Note
9595
///
@@ -113,9 +113,9 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
113113
/// 'b' or 'B', 11, etc. Returns none if the `char` does not
114114
/// refer to a digit in the given radix.
115115
///
116-
/// # Failure
116+
/// # Panics
117117
///
118-
/// Fails if given a `radix` outside the range `[0..36]`.
118+
/// Panics if given a `radix` outside the range `[0..36]`.
119119
///
120120
#[inline]
121121
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
@@ -140,9 +140,9 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
140140
/// Returns `Some(char)` if `num` represents one digit under `radix`,
141141
/// using one character of `0-9` or `a-z`, or `None` if it doesn't.
142142
///
143-
/// # Failure
143+
/// # Panics
144144
///
145-
/// Fails if given an `radix` > 36.
145+
/// Panics if given an `radix` > 36.
146146
///
147147
#[inline]
148148
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
@@ -240,9 +240,9 @@ pub trait Char {
240240
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
241241
/// otherwise.
242242
///
243-
/// # Failure
243+
/// # Panics
244244
///
245-
/// Fails if given a radix > 36.
245+
/// Panics if given a radix > 36.
246246
fn is_digit_radix(&self, radix: uint) -> bool;
247247

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

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

273273
/// Returns the hexadecimal Unicode escape of a character.

src/libcore/fmt/float.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
7272
* - `f` - A closure to invoke with the bytes representing the
7373
* float.
7474
*
75-
* # Failure
76-
* - Fails if `radix` < 2 or `radix` > 36.
77-
* - Fails if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
75+
* # Panics
76+
* - Panics if `radix` < 2 or `radix` > 36.
77+
* - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
7878
* between digit and exponent sign `'e'`.
79-
* - Fails if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
79+
* - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
8080
* between digit and exponent sign `'p'`.
8181
*/
8282
pub fn float_to_str_bytes_common<T: Primitive + Float, U>(

0 commit comments

Comments
 (0)