forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructural_impls.rs
32 lines (26 loc) · 1002 Bytes
/
structural_impls.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::traits;
use std::fmt;
// Structural impls for the structs in `traits`.
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
super::ImplSource::UserDefined(v) => write!(f, "{v:?}"),
super::ImplSource::Builtin(source, d) => {
write!(f, "Builtin({source:?}, {d:?})")
}
super::ImplSource::Param(ct, n) => {
write!(f, "ImplSourceParamData({n:?}, {ct:?})")
}
super::ImplSource::Exhaustive(ref n) => write!(f, "Exhaustive({:?})", n),
}
}
}
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceUserDefinedData<'tcx, N> {
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
)
}
}