about summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-08-01 13:10:35 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-08-03 19:58:00 +1000
commit03bc1be8dd9be8fb6a0672e89731d0826dff0a09 (patch)
treeab9ea93244be15bd33d6181794e35dac078950bd /compiler/rustc_symbol_mangling/src
parent1698c8e322d0cd95aea94b85ef098e5ccfe3c856 (diff)
downloadrust-03bc1be8dd9be8fb6a0672e89731d0826dff0a09.tar.gz
rust-03bc1be8dd9be8fb6a0672e89731d0826dff0a09.zip
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`.
Diffstat (limited to 'compiler/rustc_symbol_mangling/src')
-rw-r--r--compiler/rustc_symbol_mangling/src/v0.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index ce1eb1a1648..a34d8b4436e 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -425,7 +425,6 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
             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 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
             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 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
                 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 {