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

docs: do not call integer overflows as underflows #46898

Merged
merged 1 commit into from
Dec 22, 2017
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
2 changes: 1 addition & 1 deletion src/libcore/num/bignum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ macro_rules! define_bignum {
/// copying it recklessly may result in the performance hit.
/// Thus this is intentionally not `Copy`.
///
/// All operations available to bignums panic in the case of over/underflows.
/// All operations available to bignums panic in the case of overflows.
/// The caller is responsible to use large enough bignum types.
pub struct $name {
/// One plus the offset to the maximum "digit" in use.
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ macro_rules! int_impl {
}

/// Checked integer subtraction. Computes `self - rhs`, returning
/// `None` if underflow occurred.
/// `None` if overflow occurred.
///
/// # Examples
///
Expand All @@ -420,7 +420,7 @@ macro_rules! int_impl {
}

/// Checked integer multiplication. Computes `self * rhs`, returning
/// `None` if underflow or overflow occurred.
/// `None` if overflow occurred.
///
/// # Examples
///
Expand All @@ -438,7 +438,7 @@ macro_rules! int_impl {
}

/// Checked integer division. Computes `self / rhs`, returning `None`
/// if `rhs == 0` or the operation results in underflow or overflow.
/// if `rhs == 0` or the operation results in overflow.
///
/// # Examples
///
Expand All @@ -460,7 +460,7 @@ macro_rules! int_impl {
}

/// Checked integer remainder. Computes `self % rhs`, returning `None`
/// if `rhs == 0` or the operation results in underflow or overflow.
/// if `rhs == 0` or the operation results in overflow.
///
/// # Examples
///
Expand Down Expand Up @@ -1598,7 +1598,7 @@ macro_rules! uint_impl {
}

/// Checked integer subtraction. Computes `self - rhs`, returning
/// `None` if underflow occurred.
/// `None` if overflow occurred.
///
/// # Examples
///
Expand All @@ -1616,7 +1616,7 @@ macro_rules! uint_impl {
}

/// Checked integer multiplication. Computes `self * rhs`, returning
/// `None` if underflow or overflow occurred.
/// `None` if overflow occurred.
///
/// # Examples
///
Expand All @@ -1634,7 +1634,7 @@ macro_rules! uint_impl {
}

/// Checked integer division. Computes `self / rhs`, returning `None`
/// if `rhs == 0` or the operation results in underflow or overflow.
/// if `rhs == 0` or the operation results in overflow.
///
/// # Examples
///
Expand All @@ -1654,7 +1654,7 @@ macro_rules! uint_impl {
}

/// Checked integer remainder. Computes `self % rhs`, returning `None`
/// if `rhs == 0` or the operation results in underflow or overflow.
/// if `rhs == 0` or the operation results in overflow.
///
/// # Examples
///
Expand Down
12 changes: 4 additions & 8 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ impl<T: ?Sized> *const T {
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow or underflow an
/// `isize`.
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
/// * The offset being in bounds cannot rely on "wrapping around" the address
/// space. That is, the infinite-precision sum, **in bytes** must fit in a usize.
Expand Down Expand Up @@ -714,8 +713,7 @@ impl<T: ?Sized> *const T {
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow or underflow an
/// `isize`.
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
/// * The offset being in bounds cannot rely on "wrapping around" the address
/// space. That is, the infinite-precision sum must fit in a `usize`.
Expand Down Expand Up @@ -1219,8 +1217,7 @@ impl<T: ?Sized> *mut T {
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow or underflow an
/// `isize`.
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
/// * The offset being in bounds cannot rely on "wrapping around" the address
/// space. That is, the infinite-precision sum, **in bytes** must fit in a usize.
Expand Down Expand Up @@ -1419,8 +1416,7 @@ impl<T: ?Sized> *mut T {
/// * Both the starting and resulting pointer must be either in bounds or one
/// byte past the end of an allocated object.
///
/// * The computed offset, **in bytes**, cannot overflow or underflow an
/// `isize`.
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
///
/// * The offset being in bounds cannot rely on "wrapping around" the address
/// space. That is, the infinite-precision sum must fit in a `usize`.
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl<R: Seek> Seek for BufReader<R> {
/// See `std::io::Seek` for more details.
///
/// Note: In the edge case where you're seeking with `SeekFrom::Current(n)`
/// where `n` minus the internal buffer length underflows an `i64`, two
/// where `n` minus the internal buffer length overflows an `i64`, two
/// seeks will be performed instead of one. If the second seek returns
/// `Err`, the underlying reader will be left at the same position it would
/// have if you seeked to `SeekFrom::Current(0)`.
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/time/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl Duration {
}

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