pub fn elaborate_drop<'a>(&mut self, bb: BasicBlock) {
        debug!("elaborate_drop({:?})", self);
        let style = self.elaborator.drop_style(self.path, DropFlagMode::Deep);
        debug!("elaborate_drop({:?}): live - {:?}", self, style);
        match style {
            DropStyle::Dead => {
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: self.succ
                });
            }
            DropStyle::Static => {
                let loc = self.terminator_loc(bb);
                self.elaborator.clear_drop_flag(loc, self.path, DropFlagMode::Deep);
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Drop {
                    location: self.lvalue.clone(),
                    target: self.succ,
                    unwind: self.unwind
                });
            }
            DropStyle::Conditional => {
                let is_cleanup = self.is_cleanup; // FIXME(#6393)
                let succ = self.succ;
                let drop_bb = self.complete_drop(
                    is_cleanup, Some(DropFlagMode::Deep), succ);
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: drop_bb
                });
            }
            DropStyle::Open => {
                let drop_bb = self.open_drop();
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: drop_bb
                });
            }
        }
    }
/// This elaborates a single drop instruction, located at `bb`, and
/// patches over it.
///
/// The elaborated drop checks the drop flags to only drop what
/// is initialized.
///
/// In addition, the relevant drop flags also need to be cleared
/// to avoid double-drops. However, in the middle of a complex
/// drop, one must avoid clearing some of the flags before they
/// are read, as that would cause a memory leak.
///
/// In particular, when dropping an ADT, multiple fields may be
/// joined together under the `rest` subpath. They are all controlled
/// by the primary drop flag, but only the last rest-field dropped
/// should clear it (and it must also not clear anything else).
///
/// FIXME: I think we should just control the flags externally
/// and then we do not need this machinery.
This elaborates a single drop instruction, located at `bb`, and
patches over it.

The elaborated drop checks the drop flags to only drop what
is initialized.

In addition, the relevant drop flags also need to be cleared
to avoid double-drops. However, in the middle of a complex
drop, one must avoid clearing some of the flags before they
are read, as that would cause a memory leak.

In particular, when dropping an ADT, multiple fields may be
joined together under the `rest` subpath. They are all controlled
by the primary drop flag, but only the last rest-field dropped
should clear it (and it must also not clear anything else).

I think we should just control the flags externally
and then we do not need this machinery.
This elaborates a single drop instruction located at ` bb ` and patches over it . The elaborated drop checks the drop flags to only drop what is initialized . In addition the relevant drop flags also need to be cleared to avoid double - drops . However in the middle of a complex drop one must avoid clearing some of the flags before they are read as that would cause a memory leak . In particular when dropping an ADT multiple fields may be joined together under the ` rest ` subpath . They are all controlled by the primary drop flag but only the last rest - field dropped should clear it ( and it must also not clear anything else ) . I think we should just control the flags externally and then we do not need this machinery .
pub fn elaborate_drop<'a>(&mut self, bb: BasicBlock) {
        debug!("elaborate_drop({:?})", self);
        let style = self.elaborator.drop_style(self.path, DropFlagMode::Deep);
        debug!("elaborate_drop({:?}): live - {:?}", self, style);
        match style {
            DropStyle::Dead => {
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: self.succ
                });
            }
            DropStyle::Static => {
                let loc = self.terminator_loc(bb);
                self.elaborator.clear_drop_flag(loc, self.path, DropFlagMode::Deep);
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Drop {
                    location: self.lvalue.clone(),
                    target: self.succ,
                    unwind: self.unwind
                });
            }
            DropStyle::Conditional => {
                let is_cleanup = self.is_cleanup; // FIXME(#6393)
                let succ = self.succ;
                let drop_bb = self.complete_drop(
                    is_cleanup, Some(DropFlagMode::Deep), succ);
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: drop_bb
                });
            }
            DropStyle::Open => {
                let drop_bb = self.open_drop();
                self.elaborator.patch().patch_terminator(bb, TerminatorKind::Goto {
                    target: drop_bb
                });
            }
        }
    }
pub fn elaborate_drop < ' a > ( & mut self , bb : BasicBlock ) { debug ! ( " " self ) ; let style = self . elaborator . drop_style ( self . path , DropFlagMode :: Deep ) ; debug ! ( " " self style ) ; match style { DropStyle :: Dead => { self . elaborator . patch ( ) . patch_terminator ( bb , TerminatorKind :: Goto { target : self . succ } ) ; } DropStyle :: Static => { let loc = self . terminator_loc ( bb ) ; self . elaborator . clear_drop_flag ( loc , self . path , DropFlagMode :: Deep ) ; self . elaborator . patch ( ) . patch_terminator ( bb , TerminatorKind :: Drop { location : self . lvalue . clone ( ) , target : self . succ , unwind : self . unwind } ) ; } DropStyle :: Conditional => { let is_cleanup = self . is_cleanup ; // FIXME(#6393) let succ = self . succ ; let drop_bb = self . complete_drop ( is_cleanup , Some ( DropFlagMode :: Deep ) , succ ) ; self . elaborator . patch ( ) . patch_terminator ( bb , TerminatorKind :: Goto { target : drop_bb } ) ; } DropStyle :: Open => { let drop_bb = self . open_drop ( ) ; self . elaborator . patch ( ) . patch_terminator ( bb , TerminatorKind :: Goto { target : drop_bb } ) ; } } }
This elaborates a single drop instruction, located at `bb`, and
patches over it.
This elaborates a single drop instruction located at ` bb ` and patches over it .
&mut self
bb
BasicBlock
&mut self
bb
BasicBlock