aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-04-13 13:39:44 +0100
committerFlorian Diebold <[email protected]>2020-04-13 13:46:03 +0100
commit2e7b88b5256bd6c51226b63b93481a77ac901e14 (patch)
tree598e62fba5a307149a4212232c9d5fb5c188b761 /crates/ra_hir_ty/src
parent7886513f89795e06eef258e0c54dbd1224c98317 (diff)
Nicer display of projections in Chalk logs
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/tls.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs
index 0a8932dae..fa8e4d1ad 100644
--- a/crates/ra_hir_ty/src/traits/chalk/tls.rs
+++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs
@@ -2,6 +2,7 @@
2use std::fmt; 2use std::fmt;
3 3
4use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName}; 4use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName};
5use itertools::Itertools;
5 6
6use super::{from_chalk, Interner}; 7use super::{from_chalk, Interner};
7use crate::{db::HirDatabase, CallableDef, TypeCtor}; 8use crate::{db::HirDatabase, CallableDef, TypeCtor};
@@ -133,14 +134,15 @@ impl DebugContext<'_> {
133 }; 134 };
134 let trait_data = self.0.trait_data(trait_); 135 let trait_data = self.0.trait_data(trait_);
135 let params = alias.substitution.parameters(&Interner); 136 let params = alias.substitution.parameters(&Interner);
136 write!( 137 write!(fmt, "<{:?} as {}", &params[0], trait_data.name,)?;
137 fmt, 138 if params.len() > 1 {
138 "<{:?} as {}<{:?}>>::{}", 139 write!(
139 &params[0], 140 fmt,
140 trait_data.name, 141 "<{}>",
141 &params[1..], 142 &params[1..].iter().format_with(", ", |x, f| f(&format_args!("{:?}", x))),
142 type_alias_data.name 143 )?;
143 ) 144 }
145 write!(fmt, ">::{}", type_alias_data.name)
144 } 146 }
145 147
146 pub fn debug_ty( 148 pub fn debug_ty(