1
Fork 0

Fix merge of scope.rs

This commit is contained in:
John Kåre Alsaker 2017-08-11 04:24:25 +02:00
parent b8aa595e6d
commit 2d30e7e982

View file

@ -875,15 +875,13 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>,
// for us to diverge into in case the drop panics.
let on_diverge = iter.peek().iter().filter_map(|dd| {
match dd.kind {
DropKind::Value {
cached_block: CachedBlock {
unwind: None,
generator_drop: None,
DropKind::Value { cached_block } => {
let result = cached_block.get(generator_drop);
if result.is_none() {
span_bug!(drop_data.span, "cached block not present?")
}
} => {
span_bug!(drop_data.span, "cached block not present?")
}
DropKind::Value { cached_block } => cached_block.get(generator_drop),
result
},
DropKind::Storage => None
}
}).next();
@ -903,6 +901,11 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>,
DropKind::Storage => {}
}
// We do not need to emit StorageDead for generator drops
if generator_drop {
continue
}
// Drop the storage for both value and storage drops.
// Only temps and vars need their storage dead.
match drop_data.location {