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
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.