about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-13 00:56:29 +0000
committerMichael Goulet <michael@errs.io>2022-08-25 23:32:46 +0000
commitc655d4b23362b812a39a205f89c2ecfc7578b6a3 (patch)
tree29348c695d4f1b74802f35f1afd088bfae09451d
parent7480389611f9d04bd34adf41a2b3029be4eb815e (diff)
downloadrust-c655d4b23362b812a39a205f89c2ecfc7578b6a3.tar.gz
rust-c655d4b23362b812a39a205f89c2ecfc7578b6a3.zip
Don't create an extra infcx in report_closure_arg_mismatch
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index a93f9ec0397..50b5101c05a 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -20,7 +20,6 @@ use rustc_hir::def_id::DefId;
 use rustc_hir::intravisit::Visitor;
 use rustc_hir::lang_items::LangItem;
 use rustc_hir::{AsyncGeneratorKind, GeneratorKind, Node};
-use rustc_infer::infer::TyCtxtInferExt;
 use rustc_middle::hir::map;
 use rustc_middle::ty::{
     self, suggest_arbitrary_trait_bound, suggest_constraining_type_param, AdtKind, DefIdTree,
@@ -1633,8 +1632,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
         let expected = build_fn_sig_ty(self.tcx, expected);
         let found = build_fn_sig_ty(self.tcx, found);
 
-        let (expected_str, found_str) =
-            self.tcx.infer_ctxt().enter(|infcx| infcx.cmp(expected, found));
+        let (expected_str, found_str) = self.cmp(expected, found);
 
         let signature_kind = format!("{argument_kind} signature");
         err.note_expected_found(&signature_kind, expected_str, &signature_kind, found_str);