mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 12:40:14 +03:00
Add test case for #2828
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user