Skip to content

Convert single-character StrCat string args to char literals#178

Merged
nunoplopes merged 1 commit into
masterfrom
copilot/convert-strcat-to-chars
Jun 3, 2026
Merged

Convert single-character StrCat string args to char literals#178
nunoplopes merged 1 commit into
masterfrom
copilot/convert-strcat-to-chars

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

StrCat calls were using single-character string literals in many places (e.g. ">"-style delimiters and punctuation), which is inconsistent with the intended char-based usage for single codepoints. This updates those call sites to pass character literals instead.

  • Scope

    • Replaced single-character string-literal arguments in StrCat(...) with equivalent char literals.
    • Applied consistently across converter paths that build emitted Rust text.
  • Files updated

    • cpp2rust/converter/converter.cpp
    • cpp2rust/converter/models/converter_refcount.cpp
    • cpp2rust/converter/plugins/emplace_back.cpp
  • Change pattern

    • Preserved call structure and ordering; only argument literal types changed where the argument is a single character.
    • Multi-character strings remain unchanged.
// before
StrCat(".to_string_iterator() as StringIterator<",
       ToString(loop_var->getType().getNonReferenceType()), ">");

// after
StrCat(".to_string_iterator() as StringIterator<",
       ToString(loop_var->getType().getNonReferenceType()), '>');

@nunoplopes nunoplopes marked this pull request as ready for review June 3, 2026 20:53
@nunoplopes nunoplopes merged commit 6e1c8e5 into master Jun 3, 2026
9 checks passed
@nunoplopes nunoplopes deleted the copilot/convert-strcat-to-chars branch June 3, 2026 21:17
lucic71 pushed a commit to lucic71/cpp2rust that referenced this pull request Jun 4, 2026
…ust#178)

`StrCat` calls were using single-character string literals in many
places (e.g. `"&gt;"`-style delimiters and punctuation), which is
inconsistent with the intended char-based usage for single codepoints.
This updates those call sites to pass character literals instead.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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