From d782e8748b441335c4bed80ae791a60b770658f2 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 9 Jun 2022 19:09:47 -0700 Subject: [PATCH] Update from review from michaelwoerister. --- src/doc/rustc/src/symbol-mangling/v0.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/doc/rustc/src/symbol-mangling/v0.md b/src/doc/rustc/src/symbol-mangling/v0.md index 1d7992e077d9..797491a4ab30 100644 --- a/src/doc/rustc/src/symbol-mangling/v0.md +++ b/src/doc/rustc/src/symbol-mangling/v0.md @@ -149,7 +149,8 @@ the *[disambiguator]* is used to make the name unique across the crate graph. > inherent-impl → `M` *[impl-path]* *[type]* An *inherent-impl* indicates a path to an [inherent implementation][reference-inherent-impl]. -It consists of the character `M` followed by an *[impl-path]* to the impl's parent followed by the *[type]* representing the `Self` type of the impl. +It consists of the character `M` followed by an *[impl-path]*, which uniquely identifies the impl block the item is defined in. +Following that is a *[type]* representing the `Self` type of the impl. > **Recommended Demangling** > @@ -167,12 +168,13 @@ It consists of the character `M` followed by an *[impl-path]* to the impl's pare > The symbol for `foo` in the impl for `Example` is: > > ```text -> _RNvMCs15kBYyAo9fc_7mycrateNtB2_7Example3foo -> │└─────────┬──────────┘└────┬──────┘ -> │ │ │ -> │ │ └── Self type "Example" -> │ └─────────────────── path to the impl's parent "mycrate" -> └────────────────────────────── inherent-impl +> _RNvMs_Cs4Cv8Wi1oAIB_7mycrateNtB4_7Example3foo +> │├┘└─────────┬──────────┘└────┬──────┘ +> ││ │ │ +> ││ │ └── Self type "Example" +> ││ └─────────────────── path to the impl's parent "mycrate" +> │└─────────────────────────────── disambiguator 1 +> └──────────────────────────────── inherent-impl > ``` > > Recommended demangling: `::foo` @@ -307,8 +309,9 @@ It consists of the character `N` followed by a *[namespace]* indicating the name followed by a *[path]* which is a path representing the parent of the entity, followed by an *[identifier]* of the entity. -The identifier of the entity may be empty when the entity is not named. +The identifier of the entity may have a length of 0 when the entity is not named. For example, entities like closures, tuple-like struct constructors, and anonymous constants may not have a name. +The identifier may still have a disambiguator unless the disambiguator is 0. > **Recommended Demangling** > @@ -912,7 +915,7 @@ It consists of a single *[path]*. This helps differentiate symbols that would otherwise be identical, for example the monomorphization of a function from an external crate may result in a duplicate if another crate is also instantiating the same generic function with the same types. -In practice, the instantiating crate is also the crate where the symbol is defined, +In practice, the instantiating crate is also often the crate where the symbol is defined, so it is usually encoded as a *[backref]* to the *[crate-root]* encoded elsewhere in the symbol. > **Recommended Demangling**