From 828bfb2c61aaac93325b00737362769d045b6438 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 7 Aug 2013 22:07:24 +0400 Subject: Fix incorrect non-exhaustive matching for fixed length vecs Code like this is fixed now: ``` fn foo(p: [u8, ..4]) { match p { [a, b, c, d] => {} }; } ``` Invalid constructors are not reported as errors yet: ``` fn foo(p: [u8, ..4]) { match p { [_, _, _] => {} // this should be error [_, _, _, _, _, .._] => {} // and this _ => {} } } ``` Issue #8311 is partially fixed by this commit. Fixed-length arrays in let statement are not yet allowed: ``` let [a, b, c] = [1, 2, 3]; // still fails ``` --- doc/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tutorial.md') diff --git a/doc/tutorial.md b/doc/tutorial.md index a5f2001eaf5..b721a3628c9 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1305,7 +1305,7 @@ match crayons[0] { A vector can be destructured using pattern matching: ~~~~ -let numbers: [int, ..3] = [1, 2, 3]; +let numbers: &[int] = &[1, 2, 3]; let score = match numbers { [] => 0, [a] => a * 10, -- cgit 1.4.1-3-g733a5 From b4fe85664536401e5ea68e6e7d1490b223843caa Mon Sep 17 00:00:00 2001 From: Maxim Kolganov Date: Fri, 9 Aug 2013 01:43:44 +0400 Subject: typo in tutorial --- doc/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tutorial.md') diff --git a/doc/tutorial.md b/doc/tutorial.md index 6e6b804aa9d..dc481d71438 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2195,7 +2195,7 @@ use std::float::consts::pi; # impl Shape for CircleStruct { fn area(&self) -> float { pi * square(self.radius) } } let concrete = @CircleStruct{center:Point{x:3f,y:4f},radius:5f}; -let mycircle: Circle = concrete as @Circle; +let mycircle: @Circle = concrete as @Circle; let nonsense = mycircle.radius() * mycircle.area(); ~~~ -- cgit 1.4.1-3-g733a5