From f400bfd8fdce370a8ee29ee250ebb48a1c005ad6 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 17 Oct 2011 22:33:09 -0700 Subject: [PATCH 1/2] doc: Update 'alt' documentation to remove 'case' keyword --- doc/rust.texi | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/rust.texi b/doc/rust.texi index 5024dd47ed3a0..076aecb36e087 100644 --- a/doc/rust.texi +++ b/doc/rust.texi @@ -3353,10 +3353,9 @@ equal the type of the head expression. To execute a pattern @code{alt} expression, first the head expression is evaluated, then its value is sequentially compared to the patterns in the arms -until a match is found. The first arm with a matching @code{case} pattern is -chosen as the branch target of the @code{alt}, any variables bound by the -pattern are assigned to local slots in the arm's block, and control enters the -block. +until a match is found. The first arm with a matching pattern is chosen as the +branch target of the @code{alt}, any variables bound by the pattern are +assigned to local slots in the arm's block, and control enters the block. An example of a pattern @code{alt} expression: @@ -3366,13 +3365,13 @@ type list = tag(nil, cons(X, @@list)); let x: list = cons(10, cons(11, nil)); alt x @{ - case (cons(a, cons(b, _))) @{ + cons(a, cons(b, _)) @{ process_pair(a,b); @} - case (cons(v=10, _)) @{ + cons(v=10, _) @{ process_ten(v); @} - case (_) @{ + _ @{ fail; @} @} From 5950ae3c0e6cd9101c611ff61b0992eb01cb0822 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 17 Oct 2011 22:47:13 -0700 Subject: [PATCH 2/2] doc: Fix parse errors in list examples in documentation --- doc/rust.texi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/rust.texi b/doc/rust.texi index 076aecb36e087..fcca023d2553e 100644 --- a/doc/rust.texi +++ b/doc/rust.texi @@ -2133,7 +2133,7 @@ tag list @{ cons(T, @@list); @} -let a: list = cons(7, cons(13, nil)); +let a: list = cons(7, @@cons(13, @@nil)); @end example @@ -3360,16 +3360,16 @@ assigned to local slots in the arm's block, and control enters the block. An example of a pattern @code{alt} expression: @example -type list = tag(nil, cons(X, @@list)); +tag list @{ nil; cons(X, @@list); @} -let x: list = cons(10, cons(11, nil)); +let x: list = cons(10, @@cons(11, @@nil)); alt x @{ - cons(a, cons(b, _)) @{ + cons(a, @@cons(b, _)) @{ process_pair(a,b); @} - cons(v=10, _) @{ - process_ten(v); + cons(10, _) @{ + process_ten(); @} _ @{ fail;