@@ -364,11 +364,11 @@ impl Validator<'mir, 'tcx> {
364364 match pred. skip_binder ( ) {
365365 ty:: ExistentialPredicate :: AutoTrait ( _)
366366 | ty:: ExistentialPredicate :: Projection ( _) => {
367- self . check_op ( ops:: ty:: TraitBound )
367+ self . check_op ( ops:: ty:: TraitBound ( kind ) )
368368 }
369369 ty:: ExistentialPredicate :: Trait ( trait_ref) => {
370370 if Some ( trait_ref. def_id ) != self . tcx . lang_items ( ) . sized_trait ( ) {
371- self . check_op ( ops:: ty:: TraitBound )
371+ self . check_op ( ops:: ty:: TraitBound ( kind ) )
372372 }
373373 }
374374 }
@@ -413,15 +413,19 @@ impl Validator<'mir, 'tcx> {
413413 let def = generics. type_param ( p, tcx) ;
414414 let span = tcx. def_span ( def. def_id ) ;
415415
416+ // These are part of the function signature, so treat them like
417+ // arguments when determining importance.
418+ let kind = LocalKind :: Arg ;
419+
416420 if constness == hir:: Constness :: Const {
417- self . check_op_spanned ( ops:: ty:: TraitBound , span) ;
421+ self . check_op_spanned ( ops:: ty:: TraitBound ( kind ) , span) ;
418422 } else if !tcx. features ( ) . const_fn
419423 || self . ccx . is_const_stable_const_fn ( )
420424 {
421425 // HACK: We shouldn't need the conditional above, but trait
422426 // bounds on containing impl blocks are wrongly being marked as
423427 // "not-const".
424- self . check_op_spanned ( ops:: ty:: TraitBound , span) ;
428+ self . check_op_spanned ( ops:: ty:: TraitBound ( kind ) , span) ;
425429 }
426430 }
427431 // other kinds of bounds are either tautologies
0 commit comments