Add some suggested comments around drops
This commit is contained in:
parent
ed5bc60d4e
commit
1917ffe314
2 changed files with 9 additions and 2 deletions
|
|
@ -331,12 +331,16 @@ fn insert_entry_point<'tcx>(mir: &mut Mir<'tcx>,
|
|||
}
|
||||
|
||||
fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
mir: &mut Mir<'tcx>) {
|
||||
def_id: DefId,
|
||||
mir: &mut Mir<'tcx>) {
|
||||
use util::elaborate_drops::{elaborate_drop, Unwind};
|
||||
use util::patch::MirPatch;
|
||||
use shim::DropShimElaborator;
|
||||
|
||||
// Note that `elaborate_drops` only drops the upvars of a generator, and
|
||||
// this is ok because `open_drop` can only be reached within that own
|
||||
// generator's resume function.
|
||||
|
||||
let param_env = tcx.param_env(def_id);
|
||||
let gen = self_arg();
|
||||
|
||||
|
|
|
|||
|
|
@ -752,6 +752,9 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
|
|||
fn open_drop<'a>(&mut self) -> BasicBlock {
|
||||
let ty = self.lvalue_ty(self.lvalue);
|
||||
match ty.sty {
|
||||
// Note that `elaborate_drops` only drops the upvars of a generator,
|
||||
// and this is ok because `open_drop` here can only be reached
|
||||
// within that own generator's resume function.
|
||||
ty::TyClosure(def_id, substs) |
|
||||
ty::TyGenerator(def_id, substs, _) => {
|
||||
let tys : Vec<_> = substs.upvar_tys(def_id, self.tcx()).collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue