Rollup merge of #72891 - lzutao:wrapping_int-max, r=sfackler

Add associated consts MIN/MAX for Wrapping<Int>
This commit is contained in:
Yuki Okushi 2020-06-02 13:07:25 +09:00 committed by GitHub
commit f388007249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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! {
@ -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! {