Skip to content

Commit 0e66b00

Browse files
committed
Rewrite recommended demangling for lifetimes using "De Bruijn level".
1 parent 9e0c19d commit 0e66b00

File tree

1 file changed

+5
-5
lines changed
  • src/doc/rustc/src/symbol-mangling

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,14 @@ Indices starting from 1 refer (as de Bruijn indices) to a higher-ranked lifetime
545545
> **Recommended Demangling**
546546
>
547547
> A *lifetime* may be displayed like a Rust lifetime using a single quote.
548-
> Index 0 should be displayed as `'_`.
549-
>
550-
> Lifetimes starting from 1 may be translated to single lowercase letters starting with `'a`.
551-
> Indices over 25 may consider printing the numeric lifetime index as in `'_123`.
552548
>
549+
> Index 0 should be displayed as `'_`.
553550
> Index 0 should not be displayed for lifetimes in a *[ref-type]*, *[mut-ref-type]*, or *[dyn-trait-type]*.
554551
>
555-
> Nested binders may consider tracking their indices so that lifetime lettering can start back with `'a` within a nested binder.
552+
> A lifetime can be displayed by converting the De Bruijn index to a De Bruijn level
553+
> (level = number of bound lifetimes - index) and selecting a unique name for each level.
554+
> For example, starting with single lowercase letters such as `'a` for level 0.
555+
> Levels over 25 may consider printing the numeric lifetime as in `'_123`.
556556
> See *[binder]* for more on lifetime indexes and ordering.
557557
558558
> Example:

0 commit comments

Comments
 (0)