Fix and test fallible return of Vec from C to Rust
diff --git a/tests/ffi/lib.rs b/tests/ffi/lib.rs
index 0965e52..6e636d8 100644
--- a/tests/ffi/lib.rs
+++ b/tests/ffi/lib.rs
@@ -61,6 +61,7 @@
fn c_try_return_sliceu8(s: &[u8]) -> Result<&[u8]>;
fn c_try_return_rust_string() -> Result<String>;
fn c_try_return_unique_ptr_string() -> Result<UniquePtr<CxxString>>;
+ fn c_try_return_rust_vec() -> Result<Vec<u8>>;
fn get(self: &C) -> usize;
fn set(self: &mut C, n: usize) -> usize;
diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc
index 7867bf0..8ea3d06 100644
--- a/tests/ffi/tests.cc
+++ b/tests/ffi/tests.cc
@@ -223,6 +223,10 @@
return c_return_unique_ptr_string();
}
+rust::Vec<uint8_t> c_try_return_rust_vec() {
+ throw std::runtime_error("unimplemented");
+}
+
extern "C" C *cxx_test_suite_get_unique_ptr() noexcept {
return std::unique_ptr<C>(new C{2020}).release();
}
diff --git a/tests/ffi/tests.h b/tests/ffi/tests.h
index 9a067d2..22fed58 100644
--- a/tests/ffi/tests.h
+++ b/tests/ffi/tests.h
@@ -65,5 +65,6 @@
rust::Slice<uint8_t> c_try_return_sliceu8(rust::Slice<uint8_t>);
rust::String c_try_return_rust_string();
std::unique_ptr<std::string> c_try_return_unique_ptr_string();
+rust::Vec<uint8_t> c_try_return_rust_vec();
} // namespace tests