Fix how structs are handled by the generated thunks.
- Struct values need to be `std::move`d when calling thunks.
- `#![allow(improper_ctypes_definitions)]` is needed.
PiperOrigin-RevId: 490384826
diff --git a/common/code_gen_utils.rs b/common/code_gen_utils.rs
index 2c9d878..3405af6 100644
--- a/common/code_gen_utils.rs
+++ b/common/code_gen_utils.rs
@@ -79,6 +79,13 @@
Self::SystemHeader("memory")
}
+ /// Creates a `CcInclude` that represents `#include <utility>` and provides
+ /// C++ functions like `std::move` and C++ types like `std::tuple`.
+ /// See also https://en.cppreference.com/w/cpp/header/utility
+ pub fn utility() -> Self {
+ Self::SystemHeader("utility")
+ }
+
/// Creates a user include: `#include "some/path/to/header.h"`.
pub fn user_header(path: Rc<str>) -> Self {
Self::UserHeader(path)