pub enum RawStatement {
}
Expand description
A raw statement: a statement without meta data.
Variants§
Assign(Place, Rvalue)
Assigns an Rvalue
to a Place
. e.g. let y = x;
could become
y := move x
which is represented as Assign(y, Rvalue::Use(Operand::Move(x)))
.
FakeRead(Place)
Only used for borrow-checking
SetDiscriminant(Place, VariantId)
Not used today because we take MIR built.
Drop(Place)
Assert(Assert)
Call(Call)
Abort(AbortKind)
Panic also handles “unreachable”. We keep the name of the panicking function that was called.
Return
Break(usize)
Break to outer loops.
The usize
gives the index of the outer loop to break to:
- 0: break to first outer loop (the current loop)
- 1: break to second outer loop
- …
Continue(usize)
Continue to outer loops.
The usize
gives the index of the outer loop to continue to:
- 0: continue to first outer loop (the current loop)
- 1: continue to second outer loop
- …
Nop
No-op.
Switch(Switch)
Loop(Block)
Error(String)
Implementations§
source§impl RawStatement
impl RawStatement
pub fn is_assign(&self) -> bool
pub fn is_fake_read(&self) -> bool
pub fn is_set_discriminant(&self) -> bool
pub fn is_drop(&self) -> bool
pub fn is_assert(&self) -> bool
pub fn is_call(&self) -> bool
pub fn is_abort(&self) -> bool
pub fn is_return(&self) -> bool
pub fn is_break(&self) -> bool
pub fn is_continue(&self) -> bool
pub fn is_nop(&self) -> bool
pub fn is_switch(&self) -> bool
pub fn is_loop(&self) -> bool
pub fn is_error(&self) -> bool
source§impl RawStatement
impl RawStatement
pub fn to_assign(self) -> Option<(Place, Rvalue)>
pub fn to_fake_read(self) -> Option<Place>
pub fn to_set_discriminant(self) -> Option<(Place, VariantId)>
pub fn to_drop(self) -> Option<Place>
pub fn to_assert(self) -> Option<Assert>
pub fn to_call(self) -> Option<Call>
pub fn to_abort(self) -> Option<AbortKind>
pub fn to_return(self) -> Option<()>
pub fn to_break(self) -> Option<usize>
pub fn to_continue(self) -> Option<usize>
pub fn to_nop(self) -> Option<()>
pub fn to_switch(self) -> Option<Switch>
pub fn to_loop(self) -> Option<Block>
pub fn to_error(self) -> Option<String>
source§impl RawStatement
impl RawStatement
pub fn as_assign(&self) -> Option<(&Place, &Rvalue)>
pub fn as_fake_read(&self) -> Option<&Place>
pub fn as_set_discriminant(&self) -> Option<(&Place, &VariantId)>
pub fn as_drop(&self) -> Option<&Place>
pub fn as_assert(&self) -> Option<&Assert>
pub fn as_call(&self) -> Option<&Call>
pub fn as_abort(&self) -> Option<&AbortKind>
pub fn as_return(&self) -> Option<()>
pub fn as_break(&self) -> Option<&usize>
pub fn as_continue(&self) -> Option<&usize>
pub fn as_nop(&self) -> Option<()>
pub fn as_switch(&self) -> Option<&Switch>
pub fn as_loop(&self) -> Option<&Block>
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_fake_read_mut(&mut self) -> Option<&mut Place>
pub fn as_set_discriminant_mut( &mut self, ) -> Option<(&mut Place, &mut VariantId)>
pub fn as_drop_mut(&mut self) -> Option<&mut Place>
pub fn as_assert_mut(&mut self) -> Option<&mut Assert>
pub fn as_call_mut(&mut self) -> Option<&mut Call>
pub fn as_abort_mut(&mut self) -> Option<&mut AbortKind>
pub fn as_return_mut(&mut self) -> Option<()>
pub fn as_break_mut(&mut self) -> Option<&mut usize>
pub fn as_continue_mut(&mut self) -> Option<&mut usize>
pub fn as_nop_mut(&mut self) -> Option<()>
pub fn as_switch_mut(&mut self) -> Option<&mut Switch>
pub fn as_loop_mut(&mut self) -> Option<&mut Block>
pub fn as_error_mut(&mut self) -> Option<&mut String>
Trait Implementations§
source§impl Clone for RawStatement
impl Clone for RawStatement
source§fn clone(&self) -> RawStatement
fn clone(&self) -> RawStatement
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. 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§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
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more