rust/src/test/compile-fail/explicit-call-to-supertrait-dtor.rs

26 lines
292 B
Rust
Raw Normal View History

struct Foo {
x: int
}
trait Bar : Drop {
fn blah();
}
impl Foo : Drop {
fn finalize() {
io::println("kaboom");
}
}
impl Foo : Bar {
fn blah() {
self.finalize(); //~ ERROR explicit call to destructor
}
}
fn main() {
let x = Foo { x: 3 };
}