Only print integers in symbol path's constants
This commit is contained in:
parent
dd327951eb
commit
a0275e3bf3
1 changed files with 10 additions and 2 deletions
|
@ -96,6 +96,7 @@ use rustc::ty::print::{PrettyPrinter, Printer, Print};
|
||||||
use rustc::ty::query::Providers;
|
use rustc::ty::query::Providers;
|
||||||
use rustc::ty::subst::{Kind, SubstsRef, UnpackedKind};
|
use rustc::ty::subst::{Kind, SubstsRef, UnpackedKind};
|
||||||
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||||
|
use rustc::mir::interpret::{ConstValue, Scalar};
|
||||||
use rustc::util::common::record_time;
|
use rustc::util::common::record_time;
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
use rustc_mir::monomorphize::item::{InstantiationMode, MonoItem, MonoItemExt};
|
use rustc_mir::monomorphize::item::{InstantiationMode, MonoItem, MonoItemExt};
|
||||||
|
@ -438,10 +439,17 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_const(
|
fn print_const(
|
||||||
self,
|
mut self,
|
||||||
ct: &'tcx ty::Const<'tcx>,
|
ct: &'tcx ty::Const<'tcx>,
|
||||||
) -> Result<Self::Const, Self::Error> {
|
) -> 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(
|
fn path_crate(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue