struct DropScopeToken;Expand description
A token to ensuring that each drop scope is popped at most once, thanks to the compiler that checks moves.
Implementations§
Source§impl DropScopeToken
impl DropScopeToken
fn pop_and_drop<'db>( self, ctx: &mut MirLowerCtx<'_, 'db>, current: BasicBlockId, span: MirSpan, ) -> BasicBlockId
Sourcefn pop_assume_dropped(self, ctx: &mut MirLowerCtx<'_, '_>)
fn pop_assume_dropped(self, ctx: &mut MirLowerCtx<'_, '_>)
It is useful when we want a drop scope is syntactically closed, but we don’t want to execute any drop code. Either when the control flow is diverging (so drop code doesn’t reached) or when drop is handled for us (for example a block that ended with a return statement. Return will drop everything, so the block shouldn’t do anything)
Trait Implementations§
Source§impl Drop for DropScopeToken
impl Drop for DropScopeToken
Auto Trait Implementations§
impl Freeze for DropScopeToken
impl RefUnwindSafe for DropScopeToken
impl Send for DropScopeToken
impl Sync for DropScopeToken
impl Unpin for DropScopeToken
impl UnsafeUnpin for DropScopeToken
impl UnwindSafe for DropScopeToken
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§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