diff options
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/display.rs | 29 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk.rs | 14 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 2 |
3 files changed, 39 insertions, 6 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index f389c5a4b..d2e151f25 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -221,7 +221,16 @@ impl HirDisplay for ApplicationTy { | |||
221 | } | 221 | } |
222 | TypeCtor::RawPtr(m) => { | 222 | TypeCtor::RawPtr(m) => { |
223 | let t = self.parameters.as_single(); | 223 | let t = self.parameters.as_single(); |
224 | write!(f, "*{}{}", m.as_keyword_for_ptr(), t.display(f.db))?; | 224 | let ty_display = t.display(f.db); |
225 | |||
226 | write!(f, "*{}", m.as_keyword_for_ptr())?; | ||
227 | if matches!(t, Ty::Dyn(predicates) if predicates.len() > 1) { | ||
228 | write!(f, "(")?; | ||
229 | write!(f, "{}", ty_display)?; | ||
230 | write!(f, ")")?; | ||
231 | } else { | ||
232 | write!(f, "{}", ty_display)?; | ||
233 | } | ||
225 | } | 234 | } |
226 | TypeCtor::Ref(m) => { | 235 | TypeCtor::Ref(m) => { |
227 | let t = self.parameters.as_single(); | 236 | let t = self.parameters.as_single(); |
@@ -230,7 +239,15 @@ impl HirDisplay for ApplicationTy { | |||
230 | } else { | 239 | } else { |
231 | t.display(f.db) | 240 | t.display(f.db) |
232 | }; | 241 | }; |
233 | write!(f, "&{}{}", m.as_keyword_for_ref(), ty_display)?; | 242 | |
243 | write!(f, "&{}", m.as_keyword_for_ref())?; | ||
244 | if matches!(t, Ty::Dyn(predicates) if predicates.len() > 1) { | ||
245 | write!(f, "(")?; | ||
246 | write!(f, "{}", ty_display)?; | ||
247 | write!(f, ")")?; | ||
248 | } else { | ||
249 | write!(f, "{}", ty_display)?; | ||
250 | } | ||
234 | } | 251 | } |
235 | TypeCtor::Never => write!(f, "!")?, | 252 | TypeCtor::Never => write!(f, "!")?, |
236 | TypeCtor::Tuple { .. } => { | 253 | TypeCtor::Tuple { .. } => { |
@@ -636,14 +653,14 @@ impl HirDisplay for GenericPredicate { | |||
636 | 653 | ||
637 | impl HirDisplay for Obligation { | 654 | impl HirDisplay for Obligation { |
638 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { | 655 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { |
639 | Ok(match self { | 656 | match self { |
640 | Obligation::Trait(tr) => write!(f, "Implements({})", tr.display(f.db))?, | 657 | Obligation::Trait(tr) => write!(f, "Implements({})", tr.display(f.db)), |
641 | Obligation::Projection(proj) => write!( | 658 | Obligation::Projection(proj) => write!( |
642 | f, | 659 | f, |
643 | "Normalize({} => {})", | 660 | "Normalize({} => {})", |
644 | proj.projection_ty.display(f.db), | 661 | proj.projection_ty.display(f.db), |
645 | proj.ty.display(f.db) | 662 | proj.ty.display(f.db) |
646 | )?, | 663 | ), |
647 | }) | 664 | } |
648 | } | 665 | } |
649 | } | 666 | } |
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index 009b17a7f..cbe5cd7dd 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs | |||
@@ -330,6 +330,20 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
330 | fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId<Interner>) -> String { | 330 | fn fn_def_name(&self, fn_def_id: chalk_ir::FnDefId<Interner>) -> String { |
331 | format!("fn_{}", fn_def_id.0) | 331 | format!("fn_{}", fn_def_id.0) |
332 | } | 332 | } |
333 | fn generator_datum( | ||
334 | &self, | ||
335 | _: chalk_ir::GeneratorId<Interner>, | ||
336 | ) -> std::sync::Arc<chalk_solve::rust_ir::GeneratorDatum<Interner>> { | ||
337 | // FIXME | ||
338 | unimplemented!() | ||
339 | } | ||
340 | fn generator_witness_datum( | ||
341 | &self, | ||
342 | _: chalk_ir::GeneratorId<Interner>, | ||
343 | ) -> std::sync::Arc<chalk_solve::rust_ir::GeneratorWitnessDatum<Interner>> { | ||
344 | // FIXME | ||
345 | unimplemented!() | ||
346 | } | ||
333 | } | 347 | } |
334 | 348 | ||
335 | pub(crate) fn program_clauses_for_chalk_env_query( | 349 | pub(crate) fn program_clauses_for_chalk_env_query( |
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index d42f4bba9..be3301313 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -399,6 +399,8 @@ impl ToChalk for TypeCtor { | |||
399 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor | 399 | // this should not be reached, since we don't represent TypeName::Error with TypeCtor |
400 | unreachable!() | 400 | unreachable!() |
401 | } | 401 | } |
402 | TypeName::Generator(_) => unimplemented!(), // FIXME | ||
403 | TypeName::GeneratorWitness(_) => unimplemented!(), // FIXME | ||
402 | } | 404 | } |
403 | } | 405 | } |
404 | } | 406 | } |