@@ -232,8 +232,7 @@ fn missing_items_err(
232
232
} ;
233
233
234
234
// 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) ;
237
236
let ( mut missing_trait_item, mut missing_trait_item_none, mut missing_trait_item_label) =
238
237
( Vec :: new ( ) , Vec :: new ( ) , Vec :: new ( ) ) ;
239
238
@@ -356,6 +355,10 @@ fn bounds_from_generic_predicates<'tcx>(
356
355
let mut types_str = vec ! [ ] ;
357
356
for ( ty, bounds) in types {
358
357
if let ty:: Param ( _) = ty. kind ( ) {
358
+ let ty_str = ty. to_string ( ) ;
359
+ if ty_str. contains ( "impl " ) {
360
+ continue ;
361
+ }
359
362
let mut bounds_str = vec ! [ ] ;
360
363
for bound in bounds {
361
364
let mut projections_str = vec ! [ ] ;
@@ -376,9 +379,9 @@ fn bounds_from_generic_predicates<'tcx>(
376
379
}
377
380
}
378
381
if bounds_str. is_empty ( ) {
379
- types_str. push ( ty . to_string ( ) ) ;
382
+ types_str. push ( ty_str ) ;
380
383
} else {
381
- types_str. push ( format ! ( "{}: {}" , ty , bounds_str. join( " + " ) ) ) ;
384
+ types_str. push ( format ! ( "{}: {}" , ty_str , bounds_str. join( " + " ) ) ) ;
382
385
}
383
386
} else {
384
387
// Avoid suggesting the following:
@@ -475,7 +478,7 @@ fn fn_sig_suggestion<'tcx>(
475
478
let ( generics, where_clauses) = bounds_from_generic_predicates ( tcx, predicates) ;
476
479
477
480
// 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
479
482
// lifetimes between the `impl` and the `trait`, but this should be good enough to
480
483
// fill in a significant portion of the missing code, and other subsequent
481
484
// suggestions can help the user fix the code.
0 commit comments