0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-12-01 13:18:54 +01:00

Add test case for #2828

This commit is contained in:
Tim Chevalier 2012-12-07 21:29:16 -08:00
parent 7b37730598
commit 8255aa1ec9

View File

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