Skip to content

Use borrow instead of clone in void cast - #327

Merged
nunoplopes merged 2 commits into
Cpp2Rust:masterfrom
lucic71:void-borrow
Sep 4, 2026
Merged

nunoplopes merged 2 commits into
Cpp2Rust:masterfrom
lucic71:void-borrow

Conversation

@lucic71

@lucic71 lucic71 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

In a void cast we clone the argument and immediately drop it.

Not all types implement Clone. Instead, take a reference and immediately drop it. This works for types that don't implement Clone.

@nunoplopes
nunoplopes merged commit f1e7c53 into Cpp2Rust:master Sep 4, 2026
9 checks passed
joaotgouveia pushed a commit to joaotgouveia/cpp2rust that referenced this pull request Oct 27, 2026
In a void cast we clone the argument and immediately drop it.

Not all types implement Clone. Instead, take a reference and immediately
drop it. This works for types that don't implement Clone.
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