Skip to content

Commit

Permalink
Add associated consts MIN/MAX for Wrapping<Int>
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 1, 2020
1 parent b85e3fe commit b2c4469
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/libcore/num/wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,10 @@ Basic usage:
#![feature(wrapping_int_impl)]
use std::num::Wrapping;
assert_eq!(<Wrapping<", stringify!($t), ">>::min_value(), ",
"Wrapping(", stringify!($t), "::min_value()));
assert_eq!(<Wrapping<", stringify!($t), ">>::MIN, Wrapping(", stringify!($t), "::MIN));
```"),
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
#[inline]
pub const fn min_value() -> Self {
Wrapping(<$t>::min_value())
}
pub const MIN: Self = Self(<$t>::MIN);
}

doc_comment! {
Expand All @@ -358,14 +354,10 @@ Basic usage:
#![feature(wrapping_int_impl)]
use std::num::Wrapping;
assert_eq!(<Wrapping<", stringify!($t), ">>::max_value(), ",
"Wrapping(", stringify!($t), "::max_value()));
assert_eq!(<Wrapping<", stringify!($t), ">>::MAX, Wrapping(", stringify!($t), "::MAX));
```"),
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
#[inline]
pub const fn max_value() -> Self {
Wrapping(<$t>::max_value())
}
pub const MAX: Self = Self(<$t>::MAX);
}

doc_comment! {
Expand Down

0 comments on commit b2c4469

Please sign in to comment.