Skip to content

Commit c97b86c

Browse files
committed
Move a span_delayed_bug.
So it's only called if necessary.
1 parent f73f5ca commit c97b86c

File tree

1 file changed

+6
-4
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+6
-4
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
857857
Ok(r)
858858
})
859859
.or_else(|error| {
860-
let guar = self
861-
.dcx()
862-
.span_delayed_bug(span, "method resolution should've emitted an error");
863860
let result = match error {
864861
method::MethodError::PrivateMatch(kind, def_id, _) => Ok((kind, def_id)),
865-
_ => Err(guar),
862+
_ => {
863+
let guar = self
864+
.dcx()
865+
.span_delayed_bug(span, "method resolution should've emitted an error");
866+
Err(guar)
867+
}
866868
};
867869

868870
let trait_missing_method =

0 commit comments

Comments
 (0)