Skip to content

Avoid collision between user-defined record and libcc2rs - #433

Merged
nunoplopes merged 3 commits into
Cpp2Rust:masterfrom
lucic71:name-collision
Sep 29, 2026
Merged

nunoplopes merged 3 commits into
Cpp2Rust:masterfrom
lucic71:name-collision

Conversation

@lucic71

@lucic71 lucic71 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

The other option is to use fully qualified names in the output, for example libcc2rs::Ptr, but that's too verbose.

}

std::string_view stem(name);
stem = stem.substr(0, stem.find_last_not_of('_') + 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? If the name doesn't match ptr/Value exactly, then there's no clash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a safety net. We transform Ptr -> Ptr_. If there is an user defined Ptr_ then it must transform into Ptr__

@nunoplopes
nunoplopes merged commit 49c5f22 into Cpp2Rust:master Sep 29, 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