diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs index 4ee824d1d49a..ecb18993d930 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 000000000000..095e2ba6fea4 --- /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); +}