diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index d77d898f3bda..cf2bf0d8f8b9 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1341,14 +1341,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method); Ok(method) } - Err(error) => Err(if segment.ident.name == kw::Empty { - self.dcx().span_delayed_bug(rcvr.span, "empty method name") - } else { - match self.report_method_error(expr.hir_id, rcvr_t, error, expected, false) { - Ok(diag) => diag.emit(), - Err(guar) => guar, + Err(error) => { + if segment.ident.name == kw::Empty { + span_bug!(rcvr.span, "empty method name") + } else { + match self.report_method_error(expr.hir_id, rcvr_t, error, expected, false) { + Ok(diag) => Err(diag.emit()), + Err(guar) => Err(guar), + } } - }), + } }; // Call the generic checker.