You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #608 now that extern types defined in the bridge can be generic over lifetimes, it no longer makes sense to expect specifically a reference in one of the function arguments of a function that returns a mutable reference. The following two signatures would be perfectly valid:
#[cxx::bridge]mod ffi {extern"Rust"{typeThing<'a>;}unsafeextern"C++"{fnf<'a>(t:Box<Thing<'a>>) -> &'amuti32;fng(t:Box<Thing>) -> &muti32;// same thing, with lifetime elision}}pubstructThing<'a>(&'amuti32);
Current behavior:
error[cxxbridge]: &mut return type is not allowed unless there is a &mut argument ┌─ src/main.rs:8:9 │8 │ fn f<'a>(t: Box<Thing<'a>>) -> &'a mut i32; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ &mut return type is not allowed unless there is a &mut argumenterror[cxxbridge]: &mut return type is not allowed unless there is a &mut argument ┌─ src/main.rs:9:9 │9 │ fn g(t: Box<Thing>) -> &mut i32; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ &mut return type is not allowed unless there is a &mut argument
The text was updated successfully, but these errors were encountered:
As of #608 now that extern types defined in the bridge can be generic over lifetimes, it no longer makes sense to expect specifically a reference in one of the function arguments of a function that returns a mutable reference. The following two signatures would be perfectly valid:
Current behavior:
The text was updated successfully, but these errors were encountered: