Skip to content

Commit cc0c8c2

Browse files
committed
---
yaml --- r: 188376 b: refs/heads/auto c: 481b21c h: refs/heads/master v: v3
1 parent 0e848dd commit cc0c8c2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: f1fe1b5d4f120e73735f133153794592835369df
13+
refs/heads/auto: 481b21cf1927a84d6fea1b7389a3a8d827656998
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/grammar/parser-lalr.y

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ extern char *yytext;
152152
%precedence MOD_SEP
153153
%precedence RARROW ':'
154154
155+
// In where clauses, "for" should have greater precedence when used as
156+
// a higher ranked constraint than when used as the beginning of a
157+
// for_in_type (which is a ty)
158+
%precedence FORTYPE
159+
%precedence FOR
160+
155161
// Binops & unops, and their precedences
156162
%precedence BOX
157163
%precedence BOXPLACE
@@ -777,10 +783,14 @@ where_predicates
777783
;
778784

779785
where_predicate
780-
: lifetime ':' bounds { $$ = mk_node("WherePredicate", 2, $1, $3); }
781-
| ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 2, $1, $3); }
786+
: maybe_for_lifetimes lifetime ':' bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
787+
| maybe_for_lifetimes ty ':' ty_param_bounds { $$ = mk_node("WherePredicate", 3, $1, $2, $4); }
782788
;
783789

790+
maybe_for_lifetimes
791+
: FOR '<' lifetimes '>' { $$ = mk_none(); }
792+
| %prec FORTYPE %empty { $$ = mk_none(); }
793+
784794
ty_params
785795
: ty_param { $$ = mk_node("TyParams", 1, $1); }
786796
| ty_params ',' ty_param { $$ = ext_node($1, 1, $3); }

0 commit comments

Comments
 (0)