Skip to content

Memcpy a pointer to a struct through ErasedPtr#207

Merged
nunoplopes merged 17 commits into
Cpp2Rust:masterfrom
lucic71:anyptr-reinterpreted
Jul 1, 2026
Merged

Memcpy a pointer to a struct through ErasedPtr#207
nunoplopes merged 17 commits into
Cpp2Rust:masterfrom
lucic71:anyptr-reinterpreted

Conversation

@lucic71

@lucic71 lucic71 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

AnyPtr::reinterpret_cast was matching against a hardcoded list of types. This PR adds ErasedPtr::as_bytes which is a reinterpret_cast::<u8> so that memcpy/memset a pointer to a struct works.

I also simplified the implementation for ErasedPtr::equals in this refactor.

@lucic71 lucic71 force-pushed the anyptr-reinterpreted branch from 9c5e7a8 to 1bbc6b0 Compare June 25, 2026 16:45
@lucic71 lucic71 force-pushed the anyptr-reinterpreted branch from f5adb93 to e4bb83e Compare June 25, 2026 21:28
@lucic71

lucic71 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@nunoplopes this is ready for review

@lucic71 lucic71 force-pushed the anyptr-reinterpreted branch from 4514912 to 48d6908 Compare June 29, 2026 14:03
@nunoplopes nunoplopes merged commit 963701d into Cpp2Rust:master Jul 1, 2026
9 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.

2 participants