struct PendingShiftCheck {
block: BlockId,
amount: Operand,
cond_local: LocalId,
cast_local: Option<LocalId>,
}Expand description
A shift overflow check whose shift operation is not in the same block: rustc evaluates the
shift operands (which is when it emits the overflow check) before computing the destination
place, so when that computation involves a function call (e.g. out[i] = x >> y through an
overloaded IndexMut), the check ends up separated from the shift by the call terminator.
See issue #1041. These asserts are only ever emitted by the compiler, so instead of following
the control flow we record the check and find the matching shift over the whole body in
resolve_pending_shift_check.
Fields§
§block: BlockIdThe block containing the check.
amount: OperandThe checked shift amount; used to find the shift.
cond_local: LocalIdThe comparison result asserted by the check. Identifies the check’s statements to remove.
cast_local: Option<LocalId>The y as uN cast temporary, when the amount is cast before the comparison; also removed.
Auto Trait Implementations§
impl Freeze for PendingShiftCheck
impl RefUnwindSafe for PendingShiftCheck
impl Send for PendingShiftCheck
impl Sync for PendingShiftCheck
impl Unpin for PendingShiftCheck
impl UnsafeUnpin for PendingShiftCheck
impl UnwindSafe for PendingShiftCheck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more