Skip to content

Commit 285706b

Browse files
committed
Only print chalk programs with CHALK_PRINT
1 parent 36052ce commit 285706b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

crates/hir_ty/src/traits.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,15 @@ fn solve(
168168
};
169169

170170
let solution = if is_chalk_debug() {
171-
let logging_db = LoggingRustIrDatabase::new(context);
172171
let solve = || {
173-
let solution = solver.solve_limited(&logging_db, goal, should_continue);
174-
log::debug!("chalk program:\n{}", logging_db);
175-
solution
172+
if is_chalk_print() {
173+
let logging_db = LoggingRustIrDatabase::new(context);
174+
let solution = solver.solve_limited(&logging_db, goal, should_continue);
175+
log::debug!("chalk program:\n{}", logging_db);
176+
solution
177+
} else {
178+
solver.solve_limited(&context, goal, should_continue)
179+
}
176180
};
177181

178182
// don't set the TLS for Chalk unless Chalk debugging is active, to make
@@ -191,6 +195,10 @@ fn is_chalk_debug() -> bool {
191195
std::env::var("CHALK_DEBUG").is_ok()
192196
}
193197

198+
fn is_chalk_print() -> bool {
199+
std::env::var("CHALK_PRINT").is_ok()
200+
}
201+
194202
fn solution_from_chalk(
195203
db: &dyn HirDatabase,
196204
solution: chalk_solve::Solution<Interner>,

0 commit comments

Comments
 (0)