We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b639994 commit 6d0a979Copy full SHA for 6d0a979
library/core/src/num/nonzero.rs
@@ -666,8 +666,8 @@ macro_rules! nonzero_integer {
666
// and self.leading_zeros() is always < $INT::BITS since
667
// at least one of the bits in the number is not zero
668
unsafe {
669
- let bit = (((1 as $Int) << (<$Int>::BITS - 1)).unchecked_shr(self.leading_zeros()));
670
- NonZero::new_unchecked(bit)
+ let bit = (((1 as $Uint) << (<$Uint>::BITS - 1)).unchecked_shr(self.leading_zeros()));
+ NonZero::new_unchecked(bit as $Int)
671
}
672
673
0 commit comments