Fix issue #17216
The cleanup scope of for loop bindings should translated when popped to ensure resources are not leaked.
This commit is contained in:
parent
ccae356ace
commit
5857ec6d78
@ -357,7 +357,10 @@ pub fn trans_for<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
|
||||
|
||||
// Codegen the body.
|
||||
body_bcx_out = trans_block(body_bcx_out, body, expr::Ignore);
|
||||
body_bcx_out.fcx.pop_custom_cleanup_scope(binding_cleanup_scope);
|
||||
body_bcx_out =
|
||||
body_bcx_out.fcx
|
||||
.pop_and_trans_custom_cleanup_scope(body_bcx_out,
|
||||
binding_cleanup_scope);
|
||||
body_bcx_out =
|
||||
body_bcx_out.fcx
|
||||
.pop_and_trans_custom_cleanup_scope(body_bcx_out,
|
||||
|
Loading…
x
Reference in New Issue
Block a user