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.

32 lines
916 B
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 {
2023-07-24 22:02:52 +00:00
match self {
super::ImplSource::UserDefined(v) => write!(f, "{v:?}"),
2020-01-22 13:42:04 +01:00
2023-07-24 22:02:52 +00:00
super::ImplSource::Builtin(source, d) => {
write!(f, "Builtin({source:?}, {d:?})")
}
2020-01-22 13:42:04 +01:00
2023-07-24 22:02:52 +00:00
super::ImplSource::Param(ct, n) => {
write!(f, "ImplSourceParamData({n:?}, {ct:?})")
2020-11-22 02:13:53 +01:00
}
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={:?}, args={:?}, nested={:?})",
self.impl_def_id, self.args, self.nested
2020-01-22 13:42:04 +01:00
)
}
}