Only print chalk programs with CHALK_PRINT
This commit is contained in:
parent
36052ce1a1
commit
de282ddd86
@ -167,21 +167,22 @@ fn solve(
|
||||
remaining > 0
|
||||
};
|
||||
|
||||
let solution = if is_chalk_debug() {
|
||||
let logging_db = LoggingRustIrDatabase::new(context);
|
||||
let solve = || {
|
||||
let mut solve = || {
|
||||
if is_chalk_print() {
|
||||
let logging_db = LoggingRustIrDatabase::new(context);
|
||||
let solution = solver.solve_limited(&logging_db, goal, should_continue);
|
||||
log::debug!("chalk program:\n{}", logging_db);
|
||||
solution
|
||||
};
|
||||
|
||||
// don't set the TLS for Chalk unless Chalk debugging is active, to make
|
||||
// extra sure we only use it for debugging
|
||||
chalk::tls::set_current_program(db, solve)
|
||||
} else {
|
||||
solver.solve_limited(&context, goal, should_continue)
|
||||
} else {
|
||||
solver.solve_limited(&context, goal, should_continue)
|
||||
}
|
||||
};
|
||||
|
||||
// don't set the TLS for Chalk unless Chalk debugging is active, to make
|
||||
// extra sure we only use it for debugging
|
||||
let solution =
|
||||
if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() };
|
||||
|
||||
log::debug!("solve({:?}) => {:?}", goal, solution);
|
||||
|
||||
solution
|
||||
@ -191,6 +192,10 @@ fn is_chalk_debug() -> bool {
|
||||
std::env::var("CHALK_DEBUG").is_ok()
|
||||
}
|
||||
|
||||
fn is_chalk_print() -> bool {
|
||||
std::env::var("CHALK_PRINT").is_ok()
|
||||
}
|
||||
|
||||
fn solution_from_chalk(
|
||||
db: &dyn HirDatabase,
|
||||
solution: chalk_solve::Solution<Interner>,
|
||||
|
Loading…
Reference in New Issue
Block a user