dtolnay/cxx

Improve error message on signatures containing self by value

Aberta

#577 aberto em 13 de dez. de 2020

 (2 comentários) (0 reação) (0 responsável)Rust (253 forks)batch import
help wanted

Métricas do repositório

Stars
 (4.472 estrelas)
Métricas de merge de PR
 (Mesclagem média 8m) (3 fundiu PRs em 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.

Guia do colaborador