@@ -1422,7 +1422,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
14221422 let lifetime_i = & lifetimes[ i] ;
14231423
14241424 for lifetime in lifetimes {
1425- if lifetime. lifetime . is_static ( ) {
1425+ if lifetime. lifetime . is_static ( ) || lifetime . lifetime . name == "'_" {
14261426 let lifetime = lifetime. lifetime ;
14271427 let mut err = struct_span_err ! ( self . sess, lifetime. span, E0262 ,
14281428 "invalid lifetime parameter name: `{}`" , lifetime. name) ;
@@ -1452,7 +1452,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
14521452 self . check_lifetime_def_for_shadowing ( old_scope, & lifetime_i. lifetime ) ;
14531453
14541454 for bound in & lifetime_i. bounds {
1455- if !bound. is_static ( ) {
1455+ if bound. name == "'_" {
1456+ let mut err = struct_span_err ! ( self . sess, bound. span, E0637 ,
1457+ "invalid lifetime bound name: `{}`" , bound. name) ;
1458+ err. span_label ( bound. span ,
1459+ format ! ( "{} is a reserved lifetime name" , bound. name) ) ;
1460+ err. emit ( ) ;
1461+ } else if !bound. is_static ( ) {
14561462 self . resolve_lifetime_ref ( bound) ;
14571463 } else {
14581464 self . insert_lifetime ( bound, Region :: Static ) ;
0 commit comments