struct Scope {
    source_scope: SourceScope,
    region_scope: Scope,
    drops: Vec<DropData>,
    moved_locals: Vec<Local>,
    cached_unwind_block: Option<DropIdx>,
    cached_generator_drop_block: Option<DropIdx>,
}

Fields§

§source_scope: SourceScope

The source scope this scope was created in.

§region_scope: Scope

the region span of this scope within source code.

§drops: Vec<DropData>

set of places to drop when exiting this scope. This starts out empty but grows as variables are declared during the building process. This is a stack, so we always drop from the end of the vector (top of the stack) first.

§moved_locals: Vec<Local>§cached_unwind_block: Option<DropIdx>

The drop index that will drop everything in and below this scope on an unwind path.

§cached_generator_drop_block: Option<DropIdx>

The drop index that will drop everything in and below this scope on a generator drop path.

Implementations§

source§

impl Scope

source

fn needs_cleanup(&self) -> bool

Whether there’s anything to do for the cleanup path, that is, when unwinding through this scope. This includes destructors, but not StorageDead statements, which don’t get emitted at all for unwinding, for several reasons:

  • clang doesn’t emit llvm.lifetime.end for C++ unwinding
  • LLVM’s memory dependency analysis can’t handle it atm
  • polluting the cleanup MIR with StorageDead creates landing pads even though there’s no actual destructors
  • freeing up stack space has no effect during unwinding Note that for generators we do emit StorageDeads, for the use of optimizations in the MIR generator transform.
source

fn invalidate_cache(&mut self)

Trait Implementations§

source§

impl Debug for Scope

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Scope

§

impl !Send for Scope

§

impl !Sync for Scope

§

impl Unpin for Scope

§

impl UnwindSafe for Scope

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 72 bytes