+ /// Calculates `self` - `rhs` with an unsigned `rhs`
+ ///
+ /// Returns a tuple of the substraction along with a boolean indicating
+ /// whether an arithmetic overflow would occur. If an overflow would
+ /// have occurred then the wrapped value is returned.
+ ///
+ /// # Examples
+ ///
+ /// Basic usage:
+ ///
+ /// ```
+ /// # #![feature(mixed_integer_ops)]
+ #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".overflowing_sub_unsigned(2), (-1, false));")]
+ #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX).overflowing_sub_unsigned(", stringify!($UnsignedT), "::MAX), (", stringify!($SelfT), "::MIN, false));")]
+ #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 2).overflowing_sub_unsigned(3), (", stringify!($SelfT), "::MAX, true));")]
+ /// ```
+ #[unstable(feature = "mixed_integer_ops", issue = "87840")]
+ #[rustc_const_unstable(feature = "mixed_integer_ops", issue = "87840")]
+ #[must_use = "this returns the result of the operation, \
+ without modifying the original"]
+ #[inline]
+ pub const fn overflowing_sub_unsigned(self, rhs: $UnsignedT) -> (Self, bool) {
+ let rhs = rhs as Self;
+ let (res, overflowed) = self.overflowing_sub(rhs);
+ (res, overflowed ^ (rhs < 0))
+ }
+