about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-07-17 09:01:29 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-07-17 09:02:52 -0400
commit782853c65846be185c9b8bf930e1b47b78f6fdf6 (patch)
tree3cf7c951d58f3a4e5ba93171591ecbd62dae28b1
parent81c576cd5bbae5207694121ca8c21098a847c153 (diff)
downloadrust-782853c65846be185c9b8bf930e1b47b78f6fdf6.tar.gz
rust-782853c65846be185c9b8bf930e1b47b78f6fdf6.zip
Issue #7444 - Update neg test and pos test for move by capture
-rw-r--r--src/test/compile-fail/borrowck-move-by-capture.rs4
-rw-r--r--src/test/run-pass/borrowck-move-by-capture-ok.rs5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs
index 4ee824d1d49..ecb18993d93 100644
--- a/src/test/compile-fail/borrowck-move-by-capture.rs
+++ b/src/test/compile-fail/borrowck-move-by-capture.rs
@@ -4,8 +4,10 @@ pub fn main() {
     let _f: @fn() -> int = || *foo + 5;
     //~^ ERROR cannot move `foo`
 
+    // FIXME(#2202) - Due to the way that borrowck treats closures,
+    // you get two error reports here.
     let bar = ~3;
     let _g = || { //~ ERROR capture of moved value
-        let _h: @fn() -> int = || *bar;
+        let _h: @fn() -> int = || *bar; //~ ERROR capture of moved value
     };
 }
diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs
new file mode 100644
index 00000000000..095e2ba6fea
--- /dev/null
+++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs
@@ -0,0 +1,5 @@
+pub fn main() {
+    let bar = ~3;
+    let h: @fn() -> int = || *bar;
+    assert_eq!(h(), 3);
+}