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`.
This commit is contained in:
parent
1698c8e322
commit
03bc1be8dd
1 changed files with 4 additions and 7 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue