]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/callee.rs
Report an error if resolution of closure call functions failed
[rust.git] / compiler / rustc_typeck / src / check / callee.rs
index cb8f336721ad6a4d06c1c175e493e4575e803b32..9362daa3c889e1218291f46d39c6627bd08ef26d 100644 (file)
@@ -588,10 +588,17 @@ pub fn resolve(self, fcx: &FnCtxt<'a, 'tcx>) {
                 fcx.write_method_call(self.call_expr.hir_id, method_callee);
             }
             None => {
-                span_bug!(
+                // This can happen if `#![no_core]` is used and the `fn/fn_mut/fn_once`
+                // lang items are not defined (issue #86238).
+                let mut err = fcx.inh.tcx.sess.struct_span_err(
                     self.call_expr.span,
-                    "failed to find an overloaded call trait for closure call"
+                    "failed to find an overloaded call trait for closure call",
                 );
+                err.help(
+                    "make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
+                     and have an associated `call`/`call_mut`/`call_once` function",
+                );
+                err.emit();
             }
         }
     }