rust/compiler/rustc_middle/src/traits/structural_impls.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.6 KiB
Rust
Raw Normal View History

2020-01-22 13:42:04 +01:00
use crate::traits;
use std::fmt;
// Structural impls for the structs in `traits`.
2020-05-11 15:25:33 +00:00
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> {
2020-01-22 13:42:04 +01:00
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
super::ImplSource::UserDefined(ref v) => write!(f, "{:?}", v),
2020-01-22 13:42:04 +01:00
super::ImplSource::Builtin(ref d) => write!(f, "{:?}", d),
2020-01-22 13:42:04 +01:00
super::ImplSource::Object(ref d) => write!(f, "{:?}", d),
2020-01-22 13:42:04 +01:00
2020-11-22 02:13:53 +01:00
super::ImplSource::Param(ref n, ct) => {
write!(f, "ImplSourceParamData({:?}, {:?})", n, ct)
}
2020-01-22 13:42:04 +01:00
super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d),
2020-01-22 13:42:04 +01:00
}
}
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceUserDefinedData<'tcx, N> {
2020-01-22 13:42:04 +01:00
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"ImplSourceUserDefinedData(impl_def_id={:?}, substs={:?}, nested={:?})",
2020-01-22 13:42:04 +01:00
self.impl_def_id, self.substs, self.nested
)
}
}
2023-06-16 00:23:20 +00:00
impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitUpcastingData<N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
2023-06-16 00:23:20 +00:00
"ImplSourceTraitUpcastingData(vtable_vptr_slot={:?}, nested={:?})",
self.vtable_vptr_slot, self.nested
)
}
}
2023-06-16 00:48:29 +00:00
impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceObjectData<N> {
2020-01-22 13:42:04 +01:00
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"ImplSourceObjectData(vtable_base={}, nested={:?})",
self.vtable_base, self.nested
2020-01-22 13:42:04 +01:00
)
}
}