We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
const
1 parent 526304d commit dda015aCopy full SHA for dda015a
src/libcore/num/mod.rs
@@ -1091,8 +1091,9 @@ $EndFeature, "
1091
```"),
1092
1093
#[unstable(feature = "saturating_neg", issue = "59983")]
1094
+ #[rustc_const_unstable(feature = "const_int_saturating", issue = "53718")]
1095
#[inline]
- pub fn saturating_neg(self) -> Self {
1096
+ pub const fn saturating_neg(self) -> Self {
1097
intrinsics::saturating_sub(0, self)
1098
}
1099
@@ -1117,8 +1118,9 @@ $EndFeature, "
1117
1118
1119
1120
1121
1122
- pub fn saturating_abs(self) -> Self {
1123
+ pub const fn saturating_abs(self) -> Self {
1124
if self.is_negative() {
1125
self.saturating_neg()
1126
} else {
0 commit comments