diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-22 19:16:28 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-22 19:16:28 +0100 |
commit | d4daca9f02ec46be1beef79e9ed647a3a24e2434 (patch) | |
tree | f9875be8e240fd2d339e00b77035713f85660a4e /crates/ra_hir_ty/src/traits/chalk/tls.rs | |
parent | b38f9a5810f28563c45acb1ae8b82438649227c9 (diff) | |
parent | ea265aad64366340fa7986f7f93488300631168c (diff) |
Merge #4573
4573: Chalk cleanups r=matklad a=flodiebold
- split off the `Interner` impl and the conversion code into their own modules
- use `TypeCtorId` as `AdtId` directly (instead of raw `InternId`s), and rename the type alias `StructId` -> `AdtId`
- provide missing Chalk debug impls
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk/tls.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/tls.rs | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs index b7eb49d7b..ebf402a07 100644 --- a/crates/ra_hir_ty/src/traits/chalk/tls.rs +++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs | |||
@@ -15,7 +15,7 @@ pub struct DebugContext<'a>(&'a (dyn HirDatabase + 'a)); | |||
15 | impl DebugContext<'_> { | 15 | impl DebugContext<'_> { |
16 | pub fn debug_struct_id( | 16 | pub fn debug_struct_id( |
17 | &self, | 17 | &self, |
18 | id: super::StructId, | 18 | id: super::AdtId, |
19 | f: &mut fmt::Formatter<'_>, | 19 | f: &mut fmt::Formatter<'_>, |
20 | ) -> Result<(), fmt::Error> { | 20 | ) -> Result<(), fmt::Error> { |
21 | let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Adt(id)); | 21 | let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Adt(id)); |
@@ -244,6 +244,65 @@ impl DebugContext<'_> { | |||
244 | ) -> Result<(), fmt::Error> { | 244 | ) -> Result<(), fmt::Error> { |
245 | write!(fmt, "{:?}", separator_trait_ref.debug(&Interner)) | 245 | write!(fmt, "{:?}", separator_trait_ref.debug(&Interner)) |
246 | } | 246 | } |
247 | |||
248 | pub fn debug_fn_def_id( | ||
249 | &self, | ||
250 | _fn_def_id: chalk_ir::FnDefId<Interner>, | ||
251 | fmt: &mut fmt::Formatter<'_>, | ||
252 | ) -> Result<(), fmt::Error> { | ||
253 | write!(fmt, "fn") | ||
254 | } | ||
255 | |||
256 | pub fn debug_const( | ||
257 | &self, | ||
258 | _constant: &chalk_ir::Const<Interner>, | ||
259 | fmt: &mut fmt::Formatter<'_>, | ||
260 | ) -> fmt::Result { | ||
261 | write!(fmt, "const") | ||
262 | } | ||
263 | |||
264 | pub fn debug_variable_kinds( | ||
265 | &self, | ||
266 | variable_kinds: &chalk_ir::VariableKinds<Interner>, | ||
267 | fmt: &mut fmt::Formatter<'_>, | ||
268 | ) -> fmt::Result { | ||
269 | write!(fmt, "{:?}", variable_kinds.as_slice(&Interner)) | ||
270 | } | ||
271 | pub fn debug_variable_kinds_with_angles( | ||
272 | &self, | ||
273 | variable_kinds: &chalk_ir::VariableKinds<Interner>, | ||
274 | fmt: &mut fmt::Formatter<'_>, | ||
275 | ) -> fmt::Result { | ||
276 | write!(fmt, "{:?}", variable_kinds.inner_debug(&Interner)) | ||
277 | } | ||
278 | pub fn debug_canonical_var_kinds( | ||
279 | &self, | ||
280 | canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Interner>, | ||
281 | fmt: &mut fmt::Formatter<'_>, | ||
282 | ) -> fmt::Result { | ||
283 | write!(fmt, "{:?}", canonical_var_kinds.as_slice(&Interner)) | ||
284 | } | ||
285 | pub fn debug_program_clause( | ||
286 | &self, | ||
287 | clause: &chalk_ir::ProgramClause<Interner>, | ||
288 | fmt: &mut fmt::Formatter<'_>, | ||
289 | ) -> fmt::Result { | ||
290 | write!(fmt, "{:?}", clause.data(&Interner)) | ||
291 | } | ||
292 | pub fn debug_program_clauses( | ||
293 | &self, | ||
294 | clauses: &chalk_ir::ProgramClauses<Interner>, | ||
295 | fmt: &mut fmt::Formatter<'_>, | ||
296 | ) -> fmt::Result { | ||
297 | write!(fmt, "{:?}", clauses.as_slice(&Interner)) | ||
298 | } | ||
299 | pub fn debug_quantified_where_clauses( | ||
300 | &self, | ||
301 | clauses: &chalk_ir::QuantifiedWhereClauses<Interner>, | ||
302 | fmt: &mut fmt::Formatter<'_>, | ||
303 | ) -> fmt::Result { | ||
304 | write!(fmt, "{:?}", clauses.as_slice(&Interner)) | ||
305 | } | ||
247 | } | 306 | } |
248 | 307 | ||
249 | mod unsafe_tls { | 308 | mod unsafe_tls { |