Skip to content

Commit 782853c

Browse files
committed
Issue rust-lang#7444 - Update neg test and pos test for move by capture
1 parent 81c576c commit 782853c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/test/compile-fail/borrowck-move-by-capture.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ pub fn main() {
44
let _f: @fn() -> int = || *foo + 5;
55
//~^ ERROR cannot move `foo`
66

7+
// FIXME(#2202) - Due to the way that borrowck treats closures,
8+
// you get two error reports here.
79
let bar = ~3;
810
let _g = || { //~ ERROR capture of moved value
9-
let _h: @fn() -> int = || *bar;
11+
let _h: @fn() -> int = || *bar; //~ ERROR capture of moved value
1012
};
1113
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pub fn main() {
2+
let bar = ~3;
3+
let h: @fn() -> int = || *bar;
4+
assert_eq!(h(), 3);
5+
}

0 commit comments

Comments
 (0)