-
Add an item-level
#[namespace = "..."]
attribute to specify the C++ namespace path of an individual type or function (#370, #380, thanks @adetaylor)#[cxx::bridge] mod ffi { #[namespace = "the::path::of"] struct Thing {...} extern "C++" { #[namespace = "some::where::else"] fn function() -> Thing; } }
-
Emit diagnostic on
include!
paths relative to.
or..
, as the positioning of generated code inside of Cargo's OUT_DIR is not specified (#368, #375) -
Treat C++ constructors
rust::String(nullptr, 0)
andrust::Str(nullptr, 0)
as creating empty strings; previously UB (#383) -
Enable
rust::Str
andrust::Slice<T>
to be passed in registers by C++ (#387) -
Eliminate warning from rustc 1.46+ when using function pointers in the signature of an extern C++ function (#396)
-
Support single Rust source file containing multiple
#[cxx::bridge]
modules (#397) -
Expose a way to bypass is_trivially_destructible/_move_constructible check on extern types passed by value (#406)
// IsRelocatable<T> is used in assertions that a C++ type passed by value // between Rust and C++ is soundly relocatable by Rust. // // There may be legitimate reasons to opt out of the check for support of types // that the programmer knows are soundly Rust-movable despite not being // recognized as such by the C++ type system due to a move constructor or // destructor. To opt out of the relocatability check, do either of the // following things in any header used by `include!` in the bridge. // // --- if you define the type: // struct MyType { // ... // + using IsRelocatable = std::true_type; // }; // // --- otherwise: // + template <> // + struct rust::IsRelocatable<MyType> : std::true_type {}; template <typename T> struct IsRelocatable;
-
Fix error on pass-by-reference of a shared struct containing a Rust
String
to a C++ function (#408) -
Make shared structs order-independent such that a struct is able to contain a field whose type is another shared struct defined later in the same FFI module (#411)