Skip to content

Fix moves of STL objects in library calls - #630

Merged
nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:47-cpp-move-trait
Nov 17, 2026
Merged

nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:47-cpp-move-trait

Conversation

@lucic71

@lucic71 lucic71 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Call move constructor on moved STL objects in library calls. Before this PR clone or std::mem::take were called, which don't have the same semantics. For example the following example is broken in master:

std::unique_ptr<int> owner(new int(3));
std::pair<std::unique_ptr<int>, int> moved(std::move(owner), 1);
assert(owner == nullptr); // fails on master

@nunoplopes
nunoplopes merged commit 7f6f9ae into Cpp2Rust:master Nov 17, 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