aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check/case_conv.rs6
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs15
-rw-r--r--crates/hir_ty/src/diagnostics/unsafe_check.rs8
-rw-r--r--crates/hir_ty/src/infer.rs6
-rw-r--r--crates/hir_ty/src/infer/expr.rs2
-rw-r--r--crates/hir_ty/src/infer/unify.rs35
-rw-r--r--crates/hir_ty/src/lib.rs3
-rw-r--r--crates/hir_ty/src/test_db.rs6
-rw-r--r--crates/hir_ty/src/traits/chalk/tls.rs54
9 files changed, 68 insertions, 67 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs b/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs
index b0144a289..14e4d92f0 100644
--- a/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check/case_conv.rs
@@ -6,7 +6,7 @@
6 6
7/// Converts an identifier to an UpperCamelCase form. 7/// Converts an identifier to an UpperCamelCase form.
8/// Returns `None` if the string is already is UpperCamelCase. 8/// Returns `None` if the string is already is UpperCamelCase.
9pub fn to_camel_case(ident: &str) -> Option<String> { 9pub(crate) fn to_camel_case(ident: &str) -> Option<String> {
10 if is_camel_case(ident) { 10 if is_camel_case(ident) {
11 return None; 11 return None;
12 } 12 }
@@ -59,7 +59,7 @@ pub fn to_camel_case(ident: &str) -> Option<String> {
59 59
60/// Converts an identifier to a lower_snake_case form. 60/// Converts an identifier to a lower_snake_case form.
61/// Returns `None` if the string is already in lower_snake_case. 61/// Returns `None` if the string is already in lower_snake_case.
62pub fn to_lower_snake_case(ident: &str) -> Option<String> { 62pub(crate) fn to_lower_snake_case(ident: &str) -> Option<String> {
63 if is_lower_snake_case(ident) { 63 if is_lower_snake_case(ident) {
64 return None; 64 return None;
65 } else if is_upper_snake_case(ident) { 65 } else if is_upper_snake_case(ident) {
@@ -71,7 +71,7 @@ pub fn to_lower_snake_case(ident: &str) -> Option<String> {
71 71
72/// Converts an identifier to an UPPER_SNAKE_CASE form. 72/// Converts an identifier to an UPPER_SNAKE_CASE form.
73/// Returns `None` if the string is already is UPPER_SNAKE_CASE. 73/// Returns `None` if the string is already is UPPER_SNAKE_CASE.
74pub fn to_upper_snake_case(ident: &str) -> Option<String> { 74pub(crate) fn to_upper_snake_case(ident: &str) -> Option<String> {
75 if is_upper_snake_case(ident) { 75 if is_upper_snake_case(ident) {
76 return None; 76 return None;
77 } else if is_lower_snake_case(ident) { 77 } else if is_lower_snake_case(ident) {
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index 278a4b947..434b19354 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -17,17 +17,10 @@ use crate::{
17 ApplicationTy, InferenceResult, Ty, TypeCtor, 17 ApplicationTy, InferenceResult, Ty, TypeCtor,
18}; 18};
19 19
20pub use hir_def::{ 20pub(crate) use hir_def::{
21 body::{ 21 body::{Body, BodySourceMap},
22 scope::{ExprScopes, ScopeEntry, ScopeId}, 22 expr::{Expr, ExprId, MatchArm, Pat, PatId},
23 Body, BodySourceMap, ExprPtr, ExprSource, PatPtr, PatSource, 23 LocalFieldId, VariantId,
24 },
25 expr::{
26 ArithOp, Array, BinaryOp, BindingAnnotation, CmpOp, Expr, ExprId, Literal, LogicOp,
27 MatchArm, Ordering, Pat, PatId, RecordFieldPat, RecordLitField, Statement, UnaryOp,
28 },
29 src::HasSource,
30 LocalFieldId, Lookup, VariantId,
31}; 24};
32 25
33pub(super) struct ExprValidator<'a, 'b: 'a> { 26pub(super) struct ExprValidator<'a, 'b: 'a> {
diff --git a/crates/hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs
index 2da9688ca..6dc862826 100644
--- a/crates/hir_ty/src/diagnostics/unsafe_check.rs
+++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs
@@ -59,12 +59,12 @@ impl<'a, 'b> UnsafeValidator<'a, 'b> {
59 } 59 }
60} 60}
61 61
62pub struct UnsafeExpr { 62pub(crate) struct UnsafeExpr {
63 pub expr: ExprId, 63 pub(crate) expr: ExprId,
64 pub inside_unsafe_block: bool, 64 pub(crate) inside_unsafe_block: bool,
65} 65}
66 66
67pub fn unsafe_expressions( 67pub(crate) fn unsafe_expressions(
68 db: &dyn HirDatabase, 68 db: &dyn HirDatabase,
69 infer: &InferenceResult, 69 infer: &InferenceResult,
70 def: DefWithBodyId, 70 def: DefWithBodyId,
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index 644ebd42d..f4c1fa2f2 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -214,9 +214,9 @@ struct InferenceContext<'a> {
214 214
215#[derive(Clone, Debug)] 215#[derive(Clone, Debug)]
216struct BreakableContext { 216struct BreakableContext {
217 pub may_break: bool, 217 may_break: bool,
218 pub break_ty: Ty, 218 break_ty: Ty,
219 pub label: Option<name::Name>, 219 label: Option<name::Name>,
220} 220}
221 221
222fn find_breakable<'c>( 222fn find_breakable<'c>(
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index 8ac4cf89a..605951b10 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -107,7 +107,7 @@ impl<'a> InferenceContext<'a> {
107 } 107 }
108 } 108 }
109 109
110 pub fn callable_sig(&mut self, ty: &Ty, num_args: usize) -> Option<(Vec<Ty>, Ty)> { 110 pub(crate) fn callable_sig(&mut self, ty: &Ty, num_args: usize) -> Option<(Vec<Ty>, Ty)> {
111 match ty.callable_sig(self.db) { 111 match ty.callable_sig(self.db) {
112 Some(sig) => Some((sig.params().to_vec(), sig.ret().clone())), 112 Some(sig) => Some((sig.params().to_vec(), sig.ret().clone())),
113 None => self.callable_sig_from_fn_trait(ty, num_args), 113 None => self.callable_sig_from_fn_trait(ty, num_args),
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index 2e895d911..2406a7361 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -127,7 +127,7 @@ where
127} 127}
128 128
129impl<T> Canonicalized<T> { 129impl<T> Canonicalized<T> {
130 pub fn decanonicalize_ty(&self, mut ty: Ty) -> Ty { 130 pub(super) fn decanonicalize_ty(&self, mut ty: Ty) -> Ty {
131 ty.walk_mut_binders( 131 ty.walk_mut_binders(
132 &mut |ty, binders| { 132 &mut |ty, binders| {
133 if let &mut Ty::Bound(bound) = ty { 133 if let &mut Ty::Bound(bound) = ty {
@@ -141,7 +141,11 @@ impl<T> Canonicalized<T> {
141 ty 141 ty
142 } 142 }
143 143
144 pub fn apply_solution(&self, ctx: &mut InferenceContext<'_>, solution: Canonical<Substs>) { 144 pub(super) fn apply_solution(
145 &self,
146 ctx: &mut InferenceContext<'_>,
147 solution: Canonical<Substs>,
148 ) {
145 // the solution may contain new variables, which we need to convert to new inference vars 149 // the solution may contain new variables, which we need to convert to new inference vars
146 let new_vars = Substs( 150 let new_vars = Substs(
147 solution 151 solution
@@ -164,7 +168,7 @@ impl<T> Canonicalized<T> {
164 } 168 }
165} 169}
166 170
167pub fn unify(tys: &Canonical<(Ty, Ty)>) -> Option<Substs> { 171pub(crate) fn unify(tys: &Canonical<(Ty, Ty)>) -> Option<Substs> {
168 let mut table = InferenceTable::new(); 172 let mut table = InferenceTable::new();
169 let vars = Substs( 173 let vars = Substs(
170 tys.kinds 174 tys.kinds
@@ -199,41 +203,46 @@ pub(crate) struct InferenceTable {
199} 203}
200 204
201impl InferenceTable { 205impl InferenceTable {
202 pub fn new() -> Self { 206 pub(crate) fn new() -> Self {
203 InferenceTable { var_unification_table: InPlaceUnificationTable::new() } 207 InferenceTable { var_unification_table: InPlaceUnificationTable::new() }
204 } 208 }
205 209
206 pub fn new_type_var(&mut self) -> Ty { 210 pub(crate) fn new_type_var(&mut self) -> Ty {
207 Ty::Infer(InferTy::TypeVar(self.var_unification_table.new_key(TypeVarValue::Unknown))) 211 Ty::Infer(InferTy::TypeVar(self.var_unification_table.new_key(TypeVarValue::Unknown)))
208 } 212 }
209 213
210 pub fn new_integer_var(&mut self) -> Ty { 214 pub(crate) fn new_integer_var(&mut self) -> Ty {
211 Ty::Infer(InferTy::IntVar(self.var_unification_table.new_key(TypeVarValue::Unknown))) 215 Ty::Infer(InferTy::IntVar(self.var_unification_table.new_key(TypeVarValue::Unknown)))
212 } 216 }
213 217
214 pub fn new_float_var(&mut self) -> Ty { 218 pub(crate) fn new_float_var(&mut self) -> Ty {
215 Ty::Infer(InferTy::FloatVar(self.var_unification_table.new_key(TypeVarValue::Unknown))) 219 Ty::Infer(InferTy::FloatVar(self.var_unification_table.new_key(TypeVarValue::Unknown)))
216 } 220 }
217 221
218 pub fn new_maybe_never_type_var(&mut self) -> Ty { 222 pub(crate) fn new_maybe_never_type_var(&mut self) -> Ty {
219 Ty::Infer(InferTy::MaybeNeverTypeVar( 223 Ty::Infer(InferTy::MaybeNeverTypeVar(
220 self.var_unification_table.new_key(TypeVarValue::Unknown), 224 self.var_unification_table.new_key(TypeVarValue::Unknown),
221 )) 225 ))
222 } 226 }
223 227
224 pub fn resolve_ty_completely(&mut self, ty: Ty) -> Ty { 228 pub(crate) fn resolve_ty_completely(&mut self, ty: Ty) -> Ty {
225 self.resolve_ty_completely_inner(&mut Vec::new(), ty) 229 self.resolve_ty_completely_inner(&mut Vec::new(), ty)
226 } 230 }
227 231
228 pub fn resolve_ty_as_possible(&mut self, ty: Ty) -> Ty { 232 pub(crate) fn resolve_ty_as_possible(&mut self, ty: Ty) -> Ty {
229 self.resolve_ty_as_possible_inner(&mut Vec::new(), ty) 233 self.resolve_ty_as_possible_inner(&mut Vec::new(), ty)
230 } 234 }
231 235
232 pub fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { 236 pub(crate) fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
233 self.unify_inner(ty1, ty2, 0) 237 self.unify_inner(ty1, ty2, 0)
234 } 238 }
235 239
236 pub fn unify_substs(&mut self, substs1: &Substs, substs2: &Substs, depth: usize) -> bool { 240 pub(crate) fn unify_substs(
241 &mut self,
242 substs1: &Substs,
243 substs2: &Substs,
244 depth: usize,
245 ) -> bool {
237 substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| self.unify_inner(t1, t2, depth)) 246 substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| self.unify_inner(t1, t2, depth))
238 } 247 }
239 248
@@ -331,7 +340,7 @@ impl InferenceTable {
331 340
332 /// If `ty` is a type variable with known type, returns that type; 341 /// If `ty` is a type variable with known type, returns that type;
333 /// otherwise, return ty. 342 /// otherwise, return ty.
334 pub fn resolve_ty_shallow<'b>(&mut self, ty: &'b Ty) -> Cow<'b, Ty> { 343 pub(crate) fn resolve_ty_shallow<'b>(&mut self, ty: &'b Ty) -> Cow<'b, Ty> {
335 let mut ty = Cow::Borrowed(ty); 344 let mut ty = Cow::Borrowed(ty);
336 // The type variable could resolve to a int/float variable. Hence try 345 // The type variable could resolve to a int/float variable. Hence try
337 // resolving up to three times; each type of variable shouldn't occur 346 // resolving up to three times; each type of variable shouldn't occur
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 768d95eff..5a8c97198 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -1,6 +1,5 @@
1//! The type system. We currently use this to infer types for completion, hover 1//! The type system. We currently use this to infer types for completion, hover
2//! information and various assists. 2//! information and various assists.
3
4#[allow(unused)] 3#[allow(unused)]
5macro_rules! eprintln { 4macro_rules! eprintln {
6 ($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; 5 ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
@@ -1115,5 +1114,5 @@ pub struct ReturnTypeImplTraits {
1115 1114
1116#[derive(Clone, PartialEq, Eq, Debug, Hash)] 1115#[derive(Clone, PartialEq, Eq, Debug, Hash)]
1117pub(crate) struct ReturnTypeImplTrait { 1116pub(crate) struct ReturnTypeImplTrait {
1118 pub bounds: Binders<Vec<GenericPredicate>>, 1117 pub(crate) bounds: Binders<Vec<GenericPredicate>>,
1119} 1118}
diff --git a/crates/hir_ty/src/test_db.rs b/crates/hir_ty/src/test_db.rs
index 15b8435e9..22254b765 100644
--- a/crates/hir_ty/src/test_db.rs
+++ b/crates/hir_ty/src/test_db.rs
@@ -21,7 +21,7 @@ use test_utils::extract_annotations;
21 crate::db::HirDatabaseStorage 21 crate::db::HirDatabaseStorage
22)] 22)]
23#[derive(Default)] 23#[derive(Default)]
24pub struct TestDB { 24pub(crate) struct TestDB {
25 storage: salsa::Storage<TestDB>, 25 storage: salsa::Storage<TestDB>,
26 events: Mutex<Option<Vec<salsa::Event>>>, 26 events: Mutex<Option<Vec<salsa::Event>>>,
27} 27}
@@ -113,13 +113,13 @@ impl TestDB {
113} 113}
114 114
115impl TestDB { 115impl TestDB {
116 pub fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event> { 116 pub(crate) fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event> {
117 *self.events.lock().unwrap() = Some(Vec::new()); 117 *self.events.lock().unwrap() = Some(Vec::new());
118 f(); 118 f();
119 self.events.lock().unwrap().take().unwrap() 119 self.events.lock().unwrap().take().unwrap()
120 } 120 }
121 121
122 pub fn log_executed(&self, f: impl FnOnce()) -> Vec<String> { 122 pub(crate) fn log_executed(&self, f: impl FnOnce()) -> Vec<String> {
123 let events = self.log(f); 123 let events = self.log(f);
124 events 124 events
125 .into_iter() 125 .into_iter()
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 {