dtolnay/cxx

Improve error message on signatures containing self by value

Open

#577 opened on Dec 13, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Rust (253 forks)batch import
help wanted

Repository metrics

Stars
 (4,472 stars)
PR merge metrics
 (Avg merge 8m) (3 merged PRs in 30d)

Description

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.

Contributor guide