Skip to content

Commit 5ba0056

Browse files
committed
Use TyCtxt::is_fn_trait is a couple more places
1 parent ea44792 commit 5ba0056

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
399399
self_ty.highlight.maybe_highlighting_region(vid, actual_has_vid);
400400

401401
if self_ty.value.is_closure()
402-
&& self
403-
.tcx()
404-
.fn_trait_kind_from_def_id(expected_trait_ref.value.def_id)
405-
.is_some()
402+
&& self.tcx().is_fn_trait(expected_trait_ref.value.def_id)
406403
{
407404
let closure_sig = self_ty.map(|closure| {
408405
if let ty::Closure(_, substs) = closure.kind() {

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1764,8 +1764,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
17641764
.enumerate()
17651765
.find(|(other_idx, (pred, _))| match pred.kind().skip_binder() {
17661766
ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred))
1767-
if self.tcx.fn_trait_kind_from_def_id(trait_pred.def_id())
1768-
.is_some()
1767+
if self.tcx.is_fn_trait(trait_pred.def_id())
17691768
&& other_idx != idx
17701769
// Make sure that the self type matches
17711770
// (i.e. constraining this closure)

0 commit comments

Comments
 (0)