tweak names and output and bless

This commit is contained in:
Ralf Jung 2022-07-06 10:14:46 -04:00
parent ac265cdc19
commit 4e7aaf1f44
124 changed files with 241 additions and 231 deletions

View file

@ -1711,7 +1711,7 @@ impl<'tcx> Operand<'tcx> {
Operand::Constant(Box::new(Constant {
span,
user_ty: None,
literal: ConstantKind::Val(ConstValue::Zst, ty),
literal: ConstantKind::Val(ConstValue::ZeroSized, ty),
}))
}
@ -2196,7 +2196,7 @@ impl<'tcx> ConstantKind<'tcx> {
#[inline]
pub fn zero_sized(ty: Ty<'tcx>) -> Self {
let cv = ConstValue::Zst;
let cv = ConstValue::ZeroSized;
Self::Val(cv, ty)
}
@ -2772,6 +2772,13 @@ fn pretty_print_const_value<'tcx>(
fmt.write_str(&cx.into_buffer())?;
return Ok(());
}
(ConstValue::ZeroSized, ty::FnDef(d, s)) => {
let mut cx = FmtPrinter::new(tcx, Namespace::ValueNS);
cx.print_alloc_ids = true;
let cx = cx.print_value_path(*d, s)?;
fmt.write_str(&cx.into_buffer())?;
return Ok(());
}
// FIXME(oli-obk): also pretty print arrays and other aggregate constants by reading
// their fields instead of just dumping the memory.
_ => {}