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:
parent
7b37730598
commit
8255aa1ec9
21
src/test/compile-fail/issue-2828.rs
Normal file
21
src/test/compile-fail/issue-2828.rs
Normal 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user