@@ -355,40 +355,35 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
355355 }
356356}
357357
358- fn ensure_no_ty_param_bounds ( tcx : TyCtxt ,
359- span : Span ,
360- generics : & hir:: Generics ,
361- thing : & ' static str ) {
358+ fn ensure_no_param_bounds ( tcx : TyCtxt ,
359+ span : Span ,
360+ generics : & hir:: Generics ,
361+ thing : & ' static str ) {
362362 let mut warn = false ;
363363
364364 for ty_param in generics. ty_params ( ) {
365- for bound in ty_param. bounds . iter ( ) {
366- match * bound {
367- hir:: TraitTyParamBound ( ..) => {
368- warn = true ;
369- }
370- hir:: RegionTyParamBound ( ..) => { }
371- }
365+ if !ty_param. bounds . is_empty ( ) {
366+ warn = true ;
372367 }
373368 }
374369
375- for predicate in generics. where_clause . predicates . iter ( ) {
376- match * predicate {
377- hir:: WherePredicate :: BoundPredicate ( ..) => {
378- warn = true ;
379- }
380- hir:: WherePredicate :: RegionPredicate ( ..) => { }
381- hir:: WherePredicate :: EqPredicate ( ..) => { }
370+ for lft_param in generics. lifetimes ( ) {
371+ if !lft_param. bounds . is_empty ( ) {
372+ warn = true ;
382373 }
383374 }
384375
376+ if !generics. where_clause . predicates . is_empty ( ) {
377+ warn = true ;
378+ }
379+
385380 if warn {
386381 // According to accepted RFC #XXX, we should
387382 // eventually accept these, but it will not be
388383 // part of this PR. Still, convert to warning to
389384 // make bootstrapping easier.
390385 span_warn ! ( tcx. sess, span, E0122 ,
391- "trait bounds are ignored in {} definitions " ,
386+ "bounds are ignored in {}" ,
392387 thing) ;
393388 }
394389}
@@ -454,7 +449,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
454449 }
455450 } ,
456451 hir:: ItemTy ( _, ref generics) => {
457- ensure_no_ty_param_bounds ( tcx, it. span , generics, "type" ) ;
452+ ensure_no_param_bounds ( tcx, it. span , generics, "type aliases " ) ;
458453 tcx. generics_of ( def_id) ;
459454 tcx. type_of ( def_id) ;
460455 tcx. predicates_of ( def_id) ;
0 commit comments