mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-28 01:41:05 +00:00
Fix Vec returns by value
This commit is contained in:
parent
e6d5021522
commit
03dca70161
@ -296,6 +296,7 @@ fn expand_cxx_function_shim(namespace: &Namespace, efn: &ExternFn, types: &Types
|
||||
efn.ret.as_ref().and_then(|ret| match ret {
|
||||
Type::Ident(ident) if ident == RustString => Some(quote!(#call.into_string())),
|
||||
Type::RustBox(_) => Some(quote!(::std::boxed::Box::from_raw(#call))),
|
||||
Type::RustVec(_) => Some(quote!(#call.into_vec())),
|
||||
Type::UniquePtr(_) => Some(quote!(::cxx::UniquePtr::from_raw(#call))),
|
||||
Type::Ref(ty) => match &ty.inner {
|
||||
Type::Ident(ident) if ident == RustString => Some(quote!(#call.as_string())),
|
||||
|
@ -96,6 +96,7 @@ impl<'a> Types<'a> {
|
||||
Atom::from(ident) == Some(RustString)
|
||||
}
|
||||
}
|
||||
Type::RustVec(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user