@@ -600,7 +600,7 @@ A *const* is used to encode a const value used in generics and types.
600
600
It has the following forms :
601
601
602
602
* A constant value encoded as a * [type ]* which represents the type of the constant and * [const - data ]* which is the constant value , followed by `_ ` to terminate the * const * .
603
- * The character `p ` which represents a placeholder .
603
+ * The character `p ` which represents a [ placeholder ] .
604
604
* A * [backref ]* to a previously encoded * const * of the same value .
605
605
606
606
The encoding of the * const - data * depends on the type :
@@ -644,6 +644,38 @@ The encoding of the *const-data* depends on the type:
644
644
>
645
645
> Recommended demangling : `mycrate :: example :: <305419896 >`
646
646
647
+ ### Placeholders
648
+ [placeholder ]: #placeholders
649
+
650
+ A * placeholder * may occur in circumstances where a type or const value is not relevant .
651
+
652
+ > Example :
653
+ > ```rust
654
+ > pub struct Example <T , const N : usize >([T ; N ]);
655
+ >
656
+ > impl <T , const N : usize > Example <T , N > {
657
+ > pub fn foo () -> & 'static () {
658
+ > static EXAMPLE_STATIC : () = ();
659
+ > & EXAMPLE_STATIC
660
+ > }
661
+ > }
662
+ > ```
663
+ >
664
+ > In this example , the static `EXAMPLE_STATIC ` would not be monomorphized by the type or const parameters `T ` and `N `.
665
+ > Those will use the placeholder for those generic arguments.
666
+ > Its symbol is:
667
+ >
668
+ > ```text
669
+ > _RNvNvMCsd9PVOYlP1UU_7mycrateINtB4_7ExamplepKpE3foo14EXAMPLE_STATIC
670
+ > │ │││
671
+ > │ ││└── const placeholder
672
+ > │ │└─── const generic argument
673
+ > │ └──── type placeholder
674
+ > └────────────────── generic- args
675
+ > ```
676
+ >
677
+ > Recommended demangling: `<mycrate :: Example <_ , _ >>:: foo :: EXAMPLE_STATIC `
678
+
647
679
648
680
## Type
649
681
[type ]: #type
@@ -697,7 +729,7 @@ The type encodings based on the initial tag character are:
697
729
* `x ` — `i64 `
698
730
* `y ` — `u64 `
699
731
* `z ` — `! `
700
- * `p ` — placeholder `_ `
732
+ * `p ` — [ placeholder ] `_ `
701
733
702
734
* `A ` — An [array ][reference - array ] `[T ; N ]`.
703
735
0 commit comments