mir: Don't forget to drop arguments.
This commit is contained in:
parent
cfd768e2e6
commit
5f990fb4f0
@ -141,14 +141,17 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
||||
.chain(explicits)
|
||||
.enumerate()
|
||||
.map(|(index, (ty, pattern))| {
|
||||
let lvalue = Lvalue::Arg(index as u32);
|
||||
if let Some(pattern) = pattern {
|
||||
let lvalue = Lvalue::Arg(index as u32);
|
||||
let pattern = this.hir.irrefutable_pat(pattern);
|
||||
unpack!(block = this.lvalue_into_pattern(block,
|
||||
argument_extent,
|
||||
pattern,
|
||||
&lvalue));
|
||||
}
|
||||
// Make sure we drop (parts of) the argument even when not matched on.
|
||||
this.schedule_drop(pattern.as_ref().map_or(ast_block.span, |pat| pat.span),
|
||||
argument_extent, &lvalue, ty);
|
||||
ArgDecl { ty: ty, spread: false }
|
||||
})
|
||||
.collect();
|
||||
|
Loading…
Reference in New Issue
Block a user