diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 8c6ed7bd1407..7833385cbc99 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -548,9 +548,10 @@ impl Printer<'tcx> for SymbolMangler<'tcx> { bug!("symbol_names: unsupported constant of type `{}` ({:?})", ct.ty, ct); } }; - self = ct.ty.print(self)?; if let Some(bits) = val { + // We only print the type if the const can be evaluated. + self = ct.ty.print(self)?; let _ = write!(self.out, "{}{:x}_", if neg { "n" } else { "" }, bits); } else { // NOTE(eddyb) despite having the path, we need to