Use upvar_tys in more places, make it a list
This commit is contained in:
parent
d12c6e947c
commit
99969d282b
17 changed files with 66 additions and 78 deletions
|
@ -860,20 +860,14 @@ where
|
|||
fn open_drop(&mut self) -> BasicBlock {
|
||||
let ty = self.place_ty(self.place);
|
||||
match ty.kind() {
|
||||
ty::Closure(_, args) => {
|
||||
let tys: Vec<_> = args.as_closure().upvar_tys().collect();
|
||||
self.open_drop_for_tuple(&tys)
|
||||
}
|
||||
ty::Closure(_, args) => self.open_drop_for_tuple(&args.as_closure().upvar_tys()),
|
||||
// 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.
|
||||
// This should only happen for the self argument on the resume function.
|
||||
// It effectively only contains upvars until the generator transformation runs.
|
||||
// See librustc_body/transform/generator.rs for more details.
|
||||
ty::Generator(_, args, _) => {
|
||||
let tys: Vec<_> = args.as_generator().upvar_tys().collect();
|
||||
self.open_drop_for_tuple(&tys)
|
||||
}
|
||||
ty::Generator(_, args, _) => self.open_drop_for_tuple(&args.as_generator().upvar_tys()),
|
||||
ty::Tuple(fields) => self.open_drop_for_tuple(fields),
|
||||
ty::Adt(def, args) => self.open_drop_for_adt(*def, args),
|
||||
ty::Dynamic(..) => self.complete_drop(self.succ, self.unwind),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue