Skip to content

Wrap non-C++-movable specialized ADTs in rs::Movable in cc_bindings_from_rs - #1948

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_975951881
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_975951881

Conversation

@copybara-service

Copy link
Copy Markdown

Wrap non-C++-movable specialized ADTs in rs::Movable in cc_bindings_from_rs

When generating C++ bindings for function parameters, cc_bindings_from_rs
checks if an ADT is not C++ move-constructible and generates code calling
.MoveToSlot() on the parameter, expecting it to have type ::rs::Movable.

However, template-specialized ADTs (such as Result<T, E> where T or E is not
C++ movable) were returning early from format_type without wrapping in
::rs::Movable. This caused compilation errors like:
"no member named 'MoveToSlot' in 'rs_std::Result<rs_std::unit_t, ...>'"

Wrap template-specialized ADTs in ::rs::Movable<...> when
!db.is_cpp_move_constructible(ty) in FnParam and NestedBridgeable locations,
matching the behavior for standard unmovable ADTs.

…rom_rs

When generating C++ bindings for function parameters, cc_bindings_from_rs
checks if an ADT is not C++ move-constructible and generates code calling
.MoveToSlot() on the parameter, expecting it to have type ::rs::Movable<T>.

However, template-specialized ADTs (such as Result<T, E> where T or E is not
C++ movable) were returning early from format_type without wrapping in
::rs::Movable<T>. This caused compilation errors like:
"no member named 'MoveToSlot' in 'rs_std::Result<rs_std::unit_t, ...>'"

Wrap template-specialized ADTs in ::rs::Movable<...> when
!db.is_cpp_move_constructible(ty) in FnParam and NestedBridgeable locations,
matching the behavior for standard unmovable ADTs.

PiperOrigin-RevId: 975951881

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant