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`.
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index ce1eb1a..a34d8b4 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -425,7 +425,6 @@ fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
ty::Bool => "b",
ty::Char => "c",
ty::Str => "e",
- ty::Tuple(_) if ty.is_unit() => "u",
ty::Int(IntTy::I8) => "a",
ty::Int(IntTy::I16) => "s",
ty::Int(IntTy::I32) => "l",
@@ -444,12 +443,12 @@ fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
ty::Float(FloatTy::F128) => "C4f128",
ty::Never => "z",
+ ty::Tuple(_) if ty.is_unit() => "u",
+
// Should only be encountered within the identity-substituted
// impl header of an item nested within an impl item.
ty::Param(_) => "p",
- ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => bug!(),
-
_ => "",
};
if !basic_type.is_empty() {
@@ -468,11 +467,9 @@ fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> {
unreachable!()
}
ty::Tuple(_) if ty.is_unit() => unreachable!(),
+ ty::Param(_) => unreachable!(),
- // Placeholders, also handled as part of basic types.
- ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {
- unreachable!()
- }
+ ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => bug!(),
ty::Ref(r, ty, mutbl) => {
self.push(match mutbl {