@@ -132,13 +132,16 @@ pub(crate) struct RenderType {
132132
133133impl  RenderType  { 
134134    pub  fn  write_to_string ( & self ,  string :  & mut  String )  { 
135-         if  self . generics . is_some ( )  || self . bindings . is_some ( )  { 
136-             string. push ( '{' ) ; 
135+         fn  write_optional_id ( id :  Option < RenderTypeId > ,  string :  & mut  String )  { 
137136            // 0 is a sentinel, everything else is one-indexed 
138-             match  self . id  { 
137+             match  id { 
139138                Some ( id)  => id. write_to_string ( string) , 
140139                None  => string. push ( '`' ) , 
141140            } 
141+         } 
142+         if  self . generics . is_some ( )  || self . bindings . is_some ( )  { 
143+             string. push ( '{' ) ; 
144+             write_optional_id ( self . id ,  string) ; 
142145            string. push ( '{' ) ; 
143146            for  generic in  & self . generics . as_ref ( ) . map ( Vec :: as_slice) . unwrap_or_default ( ) [ ..]  { 
144147                generic. write_to_string ( string) ; 
@@ -153,18 +156,13 @@ impl RenderType {
153156                    for  constraint in  & binding. 1 [ ..]  { 
154157                        constraint. write_to_string ( string) ; 
155158                    } 
156-                     string. push ( '}' ) ; 
157-                     string. push ( '}' ) ; 
159+                     string. push_str ( "}}" ) ; 
158160                } 
159161                string. push ( '}' ) ; 
160162            } 
161163            string. push ( '}' ) ; 
162164        }  else  { 
163-             // 0 is a sentinel, everything else is one-indexed 
164-             match  self . id  { 
165-                 Some ( id)  => id. write_to_string ( string) , 
166-                 None  => string. push ( '`' ) , 
167-             } 
165+             write_optional_id ( self . id ,  string) ; 
168166        } 
169167    } 
170168} 
@@ -191,6 +189,7 @@ impl RenderTypeId {
191189        // zig-zag notation 
192190        let  value:  u32  = ( id << 1 )  | ( if  sign {  1  }  else  {  0  } ) ; 
193191        // encode 
192+         // Documented in https://doc.rust-lang.org/nightly/rustc-dev-guide/rustdoc-internals/search.html 
194193        let  mut  shift:  u32  = 28 ; 
195194        let  mut  mask:  u32  = 0xF0_00_00_00 ; 
196195        while  shift < 32  { 
0 commit comments