dtolnay/cxx

Improve error message on signatures containing self by value

開放

#577 建立於 2020年12月13日

 (2 則留言) (0 個反應) (0 位負責人)Rust (253 個分叉)batch import
help wanted

倉庫指標

星標
 (4,472 顆星)
PR 合併指標
 (平均合併 8分鐘) (30 天內合併 3 個 PR)

描述

The current error is shown as:

error[cxxbridge]: unsupported signature
  ┌─ /dev/stdin:1:54
  │
1 │ #[cxx::bridge] mod ffi { extern "C++" { type T; fn f(self); }}
  │                                                      ^^^^ unsupported signature

Instead it should say what to use instead. &self or &mut self for shared structs and opaque Rust types, self: Pin<&mut Self> for an opaque C++ type, Box<T> or UniquePtr<T> if ownership needs to be transferred depending on opaque Rust or opaque C++ type.

貢獻者指南