@@ -358,7 +358,8 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
358358 fulfill_cx. register_predicate_obligation ( self , obligation) ;
359359 if fulfill_cx. select_all_or_error ( self ) . is_empty ( ) {
360360 return Ok ( (
361- ty:: ClosureKind :: from_def_id ( self . tcx , trait_def_id)
361+ self . tcx
362+ . fn_trait_kind_from_def_id ( trait_def_id)
362363 . expect ( "expected to map DefId to ClosureKind" ) ,
363364 ty. rebind ( self . resolve_vars_if_possible ( var) ) ,
364365 ) ) ;
@@ -687,7 +688,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
687688 }
688689 ObligationCauseCode :: BindingObligation ( def_id, _)
689690 | ObligationCauseCode :: ItemObligation ( def_id)
690- if ty :: ClosureKind :: from_def_id ( tcx, * def_id ) . is_some ( ) =>
691+ if tcx. is_fn_trait ( * def_id ) =>
691692 {
692693 err. code ( rustc_errors:: error_code!( E0059 ) ) ;
693694 err. set_primary_message ( format ! (
@@ -847,8 +848,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
847848 ) ;
848849 }
849850
850- let is_fn_trait =
851- ty:: ClosureKind :: from_def_id ( tcx, trait_ref. def_id ( ) ) . is_some ( ) ;
851+ let is_fn_trait = tcx. is_fn_trait ( trait_ref. def_id ( ) ) ;
852852 let is_target_feature_fn = if let ty:: FnDef ( def_id, _) =
853853 * trait_ref. skip_binder ( ) . self_ty ( ) . kind ( )
854854 {
@@ -878,7 +878,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
878878 // Note if the `FnMut` or `FnOnce` is less general than the trait we're trying
879879 // to implement.
880880 let selected_kind =
881- ty :: ClosureKind :: from_def_id ( self . tcx , trait_ref. def_id ( ) )
881+ self . tcx . fn_trait_kind_from_def_id ( trait_ref. def_id ( ) )
882882 . expect ( "expected to map DefId to ClosureKind" ) ;
883883 if !implemented_kind. extends ( selected_kind) {
884884 err. note (
@@ -2154,7 +2154,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
21542154 if generics. params . iter ( ) . any ( |p| p. name != kw:: SelfUpper )
21552155 && !snippet. ends_with ( '>' )
21562156 && !generics. has_impl_trait ( )
2157- && !self . tcx . fn_trait_kind_from_lang_item ( def_id) . is_some ( )
2157+ && !self . tcx . is_fn_trait ( def_id)
21582158 {
21592159 // FIXME: To avoid spurious suggestions in functions where type arguments
21602160 // where already supplied, we check the snippet to make sure it doesn't
0 commit comments