@@ -232,8 +232,7 @@ fn missing_items_err(
232232 } ;
233233
234234 // Obtain the level of indentation ending in `sugg_sp`.
235- let padding =
236- tcx. sess . source_map ( ) . indentation_before ( sugg_sp) . unwrap_or_else ( || String :: new ( ) ) ;
235+ let padding = tcx. sess . source_map ( ) . indentation_before ( sugg_sp) . unwrap_or_else ( String :: new) ;
237236 let ( mut missing_trait_item, mut missing_trait_item_none, mut missing_trait_item_label) =
238237 ( Vec :: new ( ) , Vec :: new ( ) , Vec :: new ( ) ) ;
239238
@@ -356,6 +355,10 @@ fn bounds_from_generic_predicates<'tcx>(
356355 let mut types_str = vec ! [ ] ;
357356 for ( ty, bounds) in types {
358357 if let ty:: Param ( _) = ty. kind ( ) {
358+ let ty_str = ty. to_string ( ) ;
359+ if ty_str. contains ( "impl " ) {
360+ continue ;
361+ }
359362 let mut bounds_str = vec ! [ ] ;
360363 for bound in bounds {
361364 let mut projections_str = vec ! [ ] ;
@@ -376,9 +379,9 @@ fn bounds_from_generic_predicates<'tcx>(
376379 }
377380 }
378381 if bounds_str. is_empty ( ) {
379- types_str. push ( ty . to_string ( ) ) ;
382+ types_str. push ( ty_str ) ;
380383 } else {
381- types_str. push ( format ! ( "{}: {}" , ty , bounds_str. join( " + " ) ) ) ;
384+ types_str. push ( format ! ( "{}: {}" , ty_str , bounds_str. join( " + " ) ) ) ;
382385 }
383386 } else {
384387 // Avoid suggesting the following:
@@ -475,7 +478,7 @@ fn fn_sig_suggestion<'tcx>(
475478 let ( generics, where_clauses) = bounds_from_generic_predicates ( tcx, predicates) ;
476479
477480 // FIXME: this is not entirely correct, as the lifetimes from borrowed params will
478- // not be present in the `fn` definition, not will we account for renamed
481+ // not be present in the `fn` definition, nor will we account for renamed
479482 // lifetimes between the `impl` and the `trait`, but this should be good enough to
480483 // fill in a significant portion of the missing code, and other subsequent
481484 // suggestions can help the user fix the code.
0 commit comments