From 0e66b0024cbdbc30e97c226292461e1b608a424a Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 10 Jun 2022 11:28:30 -0700 Subject: [PATCH] Rewrite recommended demangling for lifetimes using "De Bruijn level". --- src/doc/rustc/src/symbol-mangling/v0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/rustc/src/symbol-mangling/v0.md b/src/doc/rustc/src/symbol-mangling/v0.md index fbb813a339a8..2bd17cd28fed 100644 --- a/src/doc/rustc/src/symbol-mangling/v0.md +++ b/src/doc/rustc/src/symbol-mangling/v0.md @@ -545,14 +545,14 @@ Indices starting from 1 refer (as de Bruijn indices) to a higher-ranked lifetime > **Recommended Demangling** > > A *lifetime* may be displayed like a Rust lifetime using a single quote. +> > Index 0 should be displayed as `'_`. -> -> Lifetimes starting from 1 may be translated to single lowercase letters starting with `'a`. -> Indices over 25 may consider printing the numeric lifetime index as in `'_123`. -> > Index 0 should not be displayed for lifetimes in a *[ref-type]*, *[mut-ref-type]*, or *[dyn-trait-type]*. > -> Nested binders may consider tracking their indices so that lifetime lettering can start back with `'a` within a nested binder. +> A lifetime can be displayed by converting the De Bruijn index to a De Bruijn level +> (level = number of bound lifetimes - index) and selecting a unique name for each level. +> For example, starting with single lowercase letters such as `'a` for level 0. +> Levels over 25 may consider printing the numeric lifetime as in `'_123`. > See *[binder]* for more on lifetime indexes and ordering. > Example: