From 09a473ea7bd85361af971e2f66ec23cfe1d62362 Mon Sep 17 00:00:00 2001 From: Chris Hellmuth Date: Sun, 17 May 2015 00:19:53 -0700 Subject: [PATCH 1/3] Fix typo in references-and-borrowing docs --- src/doc/trpl/references-and-borrowing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/references-and-borrowing.md b/src/doc/trpl/references-and-borrowing.md index c434371ce59..bb5adac5ebf 100644 --- a/src/doc/trpl/references-and-borrowing.md +++ b/src/doc/trpl/references-and-borrowing.md @@ -297,7 +297,7 @@ We can’t modify `v` because it’s borrowed by the loop. References must live as long as the resource they refer to. Rust will check the scopes of your references to ensure that this is true. -If Rust didn’t check that this property, we could accidentally use a reference +If Rust didn’t check this property, we could accidentally use a reference which was invalid. For example: ```rust,ignore From 82447cf5006b0ebdbcf47b796cc521ee0d88f3fa Mon Sep 17 00:00:00 2001 From: peferron Date: Sun, 17 May 2015 02:48:09 -0700 Subject: [PATCH 2/3] Fix doc whitespace issues --- src/doc/trpl/closures.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/doc/trpl/closures.md b/src/doc/trpl/closures.md index d7fa84761e5..d2fe9c6e550 100644 --- a/src/doc/trpl/closures.md +++ b/src/doc/trpl/closures.md @@ -54,9 +54,9 @@ The second is that the syntax is similar, but a bit different. I’ve added spac here to make them look a little closer: ```rust -fn plus_one_v1 (x: i32 ) -> i32 { x + 1 } -let plus_one_v2 = |x: i32 | -> i32 { x + 1 }; -let plus_one_v3 = |x: i32 | x + 1 ; +fn plus_one_v1 (x: i32) -> i32 { x + 1 } +let plus_one_v2 = |x: i32| -> i32 { x + 1 }; +let plus_one_v3 = |x: i32| x + 1 ; ``` Small differences, but they’re similar in ways. @@ -136,7 +136,7 @@ This gives us: note: `nums` moved into closure environment here because it has type `[closure(()) -> collections::vec::Vec]`, which is non-copyable let takes_nums = || nums; - ^~~~~~~ + ^~~~~~~ ``` `Vec` has ownership over its contents, and therefore, when we refer to it @@ -352,8 +352,8 @@ error: the trait `core::marker::Sized` is not implemented for the type factory() -> (Fn(i32) -> Vec) { ^~~~~~~~~~~~~~~~~~~~~ note: `core::ops::Fn(i32) -> collections::vec::Vec` does not have a constant size known at compile-time -fa ctory() -> (Fn(i32) -> Vec) { - ^~~~~~~~~~~~~~~~~~~~~ +factory() -> (Fn(i32) -> Vec) { + ^~~~~~~~~~~~~~~~~~~~~ ``` From e70c8584d562c86fdca9c98895fb981683d18859 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Sat, 16 May 2015 14:31:52 -0400 Subject: [PATCH 3/3] Revert "Panic if the grammar verifier sees a token it doesn't recognize" This reverts commit 9c7d5ae57c27ebfc019c2c23283bb905d8c3b74f. This was wrong... the `continue` was to ignore the latter half of the tokens file. Another mechanism will have to be used to keep the model grammar's tokens in sync with the actual grammar's tokens :-/ --- src/grammar/verify.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grammar/verify.rs b/src/grammar/verify.rs index b9ff39547f3..0d8fb312d11 100644 --- a/src/grammar/verify.rs +++ b/src/grammar/verify.rs @@ -111,7 +111,7 @@ fn id() -> token::Token { "LIT_BINARY_RAW" => token::Literal(token::BinaryRaw(Name(0), 0), None), "QUESTION" => token::Question, "SHEBANG" => token::Shebang(Name(0)), - _ => panic!("Bad token str `{}`", val), + _ => continue, }; res.insert(num.to_string(), tok);