TRPL: Anti-example failing for the wrong reason.
Really small correction. This anti-example in the Closures section is supposed to fail because of a borrow, but it was failing at the type inference because of insufficient type information. This makes it fail for the expected reason.
This commit is contained in:
parent
d52398ef8c
commit
428da78de1
1 changed files with 1 additions and 1 deletions
|
@ -51,7 +51,7 @@ defined. The closure borrows any variables it uses, so this will error:
|
||||||
|
|
||||||
```{rust,ignore}
|
```{rust,ignore}
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = 5;
|
let mut x: i32 = 5;
|
||||||
|
|
||||||
let printer = |&:| { println!("x is: {}", x); };
|
let printer = |&:| { println!("x is: {}", x); };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue