Skip to content

Commit c8a3697

Browse files
Recommend to never display zero disambiguators when demangling v0 symbol names
1 parent c65b2dc commit c8a3697

File tree

1 file changed

+13
-0
lines changed
  • src/doc/rustc/src/symbol-mangling

1 file changed

+13
-0
lines changed

src/doc/rustc/src/symbol-mangling/v0.md

+13
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ the *[disambiguator]* is used to make the name unique across the crate graph.
150150
> ```
151151
>
152152
> Recommended demangling: `mycrate::example`
153+
>
154+
> Note: The compiler may re-use the *crate-root* form to express arbitrary
155+
> unscoped, undisambiguated identifiers, such as for new basic types that have
156+
> not been added to the grammar yet. To achieve that, it will emit a *crate-root*
157+
> without an explicit disambiguator, relying on the fact that such an
158+
> undisambiguated crate name cannot occur in practice. For example, the basic
159+
> type `f128` would be encode as `C4f128`. For this to have the desired effect,
160+
> demanglers are expected to never render zero disambiguators of crate roots.
161+
> I.e. `C4f128` is expected to be displayed as `f128` and not `f128[0]`.
153162
154163
### Path: Inherent impl
155164
[inherent-impl]: #path-inherent-impl
@@ -539,6 +548,10 @@ This allows disambiguators that are encoded sequentially to use minimal bytes.
539548
> **Recommended Demangling**
540549
>
541550
> The *disambiguator* may or may not be displayed; see recommendations for rules that use *disambiguator*.
551+
> Generally, it is recommended that zero disambiguators are never displayed unless their accompanying
552+
> identifier is empty (like is the case for unnamed items such as closures).
553+
> When rendering a disambiguator, it can be shortened to a length reasonable for the context,
554+
> similar to how git commit hashes are rarely displayed in full.
542555
543556
## Lifetime
544557
[lifetime]: #lifetime

0 commit comments

Comments
 (0)