@@ -357,7 +357,8 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
357
357
ocx. register_obligation ( obligation) ;
358
358
if ocx. select_all_or_error ( ) . is_empty ( ) {
359
359
return Ok ( (
360
- ty:: ClosureKind :: from_def_id ( self . tcx , trait_def_id)
360
+ self . tcx
361
+ . fn_trait_kind_from_def_id ( trait_def_id)
361
362
. expect ( "expected to map DefId to ClosureKind" ) ,
362
363
ty. rebind ( self . resolve_vars_if_possible ( var) ) ,
363
364
) ) ;
@@ -686,7 +687,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
686
687
}
687
688
ObligationCauseCode :: BindingObligation ( def_id, _)
688
689
| ObligationCauseCode :: ItemObligation ( def_id)
689
- if ty :: ClosureKind :: from_def_id ( tcx, * def_id ) . is_some ( ) =>
690
+ if tcx. is_fn_trait ( * def_id ) =>
690
691
{
691
692
err. code ( rustc_errors:: error_code!( E0059 ) ) ;
692
693
err. set_primary_message ( format ! (
@@ -846,8 +847,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
846
847
) ;
847
848
}
848
849
849
- let is_fn_trait =
850
- ty:: ClosureKind :: from_def_id ( tcx, trait_ref. def_id ( ) ) . is_some ( ) ;
850
+ let is_fn_trait = tcx. is_fn_trait ( trait_ref. def_id ( ) ) ;
851
851
let is_target_feature_fn = if let ty:: FnDef ( def_id, _) =
852
852
* trait_ref. skip_binder ( ) . self_ty ( ) . kind ( )
853
853
{
@@ -877,7 +877,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
877
877
// Note if the `FnMut` or `FnOnce` is less general than the trait we're trying
878
878
// to implement.
879
879
let selected_kind =
880
- ty :: ClosureKind :: from_def_id ( self . tcx , trait_ref. def_id ( ) )
880
+ self . tcx . fn_trait_kind_from_def_id ( trait_ref. def_id ( ) )
881
881
. expect ( "expected to map DefId to ClosureKind" ) ;
882
882
if !implemented_kind. extends ( selected_kind) {
883
883
err. note (
@@ -2155,7 +2155,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2155
2155
if generics. params . iter ( ) . any ( |p| p. name != kw:: SelfUpper )
2156
2156
&& !snippet. ends_with ( '>' )
2157
2157
&& !generics. has_impl_trait ( )
2158
- && !self . tcx . fn_trait_kind_from_lang_item ( def_id) . is_some ( )
2158
+ && !self . tcx . is_fn_trait ( def_id)
2159
2159
{
2160
2160
// FIXME: To avoid spurious suggestions in functions where type arguments
2161
2161
// where already supplied, we check the snippet to make sure it doesn't
0 commit comments