Skip to content
Permalink
Browse files

Only print integers in symbol path's constants

  • Loading branch information...
oli-obk committed May 11, 2019
1 parent dd32795 commit a0275e3bf3aa72b40f8f9cb1b3b64c620569377c
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/librustc_codegen_utils/symbol_names.rs
@@ -96,6 +96,7 @@ use rustc::ty::print::{PrettyPrinter, Printer, Print};
use rustc::ty::query::Providers;
use rustc::ty::subst::{Kind, SubstsRef, UnpackedKind};
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc::mir::interpret::{ConstValue, Scalar};
use rustc::util::common::record_time;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_mir::monomorphize::item::{InstantiationMode, MonoItem, MonoItemExt};
@@ -438,10 +439,17 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> {
}

fn print_const(
self,
mut self,
ct: &'tcx ty::Const<'tcx>,
) -> Result<Self::Const, Self::Error> {
self.pretty_print_const(ct)
// only print integers
if let ConstValue::Scalar(Scalar::Bits { .. }) = ct.val {
if ct.ty.is_integral() {
return self.pretty_print_const(ct);
}
}
self.write_str("_")?;
Ok(self)
}

fn path_crate(

0 comments on commit a0275e3

Please sign in to comment.
You can’t perform that action at this time.