]> git.lizzy.rs Git - rust.git/commitdiff
TRPL: Anti-example failing for the wrong reason.
authorToni Cárdenas <toni@tcardenas.me>
Wed, 14 Jan 2015 14:24:41 +0000 (15:24 +0100)
committerToni Cárdenas <toni@tcardenas.me>
Wed, 14 Jan 2015 14:24:41 +0000 (15:24 +0100)
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.

src/doc/trpl/closures.md

index 5b49df92fe39691a60213e05e7f7f2f8cabe48c2..51a0bb69a7ce9291df9959dd084794917de0ec41 100644 (file)
@@ -51,7 +51,7 @@ defined. The closure borrows any variables it uses, so this will error:
 
 ```{rust,ignore}
 fn main() {
-    let mut x = 5;
+    let mut x: i32 = 5;
 
     let printer = |&:| { println!("x is: {}", x); };