-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Clean up MIR drop generation #61872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up MIR drop generation #61872
Changes from all commits
62bec71
101a2f5
82a1a89
be23bd4
b86e675
3131427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,20 +179,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | |
// conduct the test, if necessary | ||
let body_block; | ||
if let Some(cond_expr) = opt_cond_expr { | ||
|
||
let loop_block_end; | ||
let cond = unpack!( | ||
loop_block_end = this.as_local_operand(loop_block, cond_expr) | ||
); | ||
body_block = this.cfg.start_new_block(); | ||
let term = | ||
TerminatorKind::if_(this.hir.tcx(), cond, body_block, exit_block); | ||
this.cfg.terminate(loop_block_end, source_info, term); | ||
let cond_expr = this.hir.mirror(cond_expr); | ||
let (true_block, false_block) | ||
= this.test_bool(loop_block, cond_expr, source_info); | ||
body_block = true_block; | ||
|
||
// if the test is false, there's no `break` to assign `destination`, so | ||
// we have to do it; this overwrites any `break`-assigned value but it's | ||
// always `()` anyway | ||
this.cfg | ||
.push_assign_unit(exit_block, source_info, destination); | ||
// we have to do it | ||
this.cfg.push_assign_unit(false_block, source_info, destination); | ||
this.cfg.terminate( | ||
false_block, | ||
source_info, | ||
TerminatorKind::Goto { target: exit_block }, | ||
); | ||
} else { | ||
body_block = this.cfg.start_new_block(); | ||
let diverge_cleanup = this.diverge_cleanup(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.