diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 69ca3db466c1..43cef14699a4 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -318,11 +318,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { discr: &mir::Operand<'tcx>, ) -> Option { // First do a quick test if there are any `expect` intrinsics in the BB. - - let Some(discr) = discr.place() else { - return None; - }; - if let Some(ref blocks) = self.blocks_with_expect { if !blocks.contains(bb) { return None; @@ -331,6 +326,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { return None; } + let Some(discr) = discr.place() else { + return None; + }; + // There are `expect` intrinsics in the BB, so we need to do the full analysis. // Groups of variables which have the same value