Fix Vec returns by value

This commit is contained in:
David Tolnay 2020-04-25 15:08:05 -07:00
parent e6d5021522
commit 03dca70161
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 2 additions and 0 deletions

View File

@ -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())),

View File

@ -96,6 +96,7 @@ impl<'a> Types<'a> {
Atom::from(ident) == Some(RustString)
}
}
Type::RustVec(_) => true,
_ => false,
}
}