Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/doc/trpl/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -136,7 +136,7 @@ This gives us:
note: `nums` moved into closure environment here because it has type
`[closure(()) -> collections::vec::Vec<i32>]`, which is non-copyable
let takes_nums = || nums;
^~~~~~~
^~~~~~~
```

`Vec<T>` has ownership over its contents, and therefore, when we refer to it
Expand Down Expand Up @@ -352,8 +352,8 @@ error: the trait `core::marker::Sized` is not implemented for the type
factory() -> (Fn(i32) -> Vec<i32>) {
^~~~~~~~~~~~~~~~~~~~~
note: `core::ops::Fn(i32) -> collections::vec::Vec<i32>` does not have a constant size known at compile-time
fa ctory() -> (Fn(i32) -> Vec<i32>) {
^~~~~~~~~~~~~~~~~~~~~
factory() -> (Fn(i32) -> Vec<i32>) {
^~~~~~~~~~~~~~~~~~~~~

```

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/references-and-borrowing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/grammar/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn parse_token_list(file: &str) -> HashMap<String, 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);
Expand Down