]>
Commit | Line | Data |
---|---|---|
9fa01778 | 1 | use crate::traits; |
e9174d1e SL |
2 | |
3 | use std::fmt; | |
4 | ||
dc9dc135 | 5 | // Structural impls for the structs in `traits`. |
e9174d1e | 6 | |
f035d41b | 7 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSource<'tcx, N> { |
0bf4aa26 | 8 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
e9174d1e | 9 | match *self { |
1b1a35ee | 10 | super::ImplSource::UserDefined(ref v) => write!(f, "{:?}", v), |
e9174d1e | 11 | |
1b1a35ee | 12 | super::ImplSource::AutoImpl(ref t) => write!(f, "{:?}", t), |
e9174d1e | 13 | |
1b1a35ee | 14 | super::ImplSource::Closure(ref d) => write!(f, "{:?}", d), |
e9174d1e | 15 | |
1b1a35ee | 16 | super::ImplSource::Generator(ref d) => write!(f, "{:?}", d), |
ea8adc8c | 17 | |
487cf647 | 18 | super::ImplSource::Future(ref d) => write!(f, "{:?}", d), |
f9f354fc | 19 | |
487cf647 | 20 | super::ImplSource::FnPointer(ref d) => write!(f, "({:?})", d), |
6a06907d | 21 | |
1b1a35ee | 22 | super::ImplSource::Object(ref d) => write!(f, "{:?}", d), |
e9174d1e | 23 | |
fc512014 XL |
24 | super::ImplSource::Param(ref n, ct) => { |
25 | write!(f, "ImplSourceParamData({:?}, {:?})", n, ct) | |
26 | } | |
e9174d1e | 27 | |
1b1a35ee | 28 | super::ImplSource::Builtin(ref d) => write!(f, "{:?}", d), |
a1dfa0c6 | 29 | |
1b1a35ee | 30 | super::ImplSource::TraitAlias(ref d) => write!(f, "{:?}", d), |
94222f64 XL |
31 | |
32 | super::ImplSource::TraitUpcasting(ref d) => write!(f, "{:?}", d), | |
c295e0f8 | 33 | |
5e7ed085 | 34 | super::ImplSource::ConstDestruct(ref d) => write!(f, "{:?}", d), |
e9174d1e SL |
35 | } |
36 | } | |
37 | } | |
38 | ||
f035d41b | 39 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceUserDefinedData<'tcx, N> { |
0bf4aa26 | 40 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
94b46f34 XL |
41 | write!( |
42 | f, | |
f035d41b | 43 | "ImplSourceUserDefinedData(impl_def_id={:?}, substs={:?}, nested={:?})", |
94b46f34 XL |
44 | self.impl_def_id, self.substs, self.nested |
45 | ) | |
e9174d1e SL |
46 | } |
47 | } | |
48 | ||
f035d41b | 49 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceGeneratorData<'tcx, N> { |
0bf4aa26 | 50 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
94b46f34 XL |
51 | write!( |
52 | f, | |
f035d41b | 53 | "ImplSourceGeneratorData(generator_def_id={:?}, substs={:?}, nested={:?})", |
94b46f34 XL |
54 | self.generator_def_id, self.substs, self.nested |
55 | ) | |
ea8adc8c XL |
56 | } |
57 | } | |
58 | ||
487cf647 FG |
59 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceFutureData<'tcx, N> { |
60 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
61 | write!( | |
62 | f, | |
63 | "ImplSourceFutureData(generator_def_id={:?}, substs={:?}, nested={:?})", | |
64 | self.generator_def_id, self.substs, self.nested | |
65 | ) | |
66 | } | |
67 | } | |
68 | ||
f035d41b | 69 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceClosureData<'tcx, N> { |
0bf4aa26 | 70 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
94b46f34 XL |
71 | write!( |
72 | f, | |
f035d41b | 73 | "ImplSourceClosureData(closure_def_id={:?}, substs={:?}, nested={:?})", |
94b46f34 XL |
74 | self.closure_def_id, self.substs, self.nested |
75 | ) | |
e9174d1e SL |
76 | } |
77 | } | |
78 | ||
f035d41b | 79 | impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceBuiltinData<N> { |
0bf4aa26 | 80 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
f035d41b | 81 | write!(f, "ImplSourceBuiltinData(nested={:?})", self.nested) |
e9174d1e SL |
82 | } |
83 | } | |
84 | ||
a2a8927a | 85 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitUpcastingData<'tcx, N> { |
94222f64 XL |
86 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
87 | write!( | |
88 | f, | |
89 | "ImplSourceTraitUpcastingData(upcast={:?}, vtable_vptr_slot={:?}, nested={:?})", | |
90 | self.upcast_trait_ref, self.vtable_vptr_slot, self.nested | |
91 | ) | |
92 | } | |
93 | } | |
94 | ||
f035d41b | 95 | impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceAutoImplData<N> { |
0bf4aa26 | 96 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
94b46f34 XL |
97 | write!( |
98 | f, | |
f035d41b | 99 | "ImplSourceAutoImplData(trait_def_id={:?}, nested={:?})", |
94b46f34 XL |
100 | self.trait_def_id, self.nested |
101 | ) | |
e9174d1e SL |
102 | } |
103 | } | |
104 | ||
f035d41b | 105 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceObjectData<'tcx, N> { |
0bf4aa26 | 106 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
94b46f34 XL |
107 | write!( |
108 | f, | |
f035d41b | 109 | "ImplSourceObjectData(upcast={:?}, vtable_base={}, nested={:?})", |
94b46f34 XL |
110 | self.upcast_trait_ref, self.vtable_base, self.nested |
111 | ) | |
a7813a04 XL |
112 | } |
113 | } | |
114 | ||
f035d41b | 115 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceFnPointerData<'tcx, N> { |
0bf4aa26 | 116 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
f035d41b | 117 | write!(f, "ImplSourceFnPointerData(fn_ty={:?}, nested={:?})", self.fn_ty, self.nested) |
e9174d1e SL |
118 | } |
119 | } | |
120 | ||
f035d41b | 121 | impl<'tcx, N: fmt::Debug> fmt::Debug for traits::ImplSourceTraitAliasData<'tcx, N> { |
a1dfa0c6 XL |
122 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
123 | write!( | |
124 | f, | |
1b1a35ee | 125 | "ImplSourceTraitAliasData(alias_def_id={:?}, substs={:?}, nested={:?})", |
a1dfa0c6 XL |
126 | self.alias_def_id, self.substs, self.nested |
127 | ) | |
128 | } | |
129 | } | |
130 | ||
5e7ed085 | 131 | impl<N: fmt::Debug> fmt::Debug for traits::ImplSourceConstDestructData<N> { |
5099ac24 | 132 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
5e7ed085 | 133 | write!(f, "ImplSourceConstDestructData(nested={:?})", self.nested) |
5099ac24 FG |
134 | } |
135 | } |