]> git.lizzy.rs Git - rust.git/commitdiff
add lifetime for `while` and `for` expression
authorFuGangqiang <fu_gangqiang@163.com>
Sat, 21 Mar 2015 15:59:30 +0000 (23:59 +0800)
committerFuGangqiang <fu_gangqiang@163.com>
Sat, 21 Mar 2015 15:59:30 +0000 (23:59 +0800)
src/doc/reference.md

index b23a8d91069ee02f0ba24fcb32fd82545b92d753..415ec4e4fbf0a4bc661caa3ee26558908310b851 100644 (file)
@@ -3158,7 +3158,7 @@ ten_times(|j| println!("hello, {}", j));
 ### While loops
 
 ```{.ebnf .gram}
-while_expr : "while" no_struct_literal_expr '{' block '}' ;
+while_expr : [ lifetime ':' ] "while" no_struct_literal_expr '{' block '}' ;
 ```
 
 A `while` loop begins by evaluating the boolean loop conditional expression.
@@ -3223,7 +3223,7 @@ A `continue` expression is only permitted in the body of a loop.
 ### For expressions
 
 ```{.ebnf .gram}
-for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ;
+for_expr : [ lifetime ':' ] "for" pat "in" no_struct_literal_expr '{' block '}' ;
 ```
 
 A `for` expression is a syntactic construct for looping over elements provided