pub struct ConstPropagation;
Expand description
A pass to perform const propagation and folding.
This pass should be used in conjunction with the Unroller so that loop bounds and consts in loop bodies can be evaluated.
Any of these expressions:
- unary operation,
- binary operation,
- core functions other than cheat codes, mapping ops, or rand functions,
whose arguments are consts or literals will be subject to constant folding. The ternary conditional operator will also be folded if its condition is a constant or literal.
This includes the LHS of assignment statements which include array indices.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConstPropagation
impl RefUnwindSafe for ConstPropagation
impl Send for ConstPropagation
impl Sync for ConstPropagation
impl Unpin for ConstPropagation
impl UnwindSafe for ConstPropagation
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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