mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Print chalk programs in debug output
This commit is contained in:
parent
f1f73649a6
commit
58e338a729
2 changed files with 19 additions and 12 deletions
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
|
||||
use base_db::CrateId;
|
||||
use chalk_ir::cast::Cast;
|
||||
use chalk_solve::Solver;
|
||||
use chalk_solve::{logging_db::LoggingRustIrDatabase, Solver};
|
||||
use hir_def::{lang_item::LangItemTarget, TraitId};
|
||||
|
||||
use crate::{db::HirDatabase, DebruijnIndex, Substs};
|
||||
|
@ -152,6 +152,9 @@ fn solve(
|
|||
goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<Interner>>>,
|
||||
) -> Option<chalk_solve::Solution<Interner>> {
|
||||
let context = ChalkContext { db, krate };
|
||||
|
||||
let logging_db = LoggingRustIrDatabase::new(context);
|
||||
|
||||
log::debug!("solve goal: {:?}", goal);
|
||||
let mut solver = create_chalk_solver();
|
||||
|
||||
|
@ -167,7 +170,7 @@ fn solve(
|
|||
remaining > 0
|
||||
};
|
||||
let mut solve = || {
|
||||
let solution = solver.solve_limited(&context, goal, should_continue);
|
||||
let solution = solver.solve_limited(&logging_db, goal, should_continue);
|
||||
log::debug!("solve({:?}) => {:?}", goal, solution);
|
||||
solution
|
||||
};
|
||||
|
@ -176,6 +179,8 @@ fn solve(
|
|||
let solution =
|
||||
if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() };
|
||||
|
||||
log::debug!("chalk program:\n{}", logging_db);
|
||||
|
||||
solution
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue