From 69714d36e6617800f3edea174f5d6f76c985ad4c Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 17:13:50 +0200 Subject: Hide Binders internals more --- crates/hir_ty/src/display.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/display.rs') diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 1108e5a10..2e178e5a8 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -353,7 +353,7 @@ impl HirDisplay for Ty { .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); let bounds = data.subst(parameters); - bounds.value + bounds.into_value_and_skipped_binders().0 } else { Vec::new() } @@ -543,7 +543,7 @@ impl HirDisplay for Ty { .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); let bounds = data.subst(¶meters); - write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?; + write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution } ImplTraitId::AsyncBlockTypeImplTrait(..) => { @@ -630,7 +630,7 @@ impl HirDisplay for Ty { .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); let bounds = data.subst(&opaque_ty.substitution); - write_bounds_like_dyn_trait_with_prefix("impl", &bounds.value, f)?; + write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; } ImplTraitId::AsyncBlockTypeImplTrait(..) => { write!(f, "{{async block}}")?; -- cgit v1.2.3 From 05eba0db3dd76f016aabdd49af6211e70a1812ed Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 18:39:53 +0200 Subject: Binders::subst -> substitute --- crates/hir_ty/src/display.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/hir_ty/src/display.rs') diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 2e178e5a8..704504b02 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -352,7 +352,7 @@ impl HirDisplay for Ty { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.subst(parameters); + let bounds = data.substitute(parameters); bounds.into_value_and_skipped_binders().0 } else { Vec::new() @@ -397,7 +397,7 @@ impl HirDisplay for Ty { } TyKind::FnDef(def, parameters) => { let def = from_chalk(f.db, *def); - let sig = f.db.callable_item_signature(def).subst(parameters); + let sig = f.db.callable_item_signature(def).substitute(parameters); match def { CallableDefId::FunctionId(ff) => { write!(f, "fn {}", f.db.function_data(ff).name)? @@ -482,7 +482,7 @@ impl HirDisplay for Ty { (_, Some(default_parameter)) => { let actual_default = default_parameter .clone() - .subst(¶meters.prefix(i)); + .substitute(¶meters.prefix(i)); if parameter.assert_ty_ref(&Interner) != &actual_default { default_from = i + 1; @@ -542,7 +542,7 @@ impl HirDisplay for Ty { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.subst(¶meters); + let bounds = data.substitute(¶meters); write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution } @@ -595,7 +595,7 @@ impl HirDisplay for Ty { let bounds = f.db.generic_predicates(id.parent) .into_iter() - .map(|pred| pred.clone().subst(&substs)) + .map(|pred| pred.clone().substitute(&substs)) .filter(|wc| match &wc.skip_binders() { WhereClause::Implemented(tr) => { tr.self_type_parameter(&Interner) == self @@ -629,7 +629,7 @@ impl HirDisplay for Ty { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.subst(&opaque_ty.substitution); + let bounds = data.substitute(&opaque_ty.substitution); write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; } ImplTraitId::AsyncBlockTypeImplTrait(..) => { -- cgit v1.2.3 From 30a339e038bfd94d8c91f79287be9b7db4f0cb4e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 5 Apr 2021 18:49:26 +0200 Subject: Add Interner parameter to Binders::substitute --- crates/hir_ty/src/display.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/hir_ty/src/display.rs') 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 { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.substitute(parameters); + let bounds = data.substitute(&Interner, parameters); bounds.into_value_and_skipped_binders().0 } else { Vec::new() @@ -397,7 +397,7 @@ impl HirDisplay for Ty { } TyKind::FnDef(def, parameters) => { let def = from_chalk(f.db, *def); - let sig = f.db.callable_item_signature(def).substitute(parameters); + let sig = f.db.callable_item_signature(def).substitute(&Interner, parameters); match def { CallableDefId::FunctionId(ff) => { write!(f, "fn {}", f.db.function_data(ff).name)? @@ -482,7 +482,7 @@ impl HirDisplay for Ty { (_, Some(default_parameter)) => { let actual_default = default_parameter .clone() - .substitute(¶meters.prefix(i)); + .substitute(&Interner, ¶meters.prefix(i)); if parameter.assert_ty_ref(&Interner) != &actual_default { default_from = i + 1; @@ -542,7 +542,7 @@ impl HirDisplay for Ty { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.substitute(¶meters); + let bounds = data.substitute(&Interner, ¶meters); write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; // FIXME: it would maybe be good to distinguish this from the alias type (when debug printing), and to show the substitution } @@ -595,7 +595,7 @@ impl HirDisplay for Ty { let bounds = f.db.generic_predicates(id.parent) .into_iter() - .map(|pred| pred.clone().substitute(&substs)) + .map(|pred| pred.clone().substitute(&Interner, &substs)) .filter(|wc| match &wc.skip_binders() { WhereClause::Implemented(tr) => { tr.self_type_parameter(&Interner) == self @@ -629,7 +629,7 @@ impl HirDisplay for Ty { let data = (*datas) .as_ref() .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); - let bounds = data.substitute(&opaque_ty.substitution); + let bounds = data.substitute(&Interner, &opaque_ty.substitution); write_bounds_like_dyn_trait_with_prefix("impl", bounds.skip_binders(), f)?; } ImplTraitId::AsyncBlockTypeImplTrait(..) => { -- cgit v1.2.3