@@ -330,8 +330,10 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
330
330
ty:: Float ( FloatTy :: F128 ) => "C4f128" ,
331
331
ty:: Never => "z" ,
332
332
333
- // Placeholders (should be demangled as `_`).
334
- ty:: Param ( _) | ty:: Bound ( ..) | ty:: Placeholder ( _) | ty:: Infer ( _) | ty:: Error ( _) => "p" ,
333
+ // Should only be encountered with polymorphization.
334
+ ty:: Param ( _) => "p" ,
335
+
336
+ ty:: Bound ( ..) | ty:: Placeholder ( _) | ty:: Infer ( _) | ty:: Error ( _) => bug ! ( ) ,
335
337
336
338
_ => "" ,
337
339
} ;
@@ -416,7 +418,6 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
416
418
// Mangle all nominal types as paths.
417
419
ty:: Adt ( ty:: AdtDef ( Interned ( & ty:: AdtDefData { did : def_id, .. } , _) ) , args)
418
420
| ty:: FnDef ( def_id, args)
419
- | ty:: Alias ( ty:: Projection | ty:: Opaque , ty:: AliasTy { def_id, args, .. } )
420
421
| ty:: Closure ( def_id, args)
421
422
| ty:: CoroutineClosure ( def_id, args)
422
423
| ty:: Coroutine ( def_id, args) => {
@@ -467,8 +468,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
467
468
r. print ( self ) ?;
468
469
}
469
470
470
- ty:: Alias ( ty:: Inherent , _) => bug ! ( "symbol_names: unexpected inherent projection" ) ,
471
- ty:: Alias ( ty:: Weak , _) => bug ! ( "symbol_names: unexpected weak projection" ) ,
471
+ ty:: Alias ( ..) => bug ! ( "symbol_names: unexpected unnormalized alias" ) ,
472
472
ty:: CoroutineWitness ( ..) => bug ! ( "symbol_names: unexpected `CoroutineWitness`" ) ,
473
473
}
474
474
@@ -550,21 +550,20 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
550
550
let ( ct_ty, valtree) = match ct. kind ( ) {
551
551
ty:: ConstKind :: Value ( ty, val) => ( ty, val) ,
552
552
553
- // Placeholders (should be demangled as `_`).
554
- // NOTE(eddyb) despite `Unevaluated` having a `DefId` (and therefore
555
- // a path), even for it we still need to encode a placeholder, as
556
- // the path could refer back to e.g. an `impl` using the constant.
557
- ty:: ConstKind :: Unevaluated ( _)
558
- | ty:: ConstKind :: Expr ( _)
559
- | ty:: ConstKind :: Param ( _)
560
- | ty:: ConstKind :: Infer ( _)
561
- | ty:: ConstKind :: Bound ( ..)
562
- | ty:: ConstKind :: Placeholder ( _)
563
- | ty:: ConstKind :: Error ( _) => {
553
+ // Should only be encountered with polymorphization.
554
+ ty:: ConstKind :: Param ( _) => {
564
555
// Never cached (single-character).
565
556
self . push ( "p" ) ;
566
557
return Ok ( ( ) ) ;
567
558
}
559
+
560
+ ty:: Unevaluated ( ..) => bug ! ( "symbol_names: unexpected unnormalized alias" ) ,
561
+
562
+ ty:: ConstKind :: Expr ( _)
563
+ | ty:: ConstKind :: Infer ( _)
564
+ | ty:: ConstKind :: Bound ( ..)
565
+ | ty:: ConstKind :: Placeholder ( _)
566
+ | ty:: ConstKind :: Error ( _) => bug ! ( ) ,
568
567
} ;
569
568
570
569
if let Some ( & i) = self . consts . get ( & ct) {
0 commit comments