@@ -357,7 +357,8 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
357357 ocx. register_obligation ( obligation) ;
358358 if ocx. select_all_or_error ( ) . is_empty ( ) {
359359 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)
361362 . expect ( "expected to map DefId to ClosureKind" ) ,
362363 ty. rebind ( self . resolve_vars_if_possible ( var) ) ,
363364 ) ) ;
@@ -686,7 +687,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
686687 }
687688 ObligationCauseCode :: BindingObligation ( def_id, _)
688689 | ObligationCauseCode :: ItemObligation ( def_id)
689- if ty :: ClosureKind :: from_def_id ( tcx, * def_id ) . is_some ( ) =>
690+ if tcx. is_fn_trait ( * def_id ) =>
690691 {
691692 err. code ( rustc_errors:: error_code!( E0059 ) ) ;
692693 err. set_primary_message ( format ! (
@@ -846,8 +847,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
846847 ) ;
847848 }
848849
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 ( ) ) ;
851851 let is_target_feature_fn = if let ty:: FnDef ( def_id, _) =
852852 * trait_ref. skip_binder ( ) . self_ty ( ) . kind ( )
853853 {
@@ -877,7 +877,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
877877 // Note if the `FnMut` or `FnOnce` is less general than the trait we're trying
878878 // to implement.
879879 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 ( ) )
881881 . expect ( "expected to map DefId to ClosureKind" ) ;
882882 if !implemented_kind. extends ( selected_kind) {
883883 err. note (
@@ -2155,7 +2155,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
21552155 if generics. params . iter ( ) . any ( |p| p. name != kw:: SelfUpper )
21562156 && !snippet. ends_with ( '>' )
21572157 && !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)
21592159 {
21602160 // FIXME: To avoid spurious suggestions in functions where type arguments
21612161 // where already supplied, we check the snippet to make sure it doesn't
0 commit comments