mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Provide missing Chalk debug methods
This commit is contained in:
parent
27fe68ad5c
commit
ea265aad64
2 changed files with 112 additions and 0 deletions
|
@ -138,6 +138,59 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn debug_fn_def_id(
|
||||||
|
fn_def_id: chalk_ir::FnDefId<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_fn_def_id(fn_def_id, fmt)))
|
||||||
|
}
|
||||||
|
fn debug_const(
|
||||||
|
constant: &chalk_ir::Const<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_const(constant, fmt)))
|
||||||
|
}
|
||||||
|
fn debug_variable_kinds(
|
||||||
|
variable_kinds: &chalk_ir::VariableKinds<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_variable_kinds(variable_kinds, fmt)))
|
||||||
|
}
|
||||||
|
fn debug_variable_kinds_with_angles(
|
||||||
|
variable_kinds: &chalk_ir::VariableKinds<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| {
|
||||||
|
Some(prog?.debug_variable_kinds_with_angles(variable_kinds, fmt))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fn debug_canonical_var_kinds(
|
||||||
|
canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| {
|
||||||
|
Some(prog?.debug_canonical_var_kinds(canonical_var_kinds, fmt))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
fn debug_program_clause(
|
||||||
|
clause: &chalk_ir::ProgramClause<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_program_clause(clause, fmt)))
|
||||||
|
}
|
||||||
|
fn debug_program_clauses(
|
||||||
|
clauses: &chalk_ir::ProgramClauses<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_program_clauses(clauses, fmt)))
|
||||||
|
}
|
||||||
|
fn debug_quantified_where_clauses(
|
||||||
|
clauses: &chalk_ir::QuantifiedWhereClauses<Self>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Option<fmt::Result> {
|
||||||
|
tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt)))
|
||||||
|
}
|
||||||
|
|
||||||
fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> {
|
fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> {
|
||||||
Box::new(ty)
|
Box::new(ty)
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,65 @@ impl DebugContext<'_> {
|
||||||
) -> Result<(), fmt::Error> {
|
) -> Result<(), fmt::Error> {
|
||||||
write!(fmt, "{:?}", separator_trait_ref.debug(&Interner))
|
write!(fmt, "{:?}", separator_trait_ref.debug(&Interner))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn debug_fn_def_id(
|
||||||
|
&self,
|
||||||
|
_fn_def_id: chalk_ir::FnDefId<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> Result<(), fmt::Error> {
|
||||||
|
write!(fmt, "fn")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn debug_const(
|
||||||
|
&self,
|
||||||
|
_constant: &chalk_ir::Const<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "const")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn debug_variable_kinds(
|
||||||
|
&self,
|
||||||
|
variable_kinds: &chalk_ir::VariableKinds<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", variable_kinds.as_slice(&Interner))
|
||||||
|
}
|
||||||
|
pub fn debug_variable_kinds_with_angles(
|
||||||
|
&self,
|
||||||
|
variable_kinds: &chalk_ir::VariableKinds<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", variable_kinds.inner_debug(&Interner))
|
||||||
|
}
|
||||||
|
pub fn debug_canonical_var_kinds(
|
||||||
|
&self,
|
||||||
|
canonical_var_kinds: &chalk_ir::CanonicalVarKinds<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", canonical_var_kinds.as_slice(&Interner))
|
||||||
|
}
|
||||||
|
pub fn debug_program_clause(
|
||||||
|
&self,
|
||||||
|
clause: &chalk_ir::ProgramClause<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", clause.data(&Interner))
|
||||||
|
}
|
||||||
|
pub fn debug_program_clauses(
|
||||||
|
&self,
|
||||||
|
clauses: &chalk_ir::ProgramClauses<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", clauses.as_slice(&Interner))
|
||||||
|
}
|
||||||
|
pub fn debug_quantified_where_clauses(
|
||||||
|
&self,
|
||||||
|
clauses: &chalk_ir::QuantifiedWhereClauses<Interner>,
|
||||||
|
fmt: &mut fmt::Formatter<'_>,
|
||||||
|
) -> fmt::Result {
|
||||||
|
write!(fmt, "{:?}", clauses.as_slice(&Interner))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod unsafe_tls {
|
mod unsafe_tls {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue