dtolnay/cxx

Improve error message on signatures containing self by value

Open

#577 创建于 2020年12月13日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)Rust (4,472 star) (253 fork)batch import
help wanted

描述

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.

贡献者指南