Skip to content

Commit bdbd084

Browse files
committed
Simplify SymbolMangler::print_type.
`Bound`/`Placeholder`/`Infer`/`Error` shouldn't occur, so we can handle them in the second exhaustive `match`, and ignore them in the first non-exhaustive `match`.
1 parent 848e528 commit bdbd084

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_symbol_mangling/src

1 file changed

+4
-7
lines changed

compiler/rustc_symbol_mangling/src/v0.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
425425
ty::Bool => "b",
426426
ty::Char => "c",
427427
ty::Str => "e",
428-
ty::Tuple(_) if ty.is_unit() => "u",
429428
ty::Int(IntTy::I8) => "a",
430429
ty::Int(IntTy::I16) => "s",
431430
ty::Int(IntTy::I32) => "l",
@@ -444,12 +443,12 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
444443
ty::Float(FloatTy::F128) => "C4f128",
445444
ty::Never => "z",
446445

446+
ty::Tuple(_) if ty.is_unit() => "u",
447+
447448
// Should only be encountered within the identity-substituted
448449
// impl header of an item nested within an impl item.
449450
ty::Param(_) => "p",
450451

451-
ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => bug!(),
452-
453452
_ => "",
454453
};
455454
if !basic_type.is_empty() {
@@ -468,11 +467,9 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
468467
unreachable!()
469468
}
470469
ty::Tuple(_) if ty.is_unit() => unreachable!(),
470+
ty::Param(_) => unreachable!(),
471471

472-
// Placeholders, also handled as part of basic types.
473-
ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {
474-
unreachable!()
475-
}
472+
ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => bug!(),
476473

477474
ty::Ref(r, ty, mutbl) => {
478475
self.push(match mutbl {

0 commit comments

Comments
 (0)