Skip to content

Commit 9d6bd05

Browse files
committed
docs: do not call integer overflows as underflows
1 parent 7eb64b8 commit 9d6bd05

File tree

5 files changed

+15
-19
lines changed

5 files changed

+15
-19
lines changed

src/libcore/num/bignum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ macro_rules! define_bignum {
114114
/// copying it recklessly may result in the performance hit.
115115
/// Thus this is intentionally not `Copy`.
116116
///
117-
/// All operations available to bignums panic in the case of over/underflows.
117+
/// All operations available to bignums panic in the case of overflows.
118118
/// The caller is responsible to use large enough bignum types.
119119
pub struct $name {
120120
/// One plus the offset to the maximum "digit" in use.

src/libcore/num/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ macro_rules! int_impl {
402402
}
403403

404404
/// Checked integer subtraction. Computes `self - rhs`, returning
405-
/// `None` if underflow occurred.
405+
/// `None` if overflow occurred.
406406
///
407407
/// # Examples
408408
///
@@ -420,7 +420,7 @@ macro_rules! int_impl {
420420
}
421421

422422
/// Checked integer multiplication. Computes `self * rhs`, returning
423-
/// `None` if underflow or overflow occurred.
423+
/// `None` if overflow occurred.
424424
///
425425
/// # Examples
426426
///
@@ -438,7 +438,7 @@ macro_rules! int_impl {
438438
}
439439

440440
/// Checked integer division. Computes `self / rhs`, returning `None`
441-
/// if `rhs == 0` or the operation results in underflow or overflow.
441+
/// if `rhs == 0` or the operation results in overflow.
442442
///
443443
/// # Examples
444444
///
@@ -460,7 +460,7 @@ macro_rules! int_impl {
460460
}
461461

462462
/// Checked integer remainder. Computes `self % rhs`, returning `None`
463-
/// if `rhs == 0` or the operation results in underflow or overflow.
463+
/// if `rhs == 0` or the operation results in overflow.
464464
///
465465
/// # Examples
466466
///
@@ -1598,7 +1598,7 @@ macro_rules! uint_impl {
15981598
}
15991599

16001600
/// Checked integer subtraction. Computes `self - rhs`, returning
1601-
/// `None` if underflow occurred.
1601+
/// `None` if overflow occurred.
16021602
///
16031603
/// # Examples
16041604
///
@@ -1616,7 +1616,7 @@ macro_rules! uint_impl {
16161616
}
16171617

16181618
/// Checked integer multiplication. Computes `self * rhs`, returning
1619-
/// `None` if underflow or overflow occurred.
1619+
/// `None` if overflow occurred.
16201620
///
16211621
/// # Examples
16221622
///
@@ -1634,7 +1634,7 @@ macro_rules! uint_impl {
16341634
}
16351635

16361636
/// Checked integer division. Computes `self / rhs`, returning `None`
1637-
/// if `rhs == 0` or the operation results in underflow or overflow.
1637+
/// if `rhs == 0` or the operation results in overflow.
16381638
///
16391639
/// # Examples
16401640
///
@@ -1654,7 +1654,7 @@ macro_rules! uint_impl {
16541654
}
16551655

16561656
/// Checked integer remainder. Computes `self % rhs`, returning `None`
1657-
/// if `rhs == 0` or the operation results in underflow or overflow.
1657+
/// if `rhs == 0` or the operation results in overflow.
16581658
///
16591659
/// # Examples
16601660
///

src/libcore/ptr.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,7 @@ impl<T: ?Sized> *const T {
581581
/// * Both the starting and resulting pointer must be either in bounds or one
582582
/// byte past the end of an allocated object.
583583
///
584-
/// * The computed offset, **in bytes**, cannot overflow or underflow an
585-
/// `isize`.
584+
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
586585
///
587586
/// * The offset being in bounds cannot rely on "wrapping around" the address
588587
/// space. That is, the infinite-precision sum, **in bytes** must fit in a usize.
@@ -714,8 +713,7 @@ impl<T: ?Sized> *const T {
714713
/// * Both the starting and resulting pointer must be either in bounds or one
715714
/// byte past the end of an allocated object.
716715
///
717-
/// * The computed offset, **in bytes**, cannot overflow or underflow an
718-
/// `isize`.
716+
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
719717
///
720718
/// * The offset being in bounds cannot rely on "wrapping around" the address
721719
/// space. That is, the infinite-precision sum must fit in a `usize`.
@@ -1219,8 +1217,7 @@ impl<T: ?Sized> *mut T {
12191217
/// * Both the starting and resulting pointer must be either in bounds or one
12201218
/// byte past the end of an allocated object.
12211219
///
1222-
/// * The computed offset, **in bytes**, cannot overflow or underflow an
1223-
/// `isize`.
1220+
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
12241221
///
12251222
/// * The offset being in bounds cannot rely on "wrapping around" the address
12261223
/// space. That is, the infinite-precision sum, **in bytes** must fit in a usize.
@@ -1419,8 +1416,7 @@ impl<T: ?Sized> *mut T {
14191416
/// * Both the starting and resulting pointer must be either in bounds or one
14201417
/// byte past the end of an allocated object.
14211418
///
1422-
/// * The computed offset, **in bytes**, cannot overflow or underflow an
1423-
/// `isize`.
1419+
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
14241420
///
14251421
/// * The offset being in bounds cannot rely on "wrapping around" the address
14261422
/// space. That is, the infinite-precision sum must fit in a `usize`.

src/libstd/io/buffered.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<R: Seek> Seek for BufReader<R> {
263263
/// See `std::io::Seek` for more details.
264264
///
265265
/// Note: In the edge case where you're seeking with `SeekFrom::Current(n)`
266-
/// where `n` minus the internal buffer length underflows an `i64`, two
266+
/// where `n` minus the internal buffer length overflows an `i64`, two
267267
/// seeks will be performed instead of one. If the second seek returns
268268
/// `Err`, the underlying reader will be left at the same position it would
269269
/// have if you seeked to `SeekFrom::Current(0)`.

src/libstd/time/duration.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl Duration {
290290
}
291291

292292
/// Checked `Duration` subtraction. Computes `self - other`, returning [`None`]
293-
/// if the result would be negative or if underflow occurred.
293+
/// if the result would be negative or if overflow occurred.
294294
///
295295
/// [`None`]: ../../std/option/enum.Option.html#variant.None
296296
///

0 commit comments

Comments
 (0)