aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/display.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-05 17:49:26 +0100
committerFlorian Diebold <[email protected]>2021-04-05 18:21:01 +0100
commit30a339e038bfd94d8c91f79287be9b7db4f0cb4e (patch)
tree7e026ded541b94f2908d61a8037ed62f2df91625 /crates/hir_ty/src/display.rs
parent05eba0db3dd76f016aabdd49af6211e70a1812ed (diff)
Add Interner parameter to Binders::substitute
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 704504b02..f31e6b108 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -352,7 +352,7 @@ impl HirDisplay for Ty {
352 let data = (*datas) 352 let data = (*datas)
353 .as_ref() 353 .as_ref()
354 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 354 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
355 let bounds = data.substitute(parameters); 355 let bounds = data.substitute(&Interner, parameters);
356 bounds.into_value_and_skipped_binders().0 356 bounds.into_value_and_skipped_binders().0
357 } else { 357 } else {
358 Vec::new() 358 Vec::new()
@@ -397,7 +397,7 @@ impl HirDisplay for Ty {
397 } 397 }
398 TyKind::FnDef(def, parameters) => { 398 TyKind::FnDef(def, parameters) => {
399 let def = from_chalk(f.db, *def); 399 let def = from_chalk(f.db, *def);
400 let sig = f.db.callable_item_signature(def).substitute(parameters); 400 let sig = f.db.callable_item_signature(def).substitute(&Interner, parameters);
401 match def { 401 match def {
402 CallableDefId::FunctionId(ff) => { 402 CallableDefId::FunctionId(ff) => {
403 write!(f, "fn {}", f.db.function_data(ff).name)? 403 write!(f, "fn {}", f.db.function_data(ff).name)?
@@ -482,7 +482,7 @@ impl HirDisplay for Ty {
482 (_, Some(default_parameter)) => { 482 (_, Some(default_parameter)) => {
483 let actual_default = default_parameter 483 let actual_default = default_parameter
484 .clone() 484 .clone()
485 .substitute(&parameters.prefix(i)); 485 .substitute(&Interner, &parameters.prefix(i));
486 if parameter.assert_ty_ref(&Interner) != &actual_default 486 if parameter.assert_ty_ref(&Interner) != &actual_default
487 { 487 {
488 default_from = i + 1; 488 default_from = i + 1;
@@ -542,7 +542,7 @@ impl HirDisplay for Ty {
542 let data = (*datas) 542 let data = (*datas)
543 .as_ref() 543 .as_ref()
544 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 544 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
545 let bounds = data.substitute(&parameters); 545 let bounds = data.substitute(&Interner, &parameters);
546 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; 546 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?;
547 // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution 547 // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution
548 } 548 }
@@ -595,7 +595,7 @@ impl HirDisplay for Ty {
595 let bounds = 595 let bounds =
596 f.db.generic_predicates(id.parent) 596 f.db.generic_predicates(id.parent)
597 .into_iter() 597 .into_iter()
598 .map(|pred| pred.clone().substitute(&substs)) 598 .map(|pred| pred.clone().substitute(&Interner, &substs))
599 .filter(|wc| match &wc.skip_binders() { 599 .filter(|wc| match &wc.skip_binders() {
600 WhereClause::Implemented(tr) => { 600 WhereClause::Implemented(tr) => {
601 tr.self_type_parameter(&Interner) == self 601 tr.self_type_parameter(&Interner) == self
@@ -629,7 +629,7 @@ impl HirDisplay for Ty {
629 let data = (*datas) 629 let data = (*datas)
630 .as_ref() 630 .as_ref()
631 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); 631 .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone());
632 let bounds = data.substitute(&opaque_ty.substitution); 632 let bounds = data.substitute(&Interner, &opaque_ty.substitution);
633 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; 633 write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?;
634 } 634 }
635 ImplTraitId::AsyncBlockTypeImplTrait(..) => { 635 ImplTraitId::AsyncBlockTypeImplTrait(..) => {