aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-21 16:18:47 -0700
committerGraydon Hoare <[email protected]>2010-09-21 16:18:47 -0700
commitb549721a2ebb46174211630c5df3df257c1ae160 (patch)
tree08c4d569c24dab1b2f6e761c208852fb77c5dac2 /src/boot
parentImplement preliminary form of structured compare. No boxes, vectors or string... (diff)
downloadrust-b549721a2ebb46174211630c5df3df257c1ae160.tar.xz
rust-b549721a2ebb46174211630c5df3df257c1ae160.zip
Tighten pattern parsing on 0-ary constructors.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/fe/item.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/boot/fe/item.ml b/src/boot/fe/item.ml
index 4173eb53..14ef6951 100644
--- a/src/boot/fe/item.ml
+++ b/src/boot/fe/item.ml
@@ -281,7 +281,11 @@ and parse_stmts (ps:pstate) : Ast.stmt array =
let parse_pat ps = either_get_left (parse_pat ps) in
let args =
match peek ps with
- LPAREN -> paren_comma_list parse_pat ps
+ LPAREN ->
+ let args = paren_comma_list parse_pat ps in
+ if Array.length args = 0
+ then raise (err "empty pattern argument list" ps)
+ else args
| _ -> [| |]
in
Left (Ast.PAT_tag (lv, args))