mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Nicer display of projections in Chalk logs
This commit is contained in:
parent
7886513f89
commit
2e7b88b525
3 changed files with 12 additions and 8 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1013,6 +1013,7 @@ dependencies = [
|
||||||
"chalk-solve",
|
"chalk-solve",
|
||||||
"ena",
|
"ena",
|
||||||
"insta",
|
"insta",
|
||||||
|
"itertools",
|
||||||
"log",
|
"log",
|
||||||
"ra_arena",
|
"ra_arena",
|
||||||
"ra_db",
|
"ra_db",
|
||||||
|
|
|
@ -8,6 +8,7 @@ authors = ["rust-analyzer developers"]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
itertools = "0.9.0"
|
||||||
arrayvec = "0.5.1"
|
arrayvec = "0.5.1"
|
||||||
smallvec = "1.2.0"
|
smallvec = "1.2.0"
|
||||||
ena = "0.13.1"
|
ena = "0.13.1"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName};
|
use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName};
|
||||||
|
use itertools::Itertools;
|
||||||
|
|
||||||
use super::{from_chalk, Interner};
|
use super::{from_chalk, Interner};
|
||||||
use crate::{db::HirDatabase, CallableDef, TypeCtor};
|
use crate::{db::HirDatabase, CallableDef, TypeCtor};
|
||||||
|
@ -133,14 +134,15 @@ impl DebugContext<'_> {
|
||||||
};
|
};
|
||||||
let trait_data = self.0.trait_data(trait_);
|
let trait_data = self.0.trait_data(trait_);
|
||||||
let params = alias.substitution.parameters(&Interner);
|
let params = alias.substitution.parameters(&Interner);
|
||||||
write!(
|
write!(fmt, "<{:?} as {}", ¶ms[0], trait_data.name,)?;
|
||||||
fmt,
|
if params.len() > 1 {
|
||||||
"<{:?} as {}<{:?}>>::{}",
|
write!(
|
||||||
¶ms[0],
|
fmt,
|
||||||
trait_data.name,
|
"<{}>",
|
||||||
¶ms[1..],
|
¶ms[1..].iter().format_with(", ", |x, f| f(&format_args!("{:?}", x))),
|
||||||
type_alias_data.name
|
)?;
|
||||||
)
|
}
|
||||||
|
write!(fmt, ">::{}", type_alias_data.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_ty(
|
pub fn debug_ty(
|
||||||
|
|
Loading…
Reference in a new issue