Skip to content

Commit 1e4e55a

Browse files
committed
auto merge of #18880 : barosl/rust/doc-fail-to-panic, r=alexcrichton
I found some occurrences of "failure" and "fails" in the documentation. I changed them to "panics" if it means a task panic. Otherwise I left it as is, or changed it to "errors" to clearly distinguish them. Also, I made a minor fix that is breaking the layout of a module page. "Example" is shown in an irrelevant place from the following page: http://doc.rust-lang.org/std/os/index.html
2 parents 1bf0649 + 5969bf6 commit 1e4e55a

File tree

22 files changed

+135
-134
lines changed

22 files changed

+135
-134
lines changed

src/libcollections/bit.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ impl Bitv {
258258

259259
/// Retrieves the value at index `i`.
260260
///
261-
/// # Failure
261+
/// # Panics
262262
///
263-
/// Fails if `i` is out of bounds.
263+
/// Panics if `i` is out of bounds.
264264
///
265265
/// # Example
266266
///
@@ -285,9 +285,9 @@ impl Bitv {
285285

286286
/// Sets the value of a bit at a index `i`.
287287
///
288-
/// # Failure
288+
/// # Panics
289289
///
290-
/// Fails if `i` is out of bounds.
290+
/// Panics if `i` is out of bounds.
291291
///
292292
/// # Example
293293
///
@@ -353,9 +353,9 @@ impl Bitv {
353353
/// Sets `self` to the union of `self` and `other`. Both bitvectors must be
354354
/// the same length. Returns `true` if `self` changed.
355355
///
356-
/// # Failure
356+
/// # Panics
357357
///
358-
/// Fails if the bitvectors are of different lengths.
358+
/// Panics if the bitvectors are of different lengths.
359359
///
360360
/// # Example
361361
///
@@ -383,9 +383,9 @@ impl Bitv {
383383
/// Sets `self` to the intersection of `self` and `other`. Both bitvectors
384384
/// must be the same length. Returns `true` if `self` changed.
385385
///
386-
/// # Failure
386+
/// # Panics
387387
///
388-
/// Fails if the bitvectors are of different lengths.
388+
/// Panics if the bitvectors are of different lengths.
389389
///
390390
/// # Example
391391
///
@@ -413,9 +413,9 @@ impl Bitv {
413413
/// element of `other` at the same index. Both bitvectors must be the same
414414
/// length. Returns `true` if `self` changed.
415415
///
416-
/// # Failure
416+
/// # Panics
417417
///
418-
/// Fails if the bitvectors are of different length.
418+
/// Panics if the bitvectors are of different length.
419419
///
420420
/// # Example
421421
///
@@ -580,9 +580,9 @@ impl Bitv {
580580
/// Compares a `Bitv` to a slice of `bool`s.
581581
/// Both the `Bitv` and slice must have the same length.
582582
///
583-
/// # Failure
583+
/// # Panics
584584
///
585-
/// Fails if the the `Bitv` and slice are of different length.
585+
/// Panics if the the `Bitv` and slice are of different length.
586586
///
587587
/// # Example
588588
///
@@ -718,7 +718,7 @@ impl Bitv {
718718

719719
/// Shortens by one element and returns the removed element.
720720
///
721-
/// # Failure
721+
/// # Panics
722722
///
723723
/// Assert if empty.
724724
///

src/libcollections/string.rs

+2-2
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -941,9 +941,9 @@ impl<T> Vec<T> {
941941

942942
/// Appends an element to the back of a collection.
943943
///
944-
/// # Failure
944+
/// # Panics
945945
///
946-
/// Fails if the number of elements in the vector overflows a `uint`.
946+
/// Panics if the number of elements in the vector overflows a `uint`.
947947
///
948948
/// # Example
949949
///
@@ -1462,9 +1462,9 @@ impl<T> Vec<T> {
14621462
/// Converts a `Vec<T>` to a `Vec<U>` where `T` and `U` have the same
14631463
/// size and in case they are not zero-sized the same minimal alignment.
14641464
///
1465-
/// # Failure
1465+
/// # Panics
14661466
///
1467-
/// Fails if `T` and `U` have differing sizes or are not zero-sized and
1467+
/// Panics if `T` and `U` have differing sizes or are not zero-sized and
14681468
/// have differing minimal alignments.
14691469
///
14701470
/// # Example

src/libcore/atomic.rs

+18-18
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

+4-4
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

+12-12
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

+4-4
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: Float, U>(

0 commit comments

Comments
 (0)