We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e187f88 commit f8aaf9aCopy full SHA for f8aaf9a
compiler/rustc_mir_transform/src/const_goto.rs
@@ -57,6 +57,15 @@ impl<'tcx> MirPass<'tcx> for ConstGoto {
57
}
58
59
impl<'tcx> Visitor<'tcx> for ConstGotoOptimizationFinder<'_, 'tcx> {
60
+ fn visit_basic_block_data(&mut self, block: BasicBlock, data: &BasicBlockData<'tcx>) {
61
+ if data.is_cleanup {
62
+ // Because of the restrictions around control flow in cleanup blocks, we don't perform
63
+ // this optimization at all in such blocks.
64
+ return;
65
+ }
66
+ self.super_basic_block_data(block, data);
67
68
+
69
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
70
let _: Option<_> = try {
71
let target = terminator.kind.as_goto()?;
0 commit comments