@@ -59,10 +59,10 @@ struct LifetimeContext<'a> {
5959enum ScopeChain < ' a > {
6060 /// EarlyScope(i, ['a, 'b, ...], s) extends s with early-bound
6161 /// lifetimes, assigning indexes 'a => i, 'b => i+1, ... etc.
62- EarlyScope ( subst:: ParamSpace , & ' a Vec < ast:: Lifetime > , Scope < ' a > ) ,
62+ EarlyScope ( subst:: ParamSpace , & ' a Vec < ast:: LifetimeDef > , Scope < ' a > ) ,
6363 /// LateScope(binder_id, ['a, 'b, ...], s) extends s with late-bound
6464 /// lifetimes introduced by the declaration binder_id.
65- LateScope ( ast:: NodeId , & ' a Vec < ast:: Lifetime > , Scope < ' a > ) ,
65+ LateScope ( ast:: NodeId , & ' a Vec < ast:: LifetimeDef > , Scope < ' a > ) ,
6666 /// lifetimes introduced by items within a code block are scoped
6767 /// to that block.
6868 BlockScope ( ast:: NodeId , Scope < ' a > ) ,
@@ -136,7 +136,7 @@ impl<'a, 'b> Visitor<Scope<'a>> for LifetimeContext<'b> {
136136 fn push_fn_scope ( this : & mut LifetimeContext ,
137137 ty : & ast:: Ty ,
138138 scope : Scope ,
139- lifetimes : & Vec < ast:: Lifetime > ) {
139+ lifetimes : & Vec < ast:: LifetimeDef > ) {
140140 let scope1 = LateScope ( ty. id , lifetimes, scope) ;
141141 this. check_lifetime_names ( lifetimes) ;
142142 debug ! ( "pushing fn scope id={} due to type" , ty. id) ;
@@ -216,7 +216,7 @@ impl<'a> LifetimeContext<'a> {
216216 walk ( self , & scope1)
217217 } else {
218218 let ( early, late) = generics. lifetimes . clone ( ) . partition (
219- |l| referenced_idents. iter ( ) . any ( |& i| i == l. name ) ) ;
219+ |l| referenced_idents. iter ( ) . any ( |& i| i == l. lifetime . name ) ) ;
220220
221221 let scope1 = EarlyScope ( subst:: FnSpace , & early, scope) ;
222222 let scope2 = LateScope ( n, & late, & scope1) ;
@@ -334,29 +334,39 @@ impl<'a> LifetimeContext<'a> {
334334 token:: get_name( lifetime_ref. name) ) . as_slice ( ) ) ;
335335 }
336336
337- fn check_lifetime_names ( & self , lifetimes : & Vec < ast:: Lifetime > ) {
337+ fn check_lifetime_names ( & self , lifetimes : & Vec < ast:: LifetimeDef > ) {
338338 for i in range ( 0 , lifetimes. len ( ) ) {
339339 let lifetime_i = lifetimes. get ( i) ;
340340
341341 let special_idents = [ special_idents:: static_lifetime] ;
342342 for lifetime in lifetimes. iter ( ) {
343- if special_idents. iter ( ) . any ( |& i| i. name == lifetime. name ) {
343+ if special_idents. iter ( ) . any ( |& i| i. name == lifetime. lifetime . name ) {
344344 self . sess . span_err (
345- lifetime. span ,
345+ lifetime. lifetime . span ,
346346 format ! ( "illegal lifetime parameter name: `{}`" ,
347- token:: get_name( lifetime. name) ) . as_slice ( ) ) ;
347+ token:: get_name( lifetime. lifetime. name) )
348+ . as_slice ( ) ) ;
348349 }
349350 }
350351
351352 for j in range ( i + 1 , lifetimes. len ( ) ) {
352353 let lifetime_j = lifetimes. get ( j) ;
353354
354- if lifetime_i. name == lifetime_j. name {
355+ if lifetime_i. lifetime . name == lifetime_j. lifetime . name {
355356 self . sess . span_err (
356- lifetime_j. span ,
357+ lifetime_j. lifetime . span ,
357358 format ! ( "lifetime name `{}` declared twice in \
358359 the same scope",
359- token:: get_name( lifetime_j. name) ) . as_slice ( ) ) ;
360+ token:: get_name( lifetime_j. lifetime. name) )
361+ . as_slice ( ) ) ;
362+ }
363+ }
364+
365+ for bound in lifetime_i. bounds . iter ( ) {
366+ if !self . sess . features . issue_5723_bootstrap . get ( ) {
367+ self . sess . span_err (
368+ bound. span ,
369+ "region bounds require `issue_5723_bootstrap`" ) ;
360370 }
361371 }
362372 }
@@ -379,28 +389,28 @@ impl<'a> LifetimeContext<'a> {
379389 }
380390}
381391
382- fn search_lifetimes ( lifetimes : & Vec < ast:: Lifetime > ,
392+ fn search_lifetimes ( lifetimes : & Vec < ast:: LifetimeDef > ,
383393 lifetime_ref : & ast:: Lifetime )
384394 -> Option < ( uint , ast:: NodeId ) > {
385395 for ( i, lifetime_decl) in lifetimes. iter ( ) . enumerate ( ) {
386- if lifetime_decl. name == lifetime_ref. name {
387- return Some ( ( i, lifetime_decl. id ) ) ;
396+ if lifetime_decl. lifetime . name == lifetime_ref. name {
397+ return Some ( ( i, lifetime_decl. lifetime . id ) ) ;
388398 }
389399 }
390400 return None ;
391401}
392402
393403///////////////////////////////////////////////////////////////////////////
394404
395- pub fn early_bound_lifetimes < ' a > ( generics : & ' a ast:: Generics ) -> Vec < ast:: Lifetime > {
405+ pub fn early_bound_lifetimes < ' a > ( generics : & ' a ast:: Generics ) -> Vec < ast:: LifetimeDef > {
396406 let referenced_idents = free_lifetimes ( & generics. ty_params ) ;
397407 if referenced_idents. is_empty ( ) {
398408 return Vec :: new ( ) ;
399409 }
400410
401411 generics. lifetimes . iter ( )
402- . filter ( |l| referenced_idents. iter ( ) . any ( |& i| i == l. name ) )
403- . map ( |l| * l )
412+ . filter ( |l| referenced_idents. iter ( ) . any ( |& i| i == l. lifetime . name ) )
413+ . map ( |l| ( * l ) . clone ( ) )
404414 . collect ( )
405415}
406416
0 commit comments