Fix some unwanted uses of Debug formatting on user-facing messages
While formatting for user diagnostics used `Display` for all most cases, some small amount of cases used `Debug` instead. Until now, `Display` and `Debug` yielded the same output for many types. However, with path trimming, we want to show a shorter path for the user, these cases need fixing.
This commit is contained in:
parent
e36e4bd0f7
commit
75a042e74b
7 changed files with 19 additions and 18 deletions
|
@ -260,10 +260,11 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
|
|||
InstanceDef::ReifyShim(_) => write!(f, " - shim(reify)"),
|
||||
InstanceDef::Intrinsic(_) => write!(f, " - intrinsic"),
|
||||
InstanceDef::Virtual(_, num) => write!(f, " - virtual#{}", num),
|
||||
InstanceDef::FnPtrShim(_, ty) => write!(f, " - shim({:?})", ty),
|
||||
InstanceDef::FnPtrShim(_, ty) => write!(f, " - shim({})", ty),
|
||||
InstanceDef::ClosureOnceShim { .. } => write!(f, " - shim"),
|
||||
InstanceDef::DropGlue(_, ty) => write!(f, " - shim({:?})", ty),
|
||||
InstanceDef::CloneShim(_, ty) => write!(f, " - shim({:?})", ty),
|
||||
InstanceDef::DropGlue(_, None) => write!(f, " - shim(None)"),
|
||||
InstanceDef::DropGlue(_, Some(ty)) => write!(f, " - shim(Some({}))", ty),
|
||||
InstanceDef::CloneShim(_, ty) => write!(f, " - shim({})", ty),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,9 +174,9 @@ pub enum LayoutError<'tcx> {
|
|||
impl<'tcx> fmt::Display for LayoutError<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
LayoutError::Unknown(ty) => write!(f, "the type `{:?}` has an unknown layout", ty),
|
||||
LayoutError::Unknown(ty) => write!(f, "the type `{}` has an unknown layout", ty),
|
||||
LayoutError::SizeOverflow(ty) => {
|
||||
write!(f, "the type `{:?}` is too big for the current architecture", ty)
|
||||
write!(f, "the type `{}` is too big for the current architecture", ty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue