Issue #7444 - Update neg test and pos test for move by capture

This commit is contained in:
Niko Matsakis 2013-07-17 09:01:29 -04:00
parent 81c576cd5b
commit 782853c658
2 changed files with 8 additions and 1 deletions

View file

@ -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
};
}

View file

@ -0,0 +1,5 @@
pub fn main() {
let bar = ~3;
let h: @fn() -> int = || *bar;
assert_eq!(h(), 3);
}