@@ -753,23 +753,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
753753 if let ( UnderspecifiedArgKind :: Const { .. } , Some ( parent_data) ) =
754754 ( & arg_data. kind , & arg_data. parent )
755755 {
756- let has_impl_trait =
757- self . tcx . generics_of ( parent_data. def_id ) . params . iter ( ) . any ( |param| {
758- matches ! (
759- param. kind,
760- ty:: GenericParamDefKind :: Type {
761- synthetic: Some (
762- hir:: SyntheticTyParamKind :: ImplTrait
763- | hir:: SyntheticTyParamKind :: FromAttr ,
764- ) ,
765- ..
766- }
767- )
768- } ) ;
769-
770756 // (#83606): Do not emit a suggestion if the parent has an `impl Trait`
771757 // as an argument otherwise it will cause the E0282 error.
772- if !has_impl_trait || self . tcx . features ( ) . explicit_generic_args_with_impl_trait {
758+ if !self . tcx . generics_of ( parent_data. def_id ) . has_impl_trait ( )
759+ || self . tcx . features ( ) . explicit_generic_args_with_impl_trait
760+ {
773761 err. span_suggestion_verbose (
774762 span,
775763 "consider specifying the const argument" ,
@@ -814,7 +802,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
814802 let borrow = typeck_results. borrow ( ) ;
815803 if let Some ( ( DefKind :: AssocFn , did) ) = borrow. type_dependent_def ( e. hir_id ) {
816804 let generics = self . tcx . generics_of ( did) ;
817- if !generics. params . is_empty ( ) {
805+ if !generics. params . is_empty ( ) && !generics . has_impl_trait ( ) {
818806 err. span_suggestion_verbose (
819807 segment. ident . span . shrink_to_hi ( ) ,
820808 & format ! (
0 commit comments