aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits/chalk/tls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/traits/chalk/tls.rs')
-rw-r--r--crates/hir_ty/src/traits/chalk/tls.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/crates/hir_ty/src/traits/chalk/tls.rs b/crates/hir_ty/src/traits/chalk/tls.rs
index 3c9766550..75b16172e 100644
--- a/crates/hir_ty/src/traits/chalk/tls.rs
+++ b/crates/hir_ty/src/traits/chalk/tls.rs
@@ -8,12 +8,12 @@ use super::{from_chalk, Interner, TypeAliasAsAssocType};
8use crate::{db::HirDatabase, CallableDefId}; 8use crate::{db::HirDatabase, CallableDefId};
9use hir_def::{AdtId, AssocContainerId, Lookup, TypeAliasId}; 9use hir_def::{AdtId, AssocContainerId, Lookup, TypeAliasId};
10 10
11pub use unsafe_tls::{set_current_program, with_current_program}; 11pub(crate) use unsafe_tls::{set_current_program, with_current_program};
12 12
13pub struct DebugContext<'a>(&'a dyn HirDatabase); 13pub(crate) struct DebugContext<'a>(&'a dyn HirDatabase);
14 14
15impl DebugContext<'_> { 15impl DebugContext<'_> {
16 pub fn debug_struct_id( 16 pub(crate) fn debug_struct_id(
17 &self, 17 &self,
18 id: super::AdtId, 18 id: super::AdtId,
19 f: &mut fmt::Formatter<'_>, 19 f: &mut fmt::Formatter<'_>,
@@ -26,7 +26,7 @@ impl DebugContext<'_> {
26 write!(f, "{}", name) 26 write!(f, "{}", name)
27 } 27 }
28 28
29 pub fn debug_trait_id( 29 pub(crate) fn debug_trait_id(
30 &self, 30 &self,
31 id: super::TraitId, 31 id: super::TraitId,
32 fmt: &mut fmt::Formatter<'_>, 32 fmt: &mut fmt::Formatter<'_>,
@@ -36,7 +36,7 @@ impl DebugContext<'_> {
36 write!(fmt, "{}", trait_data.name) 36 write!(fmt, "{}", trait_data.name)
37 } 37 }
38 38
39 pub fn debug_assoc_type_id( 39 pub(crate) fn debug_assoc_type_id(
40 &self, 40 &self,
41 id: super::AssocTypeId, 41 id: super::AssocTypeId,
42 fmt: &mut fmt::Formatter<'_>, 42 fmt: &mut fmt::Formatter<'_>,
@@ -51,7 +51,7 @@ impl DebugContext<'_> {
51 write!(fmt, "{}::{}", trait_data.name, type_alias_data.name) 51 write!(fmt, "{}::{}", trait_data.name, type_alias_data.name)
52 } 52 }
53 53
54 pub fn debug_opaque_ty_id( 54 pub(crate) fn debug_opaque_ty_id(
55 &self, 55 &self,
56 opaque_ty_id: chalk_ir::OpaqueTyId<Interner>, 56 opaque_ty_id: chalk_ir::OpaqueTyId<Interner>,
57 fmt: &mut fmt::Formatter<'_>, 57 fmt: &mut fmt::Formatter<'_>,
@@ -59,7 +59,7 @@ impl DebugContext<'_> {
59 fmt.debug_struct("OpaqueTyId").field("index", &opaque_ty_id.0).finish() 59 fmt.debug_struct("OpaqueTyId").field("index", &opaque_ty_id.0).finish()
60 } 60 }
61 61
62 pub fn debug_alias( 62 pub(crate) fn debug_alias(
63 &self, 63 &self,
64 alias_ty: &AliasTy<Interner>, 64 alias_ty: &AliasTy<Interner>,
65 fmt: &mut fmt::Formatter<'_>, 65 fmt: &mut fmt::Formatter<'_>,
@@ -70,7 +70,7 @@ impl DebugContext<'_> {
70 } 70 }
71 } 71 }
72 72
73 pub fn debug_projection_ty( 73 pub(crate) fn debug_projection_ty(
74 &self, 74 &self,
75 projection_ty: &chalk_ir::ProjectionTy<Interner>, 75 projection_ty: &chalk_ir::ProjectionTy<Interner>,
76 fmt: &mut fmt::Formatter<'_>, 76 fmt: &mut fmt::Formatter<'_>,
@@ -95,7 +95,7 @@ impl DebugContext<'_> {
95 write!(fmt, ">::{}", type_alias_data.name) 95 write!(fmt, ">::{}", type_alias_data.name)
96 } 96 }
97 97
98 pub fn debug_opaque_ty( 98 pub(crate) fn debug_opaque_ty(
99 &self, 99 &self,
100 opaque_ty: &chalk_ir::OpaqueTy<Interner>, 100 opaque_ty: &chalk_ir::OpaqueTy<Interner>,
101 fmt: &mut fmt::Formatter<'_>, 101 fmt: &mut fmt::Formatter<'_>,
@@ -103,7 +103,7 @@ impl DebugContext<'_> {
103 write!(fmt, "{:?}", opaque_ty.opaque_ty_id) 103 write!(fmt, "{:?}", opaque_ty.opaque_ty_id)
104 } 104 }
105 105
106 pub fn debug_ty( 106 pub(crate) fn debug_ty(
107 &self, 107 &self,
108 ty: &chalk_ir::Ty<Interner>, 108 ty: &chalk_ir::Ty<Interner>,
109 fmt: &mut fmt::Formatter<'_>, 109 fmt: &mut fmt::Formatter<'_>,
@@ -111,7 +111,7 @@ impl DebugContext<'_> {
111 write!(fmt, "{:?}", ty.data(&Interner)) 111 write!(fmt, "{:?}", ty.data(&Interner))
112 } 112 }
113 113
114 pub fn debug_lifetime( 114 pub(crate) fn debug_lifetime(
115 &self, 115 &self,
116 lifetime: &Lifetime<Interner>, 116 lifetime: &Lifetime<Interner>,
117 fmt: &mut fmt::Formatter<'_>, 117 fmt: &mut fmt::Formatter<'_>,
@@ -119,7 +119,7 @@ impl DebugContext<'_> {
119 write!(fmt, "{:?}", lifetime.data(&Interner)) 119 write!(fmt, "{:?}", lifetime.data(&Interner))
120 } 120 }
121 121
122 pub fn debug_generic_arg( 122 pub(crate) fn debug_generic_arg(
123 &self, 123 &self,
124 parameter: &GenericArg<Interner>, 124 parameter: &GenericArg<Interner>,
125 fmt: &mut fmt::Formatter<'_>, 125 fmt: &mut fmt::Formatter<'_>,
@@ -127,7 +127,7 @@ impl DebugContext<'_> {
127 write!(fmt, "{:?}", parameter.data(&Interner).inner_debug()) 127 write!(fmt, "{:?}", parameter.data(&Interner).inner_debug())
128 } 128 }
129 129
130 pub fn debug_goal( 130 pub(crate) fn debug_goal(
131 &self, 131 &self,
132 goal: &Goal<Interner>, 132 goal: &Goal<Interner>,
133 fmt: &mut fmt::Formatter<'_>, 133 fmt: &mut fmt::Formatter<'_>,
@@ -136,7 +136,7 @@ impl DebugContext<'_> {
136 write!(fmt, "{:?}", goal_data) 136 write!(fmt, "{:?}", goal_data)
137 } 137 }
138 138
139 pub fn debug_goals( 139 pub(crate) fn debug_goals(
140 &self, 140 &self,
141 goals: &Goals<Interner>, 141 goals: &Goals<Interner>,
142 fmt: &mut fmt::Formatter<'_>, 142 fmt: &mut fmt::Formatter<'_>,
@@ -144,7 +144,7 @@ impl DebugContext<'_> {
144 write!(fmt, "{:?}", goals.debug(&Interner)) 144 write!(fmt, "{:?}", goals.debug(&Interner))
145 } 145 }
146 146
147 pub fn debug_program_clause_implication( 147 pub(crate) fn debug_program_clause_implication(
148 &self, 148 &self,
149 pci: &ProgramClauseImplication<Interner>, 149 pci: &ProgramClauseImplication<Interner>,
150 fmt: &mut fmt::Formatter<'_>, 150 fmt: &mut fmt::Formatter<'_>,
@@ -152,7 +152,7 @@ impl DebugContext<'_> {
152 write!(fmt, "{:?}", pci.debug(&Interner)) 152 write!(fmt, "{:?}", pci.debug(&Interner))
153 } 153 }
154 154
155 pub fn debug_substitution( 155 pub(crate) fn debug_substitution(
156 &self, 156 &self,
157 substitution: &chalk_ir::Substitution<Interner>, 157 substitution: &chalk_ir::Substitution<Interner>,
158 fmt: &mut fmt::Formatter<'_>, 158 fmt: &mut fmt::Formatter<'_>,
@@ -160,7 +160,7 @@ impl DebugContext<'_> {
160 write!(fmt, "{:?}", substitution.debug(&Interner)) 160 write!(fmt, "{:?}", substitution.debug(&Interner))
161 } 161 }
162 162
163 pub fn debug_separator_trait_ref( 163 pub(crate) fn debug_separator_trait_ref(
164 &self, 164 &self,
165 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>, 165 separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>,
166 fmt: &mut fmt::Formatter<'_>, 166 fmt: &mut fmt::Formatter<'_>,
@@ -168,7 +168,7 @@ impl DebugContext<'_> {
168 write!(fmt, "{:?}", separator_trait_ref.debug(&Interner)) 168 write!(fmt, "{:?}", separator_trait_ref.debug(&Interner))
169 } 169 }
170 170
171 pub fn debug_fn_def_id( 171 pub(crate) fn debug_fn_def_id(
172 &self, 172 &self,
173 fn_def_id: chalk_ir::FnDefId<Interner>, 173 fn_def_id: chalk_ir::FnDefId<Interner>,
174 fmt: &mut fmt::Formatter<'_>, 174 fmt: &mut fmt::Formatter<'_>,
@@ -190,7 +190,7 @@ impl DebugContext<'_> {
190 } 190 }
191 } 191 }
192 192
193 pub fn debug_const( 193 pub(crate) fn debug_const(
194 &self, 194 &self,
195 _constant: &chalk_ir::Const<Interner>, 195 _constant: &chalk_ir::Const<Interner>,
196 fmt: &mut fmt::Formatter<'_>, 196 fmt: &mut fmt::Formatter<'_>,
@@ -198,42 +198,42 @@ impl DebugContext<'_> {
198 write!(fmt, "const") 198 write!(fmt, "const")
199 } 199 }
200 200
201 pub fn debug_variable_kinds( 201 pub(crate) fn debug_variable_kinds(
202 &self, 202 &self,
203 variable_kinds: &chalk_ir::VariableKinds<Interner>, 203 variable_kinds: &chalk_ir::VariableKinds<Interner>,
204 fmt: &mut fmt::Formatter<'_>, 204 fmt: &mut fmt::Formatter<'_>,
205 ) -> fmt::Result { 205 ) -> fmt::Result {
206 write!(fmt, "{:?}", variable_kinds.as_slice(&Interner)) 206 write!(fmt, "{:?}", variable_kinds.as_slice(&Interner))
207 } 207 }
208 pub fn debug_variable_kinds_with_angles( 208 pub(crate) fn debug_variable_kinds_with_angles(
209 &self, 209 &self,
210 variable_kinds: &chalk_ir::VariableKinds<Interner>, 210 variable_kinds: &chalk_ir::VariableKinds<Interner>,
211 fmt: &mut fmt::Formatter<'_>, 211 fmt: &mut fmt::Formatter<'_>,
212 ) -> fmt::Result { 212 ) -> fmt::Result {
213 write!(fmt, "{:?}", variable_kinds.inner_debug(&Interner)) 213 write!(fmt, "{:?}", variable_kinds.inner_debug(&Interner))
214 } 214 }
215 pub fn debug_canonical_var_kinds( 215 pub(crate) fn debug_canonical_var_kinds(
216 &self, 216 &self,
217 canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Interner>, 217 canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Interner>,
218 fmt: &mut fmt::Formatter<'_>, 218 fmt: &mut fmt::Formatter<'_>,
219 ) -> fmt::Result { 219 ) -> fmt::Result {
220 write!(fmt, "{:?}", canonical_var_kinds.as_slice(&Interner)) 220 write!(fmt, "{:?}", canonical_var_kinds.as_slice(&Interner))
221 } 221 }
222 pub fn debug_program_clause( 222 pub(crate) fn debug_program_clause(
223 &self, 223 &self,
224 clause: &chalk_ir::ProgramClause<Interner>, 224 clause: &chalk_ir::ProgramClause<Interner>,
225 fmt: &mut fmt::Formatter<'_>, 225 fmt: &mut fmt::Formatter<'_>,
226 ) -> fmt::Result { 226 ) -> fmt::Result {
227 write!(fmt, "{:?}", clause.data(&Interner)) 227 write!(fmt, "{:?}", clause.data(&Interner))
228 } 228 }
229 pub fn debug_program_clauses( 229 pub(crate) fn debug_program_clauses(
230 &self, 230 &self,
231 clauses: &chalk_ir::ProgramClauses<Interner>, 231 clauses: &chalk_ir::ProgramClauses<Interner>,
232 fmt: &mut fmt::Formatter<'_>, 232 fmt: &mut fmt::Formatter<'_>,
233 ) -> fmt::Result { 233 ) -> fmt::Result {
234 write!(fmt, "{:?}", clauses.as_slice(&Interner)) 234 write!(fmt, "{:?}", clauses.as_slice(&Interner))
235 } 235 }
236 pub fn debug_quantified_where_clauses( 236 pub(crate) fn debug_quantified_where_clauses(
237 &self, 237 &self,
238 clauses: &chalk_ir::QuantifiedWhereClauses<Interner>, 238 clauses: &chalk_ir::QuantifiedWhereClauses<Interner>,
239 fmt: &mut fmt::Formatter<'_>, 239 fmt: &mut fmt::Formatter<'_>,
@@ -249,7 +249,7 @@ mod unsafe_tls {
249 249
250 scoped_thread_local!(static PROGRAM: DebugContext); 250 scoped_thread_local!(static PROGRAM: DebugContext);
251 251
252 pub fn with_current_program<R>( 252 pub(crate) fn with_current_program<R>(
253 op: impl for<'a> FnOnce(Option<&'a DebugContext<'a>>) -> R, 253 op: impl for<'a> FnOnce(Option<&'a DebugContext<'a>>) -> R,
254 ) -> R { 254 ) -> R {
255 if PROGRAM.is_set() { 255 if PROGRAM.is_set() {
@@ -259,7 +259,7 @@ mod unsafe_tls {
259 } 259 }
260 } 260 }
261 261
262 pub fn set_current_program<OP, R>(p: &dyn HirDatabase, op: OP) -> R 262 pub(crate) fn set_current_program<OP, R>(p: &dyn HirDatabase, op: OP) -> R
263 where 263 where
264 OP: FnOnce() -> R, 264 OP: FnOnce() -> R,
265 { 265 {