Skip to content

Commit

Permalink
Only print integers in symbol path's constants
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed May 25, 2019
1 parent dd32795 commit a0275e3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/librustc_codegen_utils/symbol_names.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a0275e3

Please sign in to comment.