mirror of
https://github.com/topjohnwu/cxx.git
synced 2024-11-23 20:09:55 +00:00
Emit lifetimes into extern Rust type's trait impls
This commit is contained in:
parent
42883ac16b
commit
78c8ae037a
@ -677,11 +677,12 @@ fn expand_rust_type_import(ety: &ExternType) -> TokenStream {
|
||||
|
||||
fn expand_rust_type_impl(ety: &ExternType) -> TokenStream {
|
||||
let ident = &ety.name.rust;
|
||||
let generics = &ety.generics;
|
||||
let span = ident.span();
|
||||
let unsafe_impl = quote_spanned!(ety.type_token.span=> unsafe impl);
|
||||
|
||||
let mut impls = quote_spanned! {span=>
|
||||
#unsafe_impl ::cxx::private::RustType for #ident {}
|
||||
#unsafe_impl #generics ::cxx::private::RustType for #ident #generics {}
|
||||
};
|
||||
|
||||
for derive in &ety.derives {
|
||||
@ -689,7 +690,7 @@ fn expand_rust_type_impl(ety: &ExternType) -> TokenStream {
|
||||
let type_id = type_id(&ety.name);
|
||||
let span = derive.span;
|
||||
impls.extend(quote_spanned! {span=>
|
||||
unsafe impl ::cxx::ExternType for #ident {
|
||||
unsafe impl #generics ::cxx::ExternType for #ident #generics {
|
||||
type Id = #type_id;
|
||||
type Kind = ::cxx::kind::Opaque;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user