pub trait DropElaborator<'a, 'tcx>: Debug {
    type Path: Copy + Debug;

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

Required Associated Types

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) ().

Required Methods

Returns how path should be dropped, given mode.

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

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.

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.

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.

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.

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.

Implementors