Issue #7444 - Update neg test and pos test for move by capture
This commit is contained in:
parent
81c576cd5b
commit
782853c658
2 changed files with 8 additions and 1 deletions
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
|
|||
5
src/test/run-pass/borrowck-move-by-capture-ok.rs
Normal file
5
src/test/run-pass/borrowck-move-by-capture-ok.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
pub fn main() {
|
||||
let bar = ~3;
|
||||
let h: @fn() -> int = || *bar;
|
||||
assert_eq!(h(), 3);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue