Skip to content

Add debug_assert_nounwind to unchecked_{add,sub,neg,mul,shl,shr} methods (haunted PR) #117494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 66 additions & 22 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
@@ -510,9 +510,15 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_add(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_add`.
unsafe { intrinsics::unchecked_add(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_add(rhs).1,
concat!(stringify!($SelfT), "::unchecked_add cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra let is going to cause more LLVM IR to be generated in order to have debuginfo for it. I learned about this unfortunate behavior only recently:

/// Callers should also avoid introducing any other `let` bindings or any code outside this macro in
/// order to call it. Since the precompiled standard library is built with full debuginfo and these
/// variables cannot be optimized out in MIR, an innocent-looking `let` can produce enough
/// debuginfo to have a measurable compile-time impact on debug builds.

I wish I had a way to tell rustc that we don't need variable-level debuginfo for a span of code, but here we are.

Copy link
Contributor Author

@clarfonthey clarfonthey Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I didn't realise it got all the way to the LLVM IR level. It's unfortunate, but I'll remove the extra lets from these operations. (Will wait until current perf run finishes before doing this.)

intrinsics::unchecked_add(lhs, rhs)
}
}

/// Checked addition with an unsigned integer. Computes `self + rhs`,
@@ -648,9 +654,15 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_sub(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_sub`.
unsafe { intrinsics::unchecked_sub(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_sub(rhs).1,
concat!(stringify!($SelfT), "::unchecked_sub cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
intrinsics::unchecked_sub(lhs, rhs)
}
}

/// Checked subtraction with an unsigned integer. Computes `self - rhs`,
@@ -786,9 +798,15 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_mul(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_mul`.
unsafe { intrinsics::unchecked_mul(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_mul(rhs).1,
concat!(stringify!($SelfT), "::unchecked_mul cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
intrinsics::unchecked_mul(lhs, rhs)
}
}

/// Checked integer division. Computes `self / rhs`, returning `None` if `rhs == 0`
@@ -1125,9 +1143,15 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_neg(self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_neg`.
unsafe { intrinsics::unchecked_sub(0, self) }
debug_assert_nounwind!(
!self.overflowing_neg().1,
concat!(stringify!($SelfT), "::unchecked_neg cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let n = self;
intrinsics::unchecked_sub(0, n)
}
}

/// Strict negation. Computes `-self`, panicking if `self == MIN`.
@@ -1179,7 +1203,7 @@ macro_rules! int_impl {
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[inline(always)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, functions which are inline(always) are inlined even in unoptimized builds. rustc takes extra steps to make this happen, and I disagree very strongly with that behavior, but I'm bringing this up because this may explain some surprising impacts of this PR on debug build times. Don't know yet.

My PR to stop this behavior of inline(always): #121417 (comment)

Copy link
Contributor Author

@clarfonthey clarfonthey Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I initially added this after the stuff I mentioned here, but I did just leave it based upon assumptions that are probably wrong, so, I can remove it. Note that this does show up for the other unchecked operations and that shift is the only one marking them without always.

pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
let (a, b) = self.overflowing_shl(rhs);
if unlikely!(b) { None } else { Some(a) }
@@ -1241,10 +1265,17 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`.
debug_assert_nounwind!(
rhs < Self::BITS,
concat!(stringify!($SelfT), "::unchecked_shl cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
// Any legal shift amount is losslessly representable in the self type.
unsafe { intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
unsafe {
let lhs = self;
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs);
intrinsics::unchecked_shl(lhs, rhs)
}
}

/// Checked shift right. Computes `self >> rhs`, returning `None` if `rhs` is
@@ -1262,7 +1293,7 @@ macro_rules! int_impl {
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[inline(always)]
pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
let (a, b) = self.overflowing_shr(rhs);
if unlikely!(b) { None } else { Some(a) }
@@ -1324,10 +1355,17 @@ macro_rules! int_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`.
debug_assert_nounwind!(
rhs < Self::BITS,
concat!(stringify!($SelfT), "::unchecked_shr cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
// Any legal shift amount is losslessly representable in the self type.
unsafe { intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
unsafe {
let lhs = self;
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs);
intrinsics::unchecked_shr(lhs, rhs)
}
}

/// Checked absolute value. Computes `self.abs()`, returning `None` if
@@ -1991,7 +2029,10 @@ macro_rules! int_impl {
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
// out of bounds
unsafe {
self.unchecked_shl(rhs & (Self::BITS - 1))
// FIXME: we can't optimize out the extra check here,
// so, we can't just call the method for now
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1));
intrinsics::unchecked_shl(self, rhs)
}
}

@@ -2021,7 +2062,10 @@ macro_rules! int_impl {
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
// out of bounds
unsafe {
self.unchecked_shr(rhs & (Self::BITS - 1))
// FIXME: we can't optimize out the extra check here,
// so, we can't just call the method for now
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1));
intrinsics::unchecked_shr(self, rhs)
}
}

1 change: 1 addition & 0 deletions library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ use crate::hint;
use crate::intrinsics;
use crate::mem;
use crate::ops::{Add, Mul, Sub};
use crate::panic::debug_assert_nounwind;
use crate::str::FromStr;

// Used because the `?` operator is not allowed in a const context.
77 changes: 58 additions & 19 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
@@ -518,9 +518,16 @@ macro_rules! uint_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_add(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_add`.
unsafe { intrinsics::unchecked_add(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_add(rhs).1,
concat!(stringify!($SelfT), "::unchecked_add cannot overflow"),
);

// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
intrinsics::unchecked_add(lhs, rhs)
}
}

/// Checked addition with a signed integer. Computes `self + rhs`,
@@ -662,9 +669,15 @@ macro_rules! uint_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_sub(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_sub`.
unsafe { intrinsics::unchecked_sub(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_sub(rhs).1,
concat!(stringify!($SelfT), "::unchecked_sub cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
intrinsics::unchecked_sub(lhs, rhs)
}
}

/// Checked integer multiplication. Computes `self * rhs`, returning
@@ -744,9 +757,15 @@ macro_rules! uint_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_mul(self, rhs: Self) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_mul`.
unsafe { intrinsics::unchecked_mul(self, rhs) }
debug_assert_nounwind!(
!self.overflowing_mul(rhs).1,
concat!(stringify!($SelfT), "::unchecked_mul cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
unsafe {
let lhs = self;
intrinsics::unchecked_mul(lhs, rhs)
}
}

/// Checked integer division. Computes `self / rhs`, returning `None`
@@ -1239,7 +1258,7 @@ macro_rules! uint_impl {
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[inline(always)]
pub const fn checked_shl(self, rhs: u32) -> Option<Self> {
let (a, b) = self.overflowing_shl(rhs);
if unlikely!(b) { None } else { Some(a) }
@@ -1301,10 +1320,17 @@ macro_rules! uint_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shl`.
debug_assert_nounwind!(
rhs < Self::BITS,
concat!(stringify!($SelfT), "::unchecked_shl cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
// Any legal shift amount is losslessly representable in the self type.
unsafe { intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
unsafe {
let lhs = self;
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs);
intrinsics::unchecked_shl(lhs, rhs)
}
}

/// Checked shift right. Computes `self >> rhs`, returning `None`
@@ -1322,7 +1348,7 @@ macro_rules! uint_impl {
#[rustc_const_stable(feature = "const_checked_int_methods", since = "1.47.0")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
#[inline(always)]
pub const fn checked_shr(self, rhs: u32) -> Option<Self> {
let (a, b) = self.overflowing_shr(rhs);
if unlikely!(b) { None } else { Some(a) }
@@ -1384,10 +1410,17 @@ macro_rules! uint_impl {
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self {
// SAFETY: the caller must uphold the safety contract for
// `unchecked_shr`.
debug_assert_nounwind!(
rhs < Self::BITS,
concat!(stringify!($SelfT), "::unchecked_shr cannot overflow"),
);
// SAFETY: this is guaranteed to be safe by the caller.
// Any legal shift amount is losslessly representable in the self type.
unsafe { intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) }
unsafe {
let lhs = self;
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs);
intrinsics::unchecked_shr(lhs, rhs)
}
}

/// Checked exponentiation. Computes `self.pow(exp)`, returning `None` if
@@ -1878,7 +1911,10 @@ macro_rules! uint_impl {
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
// out of bounds
unsafe {
self.unchecked_shl(rhs & (Self::BITS - 1))
// FIXME: we can't optimize out the extra check here,
// so, we can't just call the method for now
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1));
intrinsics::unchecked_shl(self, rhs)
}
}

@@ -1911,7 +1947,10 @@ macro_rules! uint_impl {
// SAFETY: the masking by the bitsize of the type ensures that we do not shift
// out of bounds
unsafe {
self.unchecked_shr(rhs & (Self::BITS - 1))
// FIXME: we can't optimize out the extra check here,
// so, we can't just call the method for now
let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1));
intrinsics::unchecked_shr(self, rhs)
}
}

11 changes: 5 additions & 6 deletions library/core/src/ops/index_range.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::intrinsics::{unchecked_add, unchecked_sub};
use crate::iter::{FusedIterator, TrustedLen};
use crate::num::NonZero;

@@ -44,7 +43,7 @@ impl IndexRange {
#[inline]
pub const fn len(&self) -> usize {
// SAFETY: By invariant, this cannot wrap
unsafe { unchecked_sub(self.end, self.start) }
unsafe { self.end.unchecked_sub(self.start) }
}

/// # Safety
@@ -55,7 +54,7 @@ impl IndexRange {

let value = self.start;
// SAFETY: The range isn't empty, so this cannot overflow
self.start = unsafe { unchecked_add(value, 1) };
self.start = unsafe { value.unchecked_add(1) };
value
}

@@ -66,7 +65,7 @@ impl IndexRange {
debug_assert!(self.start < self.end);

// SAFETY: The range isn't empty, so this cannot overflow
let value = unsafe { unchecked_sub(self.end, 1) };
let value = unsafe { self.end.unchecked_sub(1) };
self.end = value;
value
}
@@ -81,7 +80,7 @@ impl IndexRange {
let mid = if n <= self.len() {
// SAFETY: We just checked that this will be between start and end,
// and thus the addition cannot overflow.
unsafe { unchecked_add(self.start, n) }
unsafe { self.start.unchecked_add(n) }
} else {
self.end
};
@@ -100,7 +99,7 @@ impl IndexRange {
let mid = if n <= self.len() {
// SAFETY: We just checked that this will be between start and end,
// and thus the addition cannot overflow.
unsafe { unchecked_sub(self.end, n) }
unsafe { self.end.unchecked_sub(n) }
} else {
self.start
};
2 changes: 1 addition & 1 deletion library/core/src/panic.rs
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ pub macro debug_assert_nounwind {
}
}
},
($cond:expr, $message:expr) => {
($cond:expr, $message:expr $(,)?) => {
if $crate::intrinsics::debug_assertions() {
if !$cond {
$crate::panicking::panic_nounwind($message);
7 changes: 5 additions & 2 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
@@ -1021,8 +1021,8 @@ impl<T: ?Sized> *const T {
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
// We could always go back to wrapping if unchecked becomes unacceptable
#[rustc_allow_const_fn_unstable(const_int_unchecked_arith)]
#[inline(always)]
#[rustc_allow_const_fn_unstable(unchecked_math)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn sub(self, count: usize) -> Self
where
@@ -1035,7 +1035,10 @@ impl<T: ?Sized> *const T {
// SAFETY: the caller must uphold the safety contract for `offset`.
// Because the pointee is *not* a ZST, that means that `count` is
// at most `isize::MAX`, and thus the negation cannot overflow.
unsafe { self.offset(intrinsics::unchecked_sub(0, count as isize)) }
// FIXME: replacing unchecked_sub with unchecked_neg and replacing the
// unchecked_math flag with unchecked_neg will anger the UnstableInStable lint
// and I cannot for the life of me understand why
unsafe { self.offset(0isize.unchecked_sub(count as isize)) }
}
}

7 changes: 5 additions & 2 deletions library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
@@ -1121,7 +1121,7 @@ impl<T: ?Sized> *mut T {
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
// We could always go back to wrapping if unchecked becomes unacceptable
#[rustc_allow_const_fn_unstable(const_int_unchecked_arith)]
#[rustc_allow_const_fn_unstable(unchecked_math)]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn sub(self, count: usize) -> Self
@@ -1135,7 +1135,10 @@ impl<T: ?Sized> *mut T {
// SAFETY: the caller must uphold the safety contract for `offset`.
// Because the pointee is *not* a ZST, that means that `count` is
// at most `isize::MAX`, and thus the negation cannot overflow.
unsafe { self.offset(intrinsics::unchecked_sub(0, count as isize)) }
// FIXME: replacing unchecked_sub with unchecked_neg and replacing the
// unchecked_math flag with unchecked_neg will anger the UnstableInStable lint
// and I cannot for the life of me understand why
unsafe { self.offset(0isize.unchecked_sub(count as isize)) }
}
}

7 changes: 5 additions & 2 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
@@ -702,7 +702,7 @@ impl<T: ?Sized> NonNull<T> {
#[rustc_const_unstable(feature = "non_null_convenience", issue = "117691")]
#[must_use = "returns a new pointer rather than modifying its argument"]
// We could always go back to wrapping if unchecked becomes unacceptable
#[rustc_allow_const_fn_unstable(const_int_unchecked_arith)]
#[rustc_allow_const_fn_unstable(unchecked_math)]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn sub(self, count: usize) -> Self
@@ -716,7 +716,10 @@ impl<T: ?Sized> NonNull<T> {
// SAFETY: the caller must uphold the safety contract for `offset`.
// Because the pointee is *not* a ZST, that means that `count` is
// at most `isize::MAX`, and thus the negation cannot overflow.
unsafe { self.offset(intrinsics::unchecked_sub(0, count as isize)) }
// FIXME: replacing unchecked_sub with unchecked_neg and replacing the
// unchecked_math flag with unchecked_neg will anger the UnstableInStable lint
// and I cannot for the life of me understand why
unsafe { self.offset(0isize.unchecked_sub(count as isize)) }
}
}

5 changes: 2 additions & 3 deletions library/core/src/slice/index.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Indexing implementations for `[T]`.
use crate::intrinsics::const_eval_select;
use crate::intrinsics::unchecked_sub;
use crate::ops;
use crate::panic::debug_assert_nounwind;
use crate::ptr;
@@ -372,7 +371,7 @@ unsafe impl<T> SliceIndex<[T]> for ops::Range<usize> {
// `self` is in bounds of `slice` so `self` cannot overflow an `isize`,
// so the call to `add` is safe and the length calculation cannot overflow.
unsafe {
let new_len = unchecked_sub(self.end, self.start);
let new_len = self.end.unchecked_sub(self.start);
ptr::slice_from_raw_parts(slice.as_ptr().add(self.start), new_len)
}
}
@@ -385,7 +384,7 @@ unsafe impl<T> SliceIndex<[T]> for ops::Range<usize> {
);
// SAFETY: see comments for `get_unchecked` above.
unsafe {
let new_len = unchecked_sub(self.end, self.start);
let new_len = self.end.unchecked_sub(self.start);
ptr::slice_from_raw_parts_mut(slice.as_mut_ptr().add(self.start), new_len)
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The loop took around 7s
The loop took around 8s
Original file line number Diff line number Diff line change
@@ -10,8 +10,17 @@
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: u64;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: u64;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -21,13 +30,34 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = _4 as u64 (IntToInt);
+ _0 = ShlUnchecked(_3, move _5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "u64::unchecked_shl cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _8 = _4 as u64 (IntToInt);
+ _0 = ShlUnchecked(_3, _8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MIR used to have all kinds of stuff in it because they were doing unwrap_unchecked dances to make things work. Now that ShlUnchecked just exists, the tests are arguably not that interesting any more. This update looks fine.

+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -10,8 +10,17 @@
+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: u64;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: u64;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -21,13 +30,34 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = _4 as u64 (IntToInt);
+ _0 = ShlUnchecked(_3, move _5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "u64::unchecked_shl cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _8 = _4 as u64 (IntToInt);
+ _0 = ShlUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -7,16 +7,47 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
debug self => _1;
debug rhs => _2;
let mut _3: u64;
let mut _3: bool;
let mut _4: bool;
let _5: !;
scope 2 {
scope 3 {
debug lhs => _1;
let _6: u64;
scope 4 {
debug rhs => _6;
}
}
}
}

bb0: {
StorageLive(_6);
StorageLive(_3);
_3 = _2 as u64 (IntToInt);
_0 = ShlUnchecked(_1, move _3);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "u64::unchecked_shl cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
_6 = _2 as u64 (IntToInt);
_0 = ShlUnchecked(_1, _6);
StorageDead(_6);
return;
}
}
Original file line number Diff line number Diff line change
@@ -7,16 +7,47 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 {
scope 1 (inlined core::num::<impl u64>::unchecked_shl) {
debug self => _1;
debug rhs => _2;
let mut _3: u64;
let mut _3: bool;
let mut _4: bool;
let _5: !;
scope 2 {
scope 3 {
debug lhs => _1;
let _6: u64;
scope 4 {
debug rhs => _6;
}
}
}
}

bb0: {
StorageLive(_6);
StorageLive(_3);
_3 = _2 as u64 (IntToInt);
_0 = ShlUnchecked(_1, move _3);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "u64::unchecked_shl cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
_6 = _2 as u64 (IntToInt);
_0 = ShlUnchecked(_1, _6);
StorageDead(_6);
return;
}
}
Original file line number Diff line number Diff line change
@@ -10,9 +10,18 @@
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: u16;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ let mut _9: bool;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: u16;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -22,17 +31,38 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Le(_4, const 65535_u32);
+ assume(move _6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _5 = _4 as u16 (IntToInt);
+ _0 = ShlUnchecked(_3, move _5);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "u16::unchecked_shl cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageLive(_9);
+ _9 = Le(_4, const 65535_u32);
+ assume(move _9);
+ StorageDead(_9);
+ _8 = _4 as u16 (IntToInt);
+ _0 = ShlUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -10,9 +10,18 @@
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: u16;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ let mut _9: bool;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: u16;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -22,17 +31,38 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Le(_4, const 65535_u32);
+ assume(move _6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _5 = _4 as u16 (IntToInt);
+ _0 = ShlUnchecked(_3, move _5);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "u16::unchecked_shl cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageLive(_9);
+ _9 = Le(_4, const 65535_u32);
+ assume(move _9);
+ StorageDead(_9);
+ _8 = _4 as u16 (IntToInt);
+ _0 = ShlUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -8,20 +8,51 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
debug self => _1;
debug rhs => _2;
let mut _3: bool;
let mut _4: u16;
let mut _4: bool;
let _5: !;
let mut _6: bool;
scope 2 {
scope 3 {
debug lhs => _1;
let _7: u16;
scope 4 {
debug rhs => _7;
}
}
}
}

bb0: {
StorageLive(_4);
StorageLive(_7);
StorageLive(_3);
_3 = Le(_2, const 65535_u32);
assume(move _3);
StorageDead(_3);
_4 = _2 as u16 (IntToInt);
_0 = ShlUnchecked(_1, move _4);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "u16::unchecked_shl cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
StorageLive(_6);
_6 = Le(_2, const 65535_u32);
assume(move _6);
StorageDead(_6);
_7 = _2 as u16 (IntToInt);
_0 = ShlUnchecked(_1, _7);
StorageDead(_7);
return;
}
}
Original file line number Diff line number Diff line change
@@ -8,20 +8,51 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
debug self => _1;
debug rhs => _2;
let mut _3: bool;
let mut _4: u16;
let mut _4: bool;
let _5: !;
let mut _6: bool;
scope 2 {
scope 3 {
debug lhs => _1;
let _7: u16;
scope 4 {
debug rhs => _7;
}
}
}
}

bb0: {
StorageLive(_4);
StorageLive(_7);
StorageLive(_3);
_3 = Le(_2, const 65535_u32);
assume(move _3);
StorageDead(_3);
_4 = _2 as u16 (IntToInt);
_0 = ShlUnchecked(_1, move _4);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "u16::unchecked_shl cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
StorageLive(_6);
_6 = Le(_2, const 65535_u32);
assume(move _6);
StorageDead(_6);
_7 = _2 as u16 (IntToInt);
_0 = ShlUnchecked(_1, _7);
StorageDead(_7);
return;
}
}
Original file line number Diff line number Diff line change
@@ -10,8 +10,17 @@
+ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: i64;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: i64;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -21,13 +30,34 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = _4 as i64 (IntToInt);
+ _0 = ShrUnchecked(_3, move _5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "i64::unchecked_shr cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _8 = _4 as i64 (IntToInt);
+ _0 = ShrUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -10,8 +10,17 @@
+ scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: i64;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: i64;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -21,13 +30,34 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = _4 as i64 (IntToInt);
+ _0 = ShrUnchecked(_3, move _5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "i64::unchecked_shr cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ _8 = _4 as i64 (IntToInt);
+ _0 = ShrUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -7,16 +7,47 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
debug self => _1;
debug rhs => _2;
let mut _3: i64;
let mut _3: bool;
let mut _4: bool;
let _5: !;
scope 2 {
scope 3 {
debug lhs => _1;
let _6: i64;
scope 4 {
debug rhs => _6;
}
}
}
}

bb0: {
StorageLive(_6);
StorageLive(_3);
_3 = _2 as i64 (IntToInt);
_0 = ShrUnchecked(_1, move _3);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "i64::unchecked_shr cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
_6 = _2 as i64 (IntToInt);
_0 = ShrUnchecked(_1, _6);
StorageDead(_6);
return;
}
}
Original file line number Diff line number Diff line change
@@ -7,16 +7,47 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 {
scope 1 (inlined core::num::<impl i64>::unchecked_shr) {
debug self => _1;
debug rhs => _2;
let mut _3: i64;
let mut _3: bool;
let mut _4: bool;
let _5: !;
scope 2 {
scope 3 {
debug lhs => _1;
let _6: i64;
scope 4 {
debug rhs => _6;
}
}
}
}

bb0: {
StorageLive(_6);
StorageLive(_3);
_3 = _2 as i64 (IntToInt);
_0 = ShrUnchecked(_1, move _3);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "i64::unchecked_shr cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
_6 = _2 as i64 (IntToInt);
_0 = ShrUnchecked(_1, _6);
StorageDead(_6);
return;
}
}
Original file line number Diff line number Diff line change
@@ -10,9 +10,18 @@
+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: i16;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ let mut _9: bool;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: i16;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -22,17 +31,38 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Le(_4, const 32767_u32);
+ assume(move _6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _5 = _4 as i16 (IntToInt);
+ _0 = ShrUnchecked(_3, move _5);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "i16::unchecked_shr cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageLive(_9);
+ _9 = Le(_4, const 32767_u32);
+ assume(move _9);
+ StorageDead(_9);
+ _8 = _4 as i16 (IntToInt);
+ _0 = ShrUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -10,9 +10,18 @@
+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) {
+ debug self => _3;
+ debug rhs => _4;
+ let mut _5: i16;
+ let mut _5: bool;
+ let mut _6: bool;
+ let _7: !;
+ let mut _9: bool;
+ scope 2 {
+ scope 3 {
+ debug lhs => _3;
+ let _8: i16;
+ scope 4 {
+ debug rhs => _8;
+ }
+ }
+ }
+ }

@@ -22,17 +31,38 @@
StorageLive(_4);
_4 = _2;
- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue];
- }
-
- bb1: {
+ StorageLive(_7);
+ StorageLive(_8);
+ StorageLive(_5);
+ _5 = cfg!(debug_assertions);
+ switchInt(move _5) -> [0: bb4, otherwise: bb1];
}

bb1: {
+ StorageLive(_6);
+ _6 = Le(_4, const 32767_u32);
+ assume(move _6);
+ _6 = Lt(_4, const _);
+ switchInt(move _6) -> [0: bb3, otherwise: bb2];
+ }
+
+ bb2: {
+ StorageDead(_6);
+ _5 = _4 as i16 (IntToInt);
+ _0 = ShrUnchecked(_3, move _5);
+ goto -> bb4;
+ }
+
+ bb3: {
+ _7 = core::panicking::panic_nounwind(const "i16::unchecked_shr cannot overflow") -> unwind unreachable;
+ }
+
+ bb4: {
+ StorageDead(_5);
+ StorageLive(_9);
+ _9 = Le(_4, const 32767_u32);
+ assume(move _9);
+ StorageDead(_9);
+ _8 = _4 as i16 (IntToInt);
+ _0 = ShrUnchecked(_3, _8);
+ StorageDead(_8);
+ StorageDead(_7);
StorageDead(_4);
StorageDead(_3);
return;
Original file line number Diff line number Diff line change
@@ -8,20 +8,51 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
debug self => _1;
debug rhs => _2;
let mut _3: bool;
let mut _4: i16;
let mut _4: bool;
let _5: !;
let mut _6: bool;
scope 2 {
scope 3 {
debug lhs => _1;
let _7: i16;
scope 4 {
debug rhs => _7;
}
}
}
}

bb0: {
StorageLive(_4);
StorageLive(_7);
StorageLive(_3);
_3 = Le(_2, const 32767_u32);
assume(move _3);
StorageDead(_3);
_4 = _2 as i16 (IntToInt);
_0 = ShrUnchecked(_1, move _4);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "i16::unchecked_shr cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
StorageLive(_6);
_6 = Le(_2, const 32767_u32);
assume(move _6);
StorageDead(_6);
_7 = _2 as i16 (IntToInt);
_0 = ShrUnchecked(_1, _7);
StorageDead(_7);
return;
}
}
Original file line number Diff line number Diff line change
@@ -8,20 +8,51 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
debug self => _1;
debug rhs => _2;
let mut _3: bool;
let mut _4: i16;
let mut _4: bool;
let _5: !;
let mut _6: bool;
scope 2 {
scope 3 {
debug lhs => _1;
let _7: i16;
scope 4 {
debug rhs => _7;
}
}
}
}

bb0: {
StorageLive(_4);
StorageLive(_7);
StorageLive(_3);
_3 = Le(_2, const 32767_u32);
assume(move _3);
StorageDead(_3);
_4 = _2 as i16 (IntToInt);
_0 = ShrUnchecked(_1, move _4);
_3 = cfg!(debug_assertions);
switchInt(move _3) -> [0: bb4, otherwise: bb1];
}

bb1: {
StorageLive(_4);
_4 = Lt(_2, const _);
switchInt(move _4) -> [0: bb2, otherwise: bb3];
}

bb2: {
_5 = core::panicking::panic_nounwind(const "i16::unchecked_shr cannot overflow") -> unwind unreachable;
}

bb3: {
StorageDead(_4);
goto -> bb4;
}

bb4: {
StorageDead(_3);
StorageLive(_6);
_6 = Le(_2, const 32767_u32);
assume(move _6);
StorageDead(_6);
_7 = _2 as i16 (IntToInt);
_0 = ShrUnchecked(_1, _7);
StorageDead(_7);
return;
}
}
Original file line number Diff line number Diff line change
@@ -20,13 +20,10 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
scope 4 (inlined core::num::<impl u32>::wrapping_shl) {
debug self => _1;
debug rhs => _2;
let mut _3: u32;
scope 5 {
scope 6 (inlined core::num::<impl u32>::unchecked_shl) {
debug self => _1;
let _3: u32;
scope 6 {
debug rhs => _3;
scope 7 {
}
}
}
}