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