We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Order
Option
Result
1 parent 01df146 commit 1b13179Copy full SHA for 1b13179
compiler/rustc_mir_transform/src/unreachable_enum_branching.rs
@@ -175,7 +175,10 @@ impl<'tcx> MirPass<'tcx> for UnreachableEnumBranching {
175
// ```
176
let otherwise_is_last_variant = !otherwise_is_empty_unreachable
177
&& allowed_variants.len() == 1
178
- && check_successors(&body.basic_blocks, targets.otherwise());
+ // Despite the LLVM issue, we hope that small enum can still be transformed.
179
+ // This is valuable for both `a <= b` and `if let Some/Ok(v)`.
180
+ && (targets.all_targets().len() <= 3
181
+ || check_successors(&body.basic_blocks, targets.otherwise()));
182
let replace_otherwise_to_unreachable = otherwise_is_last_variant
183
|| (!otherwise_is_empty_unreachable && allowed_variants.is_empty());
184
0 commit comments