// run-pass trait Foo { extern "C" fn borrow(&self); extern "C" fn take(self: Box); } struct Bar; impl Foo for Bar { #[allow(improper_ctypes_definitions)] extern "C" fn borrow(&self) {} #[allow(improper_ctypes_definitions)] extern "C" fn take(self: Box) {} } fn main() { let foo: Box = Box::new(Bar); foo.borrow(); foo.take() }