]> git.lizzy.rs Git - rust.git/commitdiff
Use `TyCtxt::is_fn_trait` is a couple more places
authorMaybe Waffle <waffle.lapkin@gmail.com>
Tue, 22 Nov 2022 19:03:26 +0000 (19:03 +0000)
committerMaybe Waffle <waffle.lapkin@gmail.com>
Sun, 27 Nov 2022 07:20:28 +0000 (07:20 +0000)
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

index 3a74ac51b2c27196198e999feedb5c672c21a1a0..1f554c81eff8e1941453d2f0a544ec245cd16d51 100644 (file)
@@ -399,10 +399,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 self_ty.highlight.maybe_highlighting_region(vid, actual_has_vid);
 
                 if self_ty.value.is_closure()
-                    && self
-                        .tcx()
-                        .fn_trait_kind_from_def_id(expected_trait_ref.value.def_id)
-                        .is_some()
+                    && self.tcx().is_fn_trait(expected_trait_ref.value.def_id)
                 {
                     let closure_sig = self_ty.map(|closure| {
                         if let ty::Closure(_, substs) = closure.kind() {
index ddffe25bc263c5e95c8b02029205824a75e33217..2cb04b949546cc70b444f694069476930150d3ae 100644 (file)
@@ -1764,8 +1764,7 @@ fn note_conflicting_closure_bounds(
                 .enumerate()
                 .find(|(other_idx, (pred, _))| match pred.kind().skip_binder() {
                     ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred))
-                        if self.tcx.fn_trait_kind_from_def_id(trait_pred.def_id())
-                            .is_some()
+                        if self.tcx.is_fn_trait(trait_pred.def_id())
                             && other_idx != idx
                             // Make sure that the self type matches
                             // (i.e. constraining this closure)