Commit 4723722
Strip r# prefix from raw identifiers in generated C++ names
extern "C++" parameters/fields named with a raw identifier (e.g.
r#type, used only to dodge a Rust keyword) were emitted verbatim
into generated C++, producing invalid code like
`void foo(::std::int32_t r#type) noexcept`.
ForeignName::parse is the single place that turns a Rust identifier
into its C++-facing name, both for the implicit default name and for
explicit #[cxx_name = ...] attributes, so strip the r# prefix there.
This mirrors the existing precedent in QualifiedName::parse_unquoted
(syntax/qualified.rs) for namespace segments.
Fixes #1324
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 986a6dd commit 4723722
2 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | 26 | | |
| |||
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
26 | 50 | | |
27 | 51 | | |
28 | 52 | | |
| |||
0 commit comments