aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/interner.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/interner.rs')
-rw-r--r--crates/hir_ty/src/interner.rs41
1 files changed, 18 insertions, 23 deletions
diff --git a/crates/hir_ty/src/interner.rs b/crates/hir_ty/src/interner.rs
index 8e77378ab..29ffdd9b7 100644
--- a/crates/hir_ty/src/interner.rs
+++ b/crates/hir_ty/src/interner.rs
@@ -107,66 +107,65 @@ impl chalk_ir::interner::Interner for Interner {
107 opaque_ty: &chalk_ir::OpaqueTy<Interner>, 107 opaque_ty: &chalk_ir::OpaqueTy<Interner>,
108 fmt: &mut fmt::Formatter<'_>, 108 fmt: &mut fmt::Formatter<'_>,
109 ) -> Option<fmt::Result> { 109 ) -> Option<fmt::Result> {
110 tls::with_current_program(|prog| Some(prog?.debug_opaque_ty(opaque_ty, fmt))) 110 Some(write!(fmt, "{:?}", opaque_ty.opaque_ty_id))
111 } 111 }
112 112
113 fn debug_opaque_ty_id( 113 fn debug_opaque_ty_id(
114 opaque_ty_id: chalk_ir::OpaqueTyId<Self>, 114 opaque_ty_id: chalk_ir::OpaqueTyId<Self>,
115 fmt: &mut fmt::Formatter<'_>, 115 fmt: &mut fmt::Formatter<'_>,
116 ) -> Option<fmt::Result> { 116 ) -> Option<fmt::Result> {
117 tls::with_current_program(|prog| Some(prog?.debug_opaque_ty_id(opaque_ty_id, fmt))) 117 Some(fmt.debug_struct("OpaqueTyId").field("index", &opaque_ty_id.0).finish())
118 } 118 }
119 119
120 fn debug_ty(ty: &chalk_ir::Ty<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { 120 fn debug_ty(ty: &chalk_ir::Ty<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
121 tls::with_current_program(|prog| Some(prog?.debug_ty(ty, fmt))) 121 Some(write!(fmt, "{:?}", ty.data(&Interner)))
122 } 122 }
123 123
124 fn debug_lifetime( 124 fn debug_lifetime(
125 lifetime: &chalk_ir::Lifetime<Interner>, 125 lifetime: &chalk_ir::Lifetime<Interner>,
126 fmt: &mut fmt::Formatter<'_>, 126 fmt: &mut fmt::Formatter<'_>,
127 ) -> Option<fmt::Result> { 127 ) -> Option<fmt::Result> {
128 tls::with_current_program(|prog| Some(prog?.debug_lifetime(lifetime, fmt))) 128 Some(write!(fmt, "{:?}", lifetime.data(&Interner)))
129 } 129 }
130 130
131 fn debug_generic_arg( 131 fn debug_generic_arg(
132 parameter: &GenericArg, 132 parameter: &GenericArg,
133 fmt: &mut fmt::Formatter<'_>, 133 fmt: &mut fmt::Formatter<'_>,
134 ) -> Option<fmt::Result> { 134 ) -> Option<fmt::Result> {
135 tls::with_current_program(|prog| Some(prog?.debug_generic_arg(parameter, fmt))) 135 Some(write!(fmt, "{:?}", parameter.data(&Interner).inner_debug()))
136 } 136 }
137 137
138 fn debug_goal(goal: &Goal<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { 138 fn debug_goal(goal: &Goal<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> {
139 tls::with_current_program(|prog| Some(prog?.debug_goal(goal, fmt))) 139 let goal_data = goal.data(&Interner);
140 Some(write!(fmt, "{:?}", goal_data))
140 } 141 }
141 142
142 fn debug_goals( 143 fn debug_goals(
143 goals: &chalk_ir::Goals<Interner>, 144 goals: &chalk_ir::Goals<Interner>,
144 fmt: &mut fmt::Formatter<'_>, 145 fmt: &mut fmt::Formatter<'_>,
145 ) -> Option<fmt::Result> { 146 ) -> Option<fmt::Result> {
146 tls::with_current_program(|prog| Some(prog?.debug_goals(goals, fmt))) 147 Some(write!(fmt, "{:?}", goals.debug(&Interner)))
147 } 148 }
148 149
149 fn debug_program_clause_implication( 150 fn debug_program_clause_implication(
150 pci: &chalk_ir::ProgramClauseImplication<Interner>, 151 pci: &chalk_ir::ProgramClauseImplication<Interner>,
151 fmt: &mut fmt::Formatter<'_>, 152 fmt: &mut fmt::Formatter<'_>,
152 ) -> Option<fmt::Result> { 153 ) -> Option<fmt::Result> {
153 tls::with_current_program(|prog| Some(prog?.debug_program_clause_implication(pci, fmt))) 154 Some(write!(fmt, "{:?}", pci.debug(&Interner)))
154 } 155 }
155 156
156 fn debug_substitution( 157 fn debug_substitution(
157 substitution: &chalk_ir::Substitution<Interner>, 158 substitution: &chalk_ir::Substitution<Interner>,
158 fmt: &mut fmt::Formatter<'_>, 159 fmt: &mut fmt::Formatter<'_>,
159 ) -> Option<fmt::Result> { 160 ) -> Option<fmt::Result> {
160 tls::with_current_program(|prog| Some(prog?.debug_substitution(substitution, fmt))) 161 Some(write!(fmt, "{:?}", substitution.debug(&Interner)))
161 } 162 }
162 163
163 fn debug_separator_trait_ref( 164 fn debug_separator_trait_ref(
164 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>, 165 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>,
165 fmt: &mut fmt::Formatter<'_>, 166 fmt: &mut fmt::Formatter<'_>,
166 ) -> Option<fmt::Result> { 167 ) -> Option<fmt::Result> {
167 tls::with_current_program(|prog| { 168 Some(write!(fmt, "{:?}", separator_trait_ref.debug(&Interner)))
168 Some(prog?.debug_separator_trait_ref(separator_trait_ref, fmt))
169 })
170 } 169 }
171 170
172 fn debug_fn_def_id( 171 fn debug_fn_def_id(
@@ -179,47 +178,43 @@ impl chalk_ir::interner::Interner for Interner {
179 constant: &chalk_ir::Const<Self>, 178 constant: &chalk_ir::Const<Self>,
180 fmt: &mut fmt::Formatter<'_>, 179 fmt: &mut fmt::Formatter<'_>,
181 ) -> Option<fmt::Result> { 180 ) -> Option<fmt::Result> {
182 tls::with_current_program(|prog| Some(prog?.debug_const(constant, fmt))) 181 Some(write!(fmt, "{:?}", constant.data(&Interner)))
183 } 182 }
184 fn debug_variable_kinds( 183 fn debug_variable_kinds(
185 variable_kinds: &chalk_ir::VariableKinds<Self>, 184 variable_kinds: &chalk_ir::VariableKinds<Self>,
186 fmt: &mut fmt::Formatter<'_>, 185 fmt: &mut fmt::Formatter<'_>,
187 ) -> Option<fmt::Result> { 186 ) -> Option<fmt::Result> {
188 tls::with_current_program(|prog| Some(prog?.debug_variable_kinds(variable_kinds, fmt))) 187 Some(write!(fmt, "{:?}", variable_kinds.as_slice(&Interner)))
189 } 188 }
190 fn debug_variable_kinds_with_angles( 189 fn debug_variable_kinds_with_angles(
191 variable_kinds: &chalk_ir::VariableKinds<Self>, 190 variable_kinds: &chalk_ir::VariableKinds<Self>,
192 fmt: &mut fmt::Formatter<'_>, 191 fmt: &mut fmt::Formatter<'_>,
193 ) -> Option<fmt::Result> { 192 ) -> Option<fmt::Result> {
194 tls::with_current_program(|prog| { 193 Some(write!(fmt, "{:?}", variable_kinds.inner_debug(&Interner)))
195 Some(prog?.debug_variable_kinds_with_angles(variable_kinds, fmt))
196 })
197 } 194 }
198 fn debug_canonical_var_kinds( 195 fn debug_canonical_var_kinds(
199 canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Self>, 196 canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Self>,
200 fmt: &mut fmt::Formatter<'_>, 197 fmt: &mut fmt::Formatter<'_>,
201 ) -> Option<fmt::Result> { 198 ) -> Option<fmt::Result> {
202 tls::with_current_program(|prog| { 199 Some(write!(fmt, "{:?}", canonical_var_kinds.as_slice(&Interner)))
203 Some(prog?.debug_canonical_var_kinds(canonical_var_kinds, fmt))
204 })
205 } 200 }
206 fn debug_program_clause( 201 fn debug_program_clause(
207 clause: &chalk_ir::ProgramClause<Self>, 202 clause: &chalk_ir::ProgramClause<Self>,
208 fmt: &mut fmt::Formatter<'_>, 203 fmt: &mut fmt::Formatter<'_>,
209 ) -> Option<fmt::Result> { 204 ) -> Option<fmt::Result> {
210 tls::with_current_program(|prog| Some(prog?.debug_program_clause(clause, fmt))) 205 Some(write!(fmt, "{:?}", clause.data(&Interner)))
211 } 206 }
212 fn debug_program_clauses( 207 fn debug_program_clauses(
213 clauses: &chalk_ir::ProgramClauses<Self>, 208 clauses: &chalk_ir::ProgramClauses<Self>,
214 fmt: &mut fmt::Formatter<'_>, 209 fmt: &mut fmt::Formatter<'_>,
215 ) -> Option<fmt::Result> { 210 ) -> Option<fmt::Result> {
216 tls::with_current_program(|prog| Some(prog?.debug_program_clauses(clauses, fmt))) 211 Some(write!(fmt, "{:?}", clauses.as_slice(&Interner)))
217 } 212 }
218 fn debug_quantified_where_clauses( 213 fn debug_quantified_where_clauses(
219 clauses: &chalk_ir::QuantifiedWhereClauses<Self>, 214 clauses: &chalk_ir::QuantifiedWhereClauses<Self>,
220 fmt: &mut fmt::Formatter<'_>, 215 fmt: &mut fmt::Formatter<'_>,
221 ) -> Option<fmt::Result> { 216 ) -> Option<fmt::Result> {
222 tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt))) 217 Some(write!(fmt, "{:?}", clauses.as_slice(&Interner)))
223 } 218 }
224 219
225 fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Self::InternedType { 220 fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Self::InternedType {