Skip to content

Commit

Permalink
Use TyCtxt::is_fn_trait is a couple more places
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Nov 22, 2022
1 parent 3d407cc commit 48fee7a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1769,8 +1769,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
.enumerate()
.find(|(other_idx, (pred, _))| match pred.kind().skip_binder() {
ty::PredicateKind::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)
Expand Down

0 comments on commit 48fee7a

Please sign in to comment.