Skip to content

Commit 8255aa1

Browse files
committed
Add test case for #2828
1 parent 7b37730 commit 8255aa1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/compile-fail/issue-2828.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
struct NoCopy {
2+
n: int
3+
}
4+
fn NoCopy() -> NoCopy {
5+
NoCopy { n: 0 }
6+
}
7+
8+
impl NoCopy: Drop {
9+
fn finalize(&self) {
10+
log(error, "running destructor");
11+
}
12+
}
13+
14+
fn main() {
15+
let x = NoCopy();
16+
17+
let f = fn~() { assert x.n == 0; }; //~ ERROR copying a noncopyable value
18+
let g = copy f;
19+
20+
f(); g();
21+
}

0 commit comments

Comments
 (0)