2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-07-05 21:17:13 +00:00
|
|
|
trait Foo {
|
2020-09-01 21:28:11 +00:00
|
|
|
extern "C" fn borrow(&self);
|
|
|
|
extern "C" fn take(self: Box<Self>);
|
2018-07-05 21:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Bar;
|
|
|
|
impl Foo for Bar {
|
2020-05-28 14:57:09 +00:00
|
|
|
#[allow(improper_ctypes_definitions)]
|
2020-09-01 21:28:11 +00:00
|
|
|
extern "C" fn borrow(&self) {}
|
2020-05-28 14:57:09 +00:00
|
|
|
#[allow(improper_ctypes_definitions)]
|
2020-09-01 21:28:11 +00:00
|
|
|
extern "C" fn take(self: Box<Self>) {}
|
2018-07-05 21:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let foo: Box<dyn Foo> = Box::new(Bar);
|
|
|
|
foo.borrow();
|
|
|
|
foo.take()
|
|
|
|
}
|