pub enum RawStatement {
Assign(Place, Rvalue),
Call(Call),
SetDiscriminant(Place, VariantId),
StorageLive(LocalId),
StorageDead(LocalId),
Deinit(Place),
Drop(Place),
Assert(Assert),
Nop,
Error(String),
}
Expand description
A raw statement: a statement without meta data.
Variants§
Assign(Place, Rvalue)
Call(Call)
A call. For now, we don’t support dynamic calls (i.e. to a function pointer in memory).
SetDiscriminant(Place, VariantId)
StorageLive(LocalId)
Indicates that this local should be allocated; if it is already allocated, this frees
the local and re-allocates it. The return value and arguments do not receive a
StorageLive
. We ensure in the micro-pass insert_storage_lives
that all other locals
have a StorageLive
associated with them.
StorageDead(LocalId)
Indicates that this local should be deallocated; if it is already deallocated, this is
a no-op. A local may not have a StorageDead
in the function’s body, in which case it
is implicitly deallocated at the end of the function.
Deinit(Place)
Drop(Place)
Assert(Assert)
A built-in assert, which corresponds to runtime checks that we remove, namely: bounds checks, over/underflow checks, div/rem by zero checks, pointer alignement check.
Nop
Does nothing. Useful for passes.
Error(String)
Implementations§
Source§impl RawStatement
impl RawStatement
pub fn is_assign(&self) -> bool
pub fn is_call(&self) -> bool
pub fn is_set_discriminant(&self) -> bool
pub fn is_storage_live(&self) -> bool
pub fn is_storage_dead(&self) -> bool
pub fn is_deinit(&self) -> bool
pub fn is_drop(&self) -> bool
pub fn is_assert(&self) -> bool
pub fn is_nop(&self) -> bool
pub fn is_error(&self) -> bool
Source§impl RawStatement
impl RawStatement
pub fn as_assign(&self) -> Option<(&Place, &Rvalue)>
pub fn as_call(&self) -> Option<&Call>
pub fn as_set_discriminant(&self) -> Option<(&Place, &VariantId)>
pub fn as_storage_live(&self) -> Option<&LocalId>
pub fn as_storage_dead(&self) -> Option<&LocalId>
pub fn as_deinit(&self) -> Option<&Place>
pub fn as_drop(&self) -> Option<&Place>
pub fn as_assert(&self) -> Option<&Assert>
pub fn as_nop(&self) -> Option<()>
pub fn as_error(&self) -> Option<&String>
Source§impl RawStatement
impl RawStatement
pub fn as_assign_mut(&mut self) -> Option<(&mut Place, &mut Rvalue)>
pub fn as_call_mut(&mut self) -> Option<&mut Call>
pub fn as_set_discriminant_mut( &mut self, ) -> Option<(&mut Place, &mut VariantId)>
pub fn as_storage_live_mut(&mut self) -> Option<&mut LocalId>
pub fn as_storage_dead_mut(&mut self) -> Option<&mut LocalId>
pub fn as_deinit_mut(&mut self) -> Option<&mut Place>
pub fn as_drop_mut(&mut self) -> Option<&mut Place>
pub fn as_assert_mut(&mut self) -> Option<&mut Assert>
pub fn as_nop_mut(&mut self) -> Option<()>
pub fn as_error_mut(&mut self) -> Option<&mut String>
Source§impl RawStatement
impl RawStatement
pub fn variant_name(&self) -> &'static str
Trait Implementations§
Source§impl AstVisitable for RawStatement
impl AstVisitable for RawStatement
Source§fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive<V: VisitAst>(&self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
fn drive_mut<V: VisitAstMut>(&mut self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
fn dyn_visit<T: AstVisitable>(&self, f: impl FnMut(&T))
self
, in pre-order traversal.Source§fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
self
, in pre-order traversal.Source§impl BodyVisitable for RawStatement
impl BodyVisitable for RawStatement
Source§fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>
fn drive_body<V: VisitBody>(&self, v: &mut V) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn drive_body_mut<V: VisitBodyMut>(
&mut self,
v: &mut V,
) -> ControlFlow<V::Break>
fn drive_body_mut<V: VisitBodyMut>( &mut self, v: &mut V, ) -> ControlFlow<V::Break>
visit_$any
method if it exists, otherwise visit_inner
.Source§fn dyn_visit_in_body<T: BodyVisitable>(&self, f: impl FnMut(&T))
fn dyn_visit_in_body<T: BodyVisitable>(&self, f: impl FnMut(&T))
self
, in pre-order traversal.Source§fn dyn_visit_in_body_mut<T: BodyVisitable>(&mut self, f: impl FnMut(&mut T))
fn dyn_visit_in_body_mut<T: BodyVisitable>(&mut self, f: impl FnMut(&mut T))
self
, in pre-order traversal.Source§impl Clone for RawStatement
impl Clone for RawStatement
Source§fn clone(&self) -> RawStatement
fn clone(&self) -> RawStatement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RawStatement
impl Debug for RawStatement
Source§impl<'de> Deserialize<'de> for RawStatement
impl<'de> Deserialize<'de> for RawStatement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'s, V> Drive<'s, V> for RawStatement
impl<'s, V> Drive<'s, V> for RawStatement
Source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.Source§impl<'s, V> DriveMut<'s, V> for RawStatement
impl<'s, V> DriveMut<'s, V> for RawStatement
Source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit()
on the immediate contents of self
.Auto Trait Implementations§
impl Freeze for RawStatement
impl RefUnwindSafe for RawStatement
impl Send for RawStatement
impl Sync for RawStatement
impl Unpin for RawStatement
impl UnwindSafe for RawStatement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Source§impl<T> TyVisitable for Twhere
T: AstVisitable,
impl<T> TyVisitable for Twhere
T: AstVisitable,
fn substitute(self, generics: &GenericArgs) -> Self
fn substitute_with_self( self, generics: &GenericArgs, self_ref: &TraitRefKind, ) -> Self
Source§fn move_under_binder(self) -> Self
fn move_under_binder(self) -> Self
Source§fn move_under_binders(self, depth: DeBruijnId) -> Self
fn move_under_binders(self, depth: DeBruijnId) -> Self
depth
binders.Source§fn move_from_under_binder(self) -> Option<Self>
fn move_from_under_binder(self) -> Option<Self>
Source§fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
fn move_from_under_binders(self, depth: DeBruijnId) -> Option<Self>
depth
binders. Returns None
if it contains a variable bound in
one of these depth
binders.Source§fn visit_db_id<B>(
&mut self,
f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>,
) -> ControlFlow<B>
fn visit_db_id<B>( &mut self, f: impl FnMut(&mut DeBruijnId) -> ControlFlow<B>, ) -> ControlFlow<B>
self
, as seen from the outside of self
. This means
that any variable bound inside self
will be skipped, and all the seen indices will count
from the outside of self.