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