Skip to content

Commit ffd441f

Browse files
Resolve question of const generics by delegating the question to a future version.
1 parent 8d76731 commit ffd441f

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

text/0000-symbol-name-mangling-v2.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,7 @@ Mangled names conform to the following grammar:
727727
728728
// The encoding of a constant depends on its type, currently only
729729
// unsigned integers (mainly usize, for arrays) are supported, and they
730-
// use their value, in base 16 (0-9a-f), not their memory representation..
731-
//
732-
// Note that while exposing target-specific data layout information, such
733-
// as pointer size, endianness, etc. should be avoided as much as possible,
734-
// it might become necessary to include raw bytes, even whole allocation
735-
// subgraphs (that miri created), for const generics with non-trivial types.
736-
//
737-
// However, demanglers could just show the raw encoding without trying to
738-
// turn it into expressions, unless they're part of e.g. a debugger, with
739-
// more information about the target data layout and/or from debuginfo.
730+
// use their value, in base 16 (0-9a-f), not their memory representation.
740731
<const-data> = {<hex-digit>} "_"
741732
742733
// <base-62-number> uses 0-9-a-z-A-Z as digits, i.e. 'a' is decimal 10 and
@@ -768,6 +759,18 @@ order not to force the compiler to waste processing time on re-constructing
768759
different disambiguation indices, the internal unspecified "namespaces" are
769760
used. This may change in the future.
770761

762+
### Type-Level Constants
763+
764+
As described above, the grammar encodes constant values via the
765+
`<const-data> = {<hex-digit>} "_"` production, where `{<hex-digit>}` is
766+
the numeric value of the constant, not its representation as bytes. Using
767+
the numeric value is platform independent but does not easily scale to
768+
non-integer data types.
769+
770+
In the future it is likely that Rust will support complex type-level
771+
constants (i.e. not just integers). This RFC suggests to develop a
772+
proper mangling for these as part of the future const-generics work,
773+
and, for now, only define a mangling for integer values.
771774

772775
### Punycode Identifiers
773776

@@ -976,17 +979,6 @@ is taken from the [Swift][swift-gh] programming language's
976979
# Unresolved questions
977980
[unresolved-questions]: #unresolved-questions
978981

979-
### Complex Constant Data
980-
981-
The RFC encodes constant values via the `<const-data> = {<hex-digit>} "_"`
982-
production, where `{<hex-digit>}` is the numeric value of the constant, not
983-
its representation as bytes. Using the numeric value is platform independent
984-
but does not easily scale to non-integer data types.
985-
986-
It is unclear if this is something that needs to be resolved now or can
987-
be left for a future version of the mangling scheme.
988-
989-
990982
### Punycode vs UTF-8
991983
During the pre-RFC phase, it has been suggested that Unicode identifiers
992984
should be encoded as UTF-8 instead of Punycode on platforms that allow it.
@@ -1148,3 +1140,4 @@ pub static QUUX: u32 = {
11481140
- Removed unresolved question "Re-use `<disambiguator>` for crate disambiguator".
11491141
- Added note about default generic arguments to reference-level-explanation.
11501142
- Added note about Punycode making decoding more complicated.
1143+
- Resolve question of complex constant data.

0 commit comments

Comments
 (0)