Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception safety clarification #17

Merged
merged 4 commits into from
Nov 5, 2023
Merged

Conversation

Voultapher
Copy link
Owner

Fixes #16 see commit messages for detailed explanations.

@Voultapher
Copy link
Owner Author

@dureuill I'd appreciate it if you could review the code and text change.

@Voultapher Voultapher force-pushed the exception-safety-clarification branch from 1a058f4 to e93776d Compare October 6, 2023 16:56
Changing FFIStringCpp to something that is not considered a POD type by the type
system revealed a subtle, but previously effectless issue. The custom _by
comparison constructs treated the types as the original FFI types and not as the
derived C++ types. This did not have any effect because all derived types had
the same POD semantics, and the comparison function was provided by the Rust
side. But with FFIStringCpp changing to a non-trivially copyable move only type,
this issue was revealed. The fix is to provide the comparison constructs with
the derived type and to take a comparison function-pointer as generic template
parameter to decouple T and the parameter type of the function-pointer. In
addition the Rust side now understands FFIString in a moved from state and can
safely destroy such values.
@Voultapher Voultapher force-pushed the exception-safety-clarification branch from e93776d to c0e1f81 Compare November 5, 2023 09:32
@Voultapher Voultapher merged commit 2a86cf8 into main Nov 5, 2023
3 checks passed
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.

Clarification about exception safety
1 participant