Skip to content

Commit 48fee7a

Browse files
committed
Use TyCtxt::is_fn_trait is a couple more places
1 parent 3d407cc commit 48fee7a

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
@@ -1769,8 +1769,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
17691769
.enumerate()
17701770
.find(|(other_idx, (pred, _))| match pred.kind().skip_binder() {
17711771
ty::PredicateKind::Trait(trait_pred)
1772-
if self.tcx.fn_trait_kind_from_def_id(trait_pred.def_id())
1773-
.is_some()
1772+
if self.tcx.is_fn_trait(trait_pred.def_id())
17741773
&& other_idx != idx
17751774
// Make sure that the self type matches
17761775
// (i.e. constraining this closure)

0 commit comments

Comments
 (0)