Skip to content

Commit

Permalink
Add test case for #2828
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism committed Dec 8, 2012
1 parent 7b37730 commit 8255aa1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/compile-fail/issue-2828.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
struct NoCopy {
n: int
}
fn NoCopy() -> NoCopy {
NoCopy { n: 0 }
}

impl NoCopy: Drop {
fn finalize(&self) {
log(error, "running destructor");
}
}

fn main() {
let x = NoCopy();

let f = fn~() { assert x.n == 0; }; //~ ERROR copying a noncopyable value
let g = copy f;

f(); g();
}

0 comments on commit 8255aa1

Please sign in to comment.