Skip to content

C++: fix compile errors when lowering result<string>, etc.#1620

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
dicej:fix-cpp-string-confusion
May 27, 2026
Merged

C++: fix compile errors when lowering result<string>, etc.#1620
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
dicej:fix-cpp-string-confusion

Conversation

@dicej
Copy link
Copy Markdown
Collaborator

@dicej dicej commented May 27, 2026

Previously, the code generator got confused about when to use wit::string vs. std::string_view when lowering variants with string payloads, tuple-with-string payloads, etc.

I'll admit my C++ skills are pretty out-of-date, so I'm not 100% confident I've got everything lined up correctly here, but it fixes the scenarios I've run into so far. Feedback from experts in modern C++ would be very welcome.

Previously, the code generator got confused about when to use `wit::string`
vs. `std::string_view` when lowering variants with string payloads,
tuple-with-string payloads, etc.

I'll admit my C++ skills are pretty out-of-date, so I'm not 100% confident I've
got everything lined up correctly here, but it fixes the scenarios I've run into
so far.  Feedback from experts in modern C++ would be very welcome.
@dicej dicej requested a review from cpetig May 27, 2026 20:20
@dicej
Copy link
Copy Markdown
Collaborator Author

dicej commented May 27, 2026

Interesting; the Rust codegen is choking on the new test case. I'll investigate.

@alexcrichton
Copy link
Copy Markdown
Member

Feel free to ignore the Rust test failure if it takes too much to investigate, it's got to do with trying to get everything working in all borrowing modes which while useful isn't always the most urgent

@dicej
Copy link
Copy Markdown
Collaborator Author

dicej commented May 27, 2026

Okay, I'll add it to the should_fail_verify list for Rust and open an issue for it.

@alexcrichton alexcrichton added this pull request to the merge queue May 27, 2026
Merged via the queue into bytecodealliance:main with commit 557ca94 May 27, 2026
29 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