Skip to content

Commit dd0d8f4

Browse files
committed
Mangling: Add encoding of bool values, char values, and signed integers
1 parent 230ad2a commit dd0d8f4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

text/2603-rust-symbol-name-mangling-v0.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,10 +728,12 @@ Mangled names conform to the following grammar:
728728
| <type> "p" // placeholder (e.g. for polymorphic constants), shown as _: T
729729
| <backref>
730730
731-
// The encoding of a constant depends on its type, currently only
732-
// unsigned integers (mainly usize, for arrays) are supported, and they
733-
// use their value, in base 16 (0-9a-f), not their memory representation.
734-
<const-data> = {<hex-digit>} "_"
731+
// The encoding of a constant depends on its type. Integers use their value,
732+
// in base 16 (0-9a-f), not their memory representation. Negative integer
733+
// values are preceded with "n". The bool value false is encoded as `0_`, true
734+
// value as `1_`. The char constants are encoded using their Unicode scalar
735+
// value.
736+
<const-data> = ["n"] {<hex-digit>} "_"
735737
736738
// <base-62-number> uses 0-9-a-z-A-Z as digits, i.e. 'a' is decimal 10 and
737739
// 'Z' is decimal 61.
@@ -1152,3 +1154,4 @@ pub static QUUX: u32 = {
11521154
- Add a recommended resolution for open question around encoding function parameter types.
11531155
- Allow identifiers to start with a digit.
11541156
- Make `<binder>` optional in `<fn-sig>` and `<dyn-bounds>` productions.
1157+
- Extend `<const-data>` to include `bool` values, `char` values, and negative integer values.

0 commit comments

Comments
 (0)