@@ -175,6 +175,11 @@ fn suggest_restriction(
175
175
trait_ref : ty:: PolyTraitRef < ' _ > ,
176
176
super_traits : Option < ( & Ident , & hir:: GenericBounds < ' _ > ) > ,
177
177
) {
178
+ // When we are dealing with a trait, `super_traits` will be `Some`:
179
+ // Given `trait T: A + B + C {}`
180
+ // - ^^^^^^^^^ GenericBounds
181
+ // |
182
+ // &Ident
178
183
let span = generics. where_clause . span_for_predicates_or_empty_place ( ) ;
179
184
if span. from_expansion ( ) || span. desugaring_kind ( ) . is_some ( ) {
180
185
return ;
@@ -311,7 +316,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
311
316
ident,
312
317
kind : hir:: ItemKind :: Trait ( _, _, generics, bounds, _) ,
313
318
..
314
- } ) if param_ty && self_ty == self . tcx . types . self_param => {
319
+ } ) if self_ty == self . tcx . types . self_param => {
320
+ assert ! ( param_ty) ;
315
321
// Restricting `Self` for a single method.
316
322
suggest_restriction (
317
323
& generics,
@@ -329,7 +335,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
329
335
generics,
330
336
kind : hir:: TraitItemKind :: Fn ( ..) ,
331
337
..
332
- } ) if param_ty && self_ty == self . tcx . types . self_param => {
338
+ } ) if self_ty == self . tcx . types . self_param => {
339
+ assert ! ( param_ty) ;
333
340
// Restricting `Self` for a single method.
334
341
suggest_restriction (
335
342
& generics, "`Self`" , err, None , projection, trait_ref, None ,
0 commit comments