pub enum DropKind {
Precise,
Conditional,
}Expand description
A Drop statement/terminator can mean two things, depending on what MIR phase we retrieved
from rustc: it could be a real drop, or it could be a “conditional drop”, which is where drop
may happen depending on whether the borrow-checker determines a drop is needed.
Variants§
Precise
A real drop. This calls <T as Destruct>::drop_in_place(&raw mut place) and marks the
place as moved-out-of. Use --desugar-drops to transform all such drops to an actual
function call.
The drop_in_place method is added by Charon to the Destruct trait to make it possible
to track drop code in polymorphic code. It contains the same code as the
core::ptr::drop_in_place<T> builtin would.
Drop are precise in MIR elaborated and optimized.
Conditional
A conditional drop, which may or may not end up running drop code depending on the code
path that led to it. A conditional drop may also become a partial drop (dropping only the
subplaces that haven’t been moved out of), may be conditional on the code path that led to
it, or become an async drop. The exact semantics are left intentionally unspecified by
rustc developers. To elaborate such drops into precise drops, pass --precise-drops to
Charon.
A conditional drop may also be passed an unaligned place when dropping fields of packed structs. Such a thing is UB for a precise drop.
Drop are conditional in MIR built and promoted.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DropKind
impl<'de> Deserialize<'de> for DropKind
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 DropKindwhere
V: Visitor,
impl<'s, V> Drive<'s, V> for DropKindwhere
V: Visitor,
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 DropKindwhere
V: Visitor,
impl<'s, V> DriveMut<'s, V> for DropKindwhere
V: Visitor,
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.impl Copy for DropKind
Auto Trait Implementations§
impl Freeze for DropKind
impl RefUnwindSafe for DropKind
impl Send for DropKind
impl Sync for DropKind
impl Unpin for DropKind
impl UnwindSafe for DropKind
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