]> git.lizzy.rs Git - rust.git/commitdiff
Address the PR review
authoralexey zabelin <zabelin.alex@gmail.com>
Thu, 13 Apr 2017 13:53:22 +0000 (09:53 -0400)
committeralexey zabelin <zabelin.alex@gmail.com>
Thu, 13 Apr 2017 13:53:22 +0000 (09:53 -0400)
src/doc/grammar.md
src/libsyntax/parse/parser.rs

index 239afd41f023a4b83973f0418099f9ef8bc302b5..3fbf9f06d99f6fdbb49f3143f5327ff9fb65d35d 100644 (file)
@@ -761,8 +761,6 @@ closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
                 [ ':' bound-list ] [ '->' type ]
 lifetime-list := lifetime | lifetime ',' lifetime-list
 arg-list := ident ':' type | ident ':' type ',' arg-list
-bound-list := bound | bound '+' bound-list
-bound := path | lifetime
 ```
 
 ### Never type
@@ -786,6 +784,7 @@ never_type : "!" ;
 bound := ty_bound | lt_bound
 lt_bound := lifetime
 ty_bound := [?] [ for<lt_param_defs> ] simple_path
+bound-list := bound | bound '+' bound-list '+' ?
 ```
 
 ### Self types
index 5cacb0da9e5d9db7dd393b3e5d0083b44ccb7db2..0fddbca72cdc18c5be8ed42608086b1ee1ee0052 100644 (file)
@@ -4066,7 +4066,7 @@ fn warn_missing_semicolon(&self) {
         }).emit();
     }
 
-    // Parse bounds of a type parameter `BOUND + BOUND + BOUND`.
+    // Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
     // BOUND = TY_BOUND | LT_BOUND
     // LT_BOUND = LIFETIME (e.g. `'a`)
     // TY_BOUND = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
@@ -4107,7 +4107,7 @@ fn parse_ty_param_bounds(&mut self) -> PResult<'a, TyParamBounds> {
         self.parse_ty_param_bounds_common(true)
     }
 
-    // Parse bounds of a type parameter `BOUND + BOUND + BOUND`.
+    // Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
     // BOUND = LT_BOUND (e.g. `'a`)
     fn parse_lt_param_bounds(&mut self) -> Vec<Lifetime> {
         let mut lifetimes = Vec::new();