dtolnay/cxx

Improve error message on signatures containing self by value

Offen

#577 geöffnet am 13.12.2020

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (253 Forks)batch import
help wanted

Repository-Metriken

Stars
 (4.472 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 8m) (3 gemergte PRs in 30 T)

Beschreibung

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