[−][src]Trait rustc_mir::util::elaborate_drops::DropElaborator

pub trait DropElaborator<'a, 'tcx>: Debug {
    type Path: Copy + Debug;
    pub fn patch(&mut self) -> &mut MirPatch<'tcx>;
pub fn body(&self) -> &'a Body<'tcx>;
pub fn tcx(&self) -> TyCtxt<'tcx>;
pub fn param_env(&self) -> ParamEnv<'tcx>;
pub fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle;
pub fn get_drop_flag(&mut self, path: Self::Path) -> Option<Operand<'tcx>>;
pub fn clear_drop_flag(
        &mut self,
        location: Location,
        path: Self::Path,
        mode: DropFlagMode
    );
pub fn field_subpath(
        &self,
        path: Self::Path,
        field: Field
    ) -> Option<Self::Path>;
pub fn deref_subpath(&self, path: Self::Path) -> Option<Self::Path>;
pub fn downcast_subpath(
        &self,
        path: Self::Path,
        variant: VariantIdx
    ) -> Option<Self::Path>;
pub fn array_subpath(
        &self,
        path: Self::Path,
        index: u64,
        size: u64
    ) -> Option<Self::Path>; }

Associated Types

type Path: Copy + Debug[src]

The type representing paths that can be moved out of.

Users can move out of individual fields of a struct, such as a.b.c. This type is used to represent such move paths. Sometimes tracking individual move paths is not necessary, in which case this may be set to (for example) ().

Loading content...

Required methods

pub fn patch(&mut self) -> &mut MirPatch<'tcx>[src]

pub fn body(&self) -> &'a Body<'tcx>[src]

pub fn tcx(&self) -> TyCtxt<'tcx>[src]

pub fn param_env(&self) -> ParamEnv<'tcx>[src]

pub fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle[src]

Returns how path should be dropped, given mode.

pub fn get_drop_flag(&mut self, path: Self::Path) -> Option<Operand<'tcx>>[src]

Returns the drop flag of path as a MIR Operand (or None if path has no drop flag).

pub fn clear_drop_flag(
    &mut self,
    location: Location,
    path: Self::Path,
    mode: DropFlagMode
)
[src]

Modifies the MIR patch so that the drop flag of path (if any) is cleared at location.

If mode is deep, drop flags of all child paths should also be cleared by inserting additional statements.

pub fn field_subpath(
    &self,
    path: Self::Path,
    field: Field
) -> Option<Self::Path>
[src]

Returns the subpath of a field of path (or None if there is no dedicated subpath).

If this returns None, field will not get a dedicated drop flag.

pub fn deref_subpath(&self, path: Self::Path) -> Option<Self::Path>[src]

Returns the subpath of a dereference of path (or None if there is no dedicated subpath).

If this returns None, *path will not get a dedicated drop flag.

This is only relevant for Box<T>, where the contained T can be moved out of the box.

pub fn downcast_subpath(
    &self,
    path: Self::Path,
    variant: VariantIdx
) -> Option<Self::Path>
[src]

Returns the subpath of downcasting path to one of its variants.

If this returns None, the downcast of path will not get a dedicated drop flag.

pub fn array_subpath(
    &self,
    path: Self::Path,
    index: u64,
    size: u64
) -> Option<Self::Path>
[src]

Returns the subpath of indexing a fixed-size array path.

If this returns None, elements of path will not get a dedicated drop flag.

This is only relevant for array patterns, which can move out of individual array elements.

Loading content...

Implementors

impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx>[src]

type Path = MovePathIndex

impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx>[src]

type Path = ()

Loading content...