diff options
author | Florian Diebold <[email protected]> | 2021-04-04 12:16:16 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-04 12:16:39 +0100 |
commit | ebdfc932e74ff11c8c14c513614212b7c07bf400 (patch) | |
tree | 85263e70c101206330ed95c00ce226a61c098c0c /crates/hir | |
parent | a4d7bdf1c884a9f3dd415a882fa56422adae89bf (diff) |
Replace Substitution::type_params
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/display.rs | 4 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index 559ea31a0..993772aac 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs | |||
@@ -13,7 +13,7 @@ use syntax::ast::{self, NameOwner}; | |||
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | Adt, Const, ConstParam, Enum, Field, Function, GenericParam, HasVisibility, LifetimeParam, | 15 | Adt, Const, ConstParam, Enum, Field, Function, GenericParam, HasVisibility, LifetimeParam, |
16 | Module, Static, Struct, Substitution, Trait, Type, TypeAlias, TypeParam, Union, Variant, | 16 | Module, Static, Struct, Trait, TyBuilder, Type, TypeAlias, TypeParam, Union, Variant, |
17 | }; | 17 | }; |
18 | 18 | ||
19 | impl HirDisplay for Function { | 19 | impl HirDisplay for Function { |
@@ -234,7 +234,7 @@ impl HirDisplay for TypeParam { | |||
234 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { | 234 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { |
235 | write!(f, "{}", self.name(f.db))?; | 235 | write!(f, "{}", self.name(f.db))?; |
236 | let bounds = f.db.generic_predicates_for_param(self.id); | 236 | let bounds = f.db.generic_predicates_for_param(self.id); |
237 | let substs = Substitution::type_params(f.db, self.id.parent); | 237 | let substs = TyBuilder::type_params_subst(f.db, self.id.parent); |
238 | let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); | 238 | let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); |
239 | if !(predicates.is_empty() || f.omit_verbose_types()) { | 239 | if !(predicates.is_empty() || f.omit_verbose_types()) { |
240 | write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; | 240 | write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; |
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 42ae53c66..19901ed33 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -514,7 +514,7 @@ impl Field { | |||
514 | VariantDef::Union(it) => it.id.into(), | 514 | VariantDef::Union(it) => it.id.into(), |
515 | VariantDef::Variant(it) => it.parent.id.into(), | 515 | VariantDef::Variant(it) => it.parent.id.into(), |
516 | }; | 516 | }; |
517 | let substs = Substitution::type_params(db, generic_def_id); | 517 | let substs = TyBuilder::type_params_subst(db, generic_def_id); |
518 | let ty = db.field_types(var_id)[self.id].clone().subst(&substs); | 518 | let ty = db.field_types(var_id)[self.id].clone().subst(&substs); |
519 | Type::new(db, self.parent.module(db).id.krate(), var_id, ty) | 519 | Type::new(db, self.parent.module(db).id.krate(), var_id, ty) |
520 | } | 520 | } |
@@ -1501,7 +1501,7 @@ impl TypeParam { | |||
1501 | let resolver = self.id.parent.resolver(db.upcast()); | 1501 | let resolver = self.id.parent.resolver(db.upcast()); |
1502 | let krate = self.id.parent.module(db.upcast()).krate(); | 1502 | let krate = self.id.parent.module(db.upcast()).krate(); |
1503 | let ty = params.get(local_idx)?.clone(); | 1503 | let ty = params.get(local_idx)?.clone(); |
1504 | let subst = Substitution::type_params(db, self.id.parent); | 1504 | let subst = TyBuilder::type_params_subst(db, self.id.parent); |
1505 | let ty = ty.subst(&subst.prefix(local_idx)); | 1505 | let ty = ty.subst(&subst.prefix(local_idx)); |
1506 | Some(Type::new_with_resolver_inner(db, krate, &resolver, ty)) | 1506 | Some(Type::new_with_resolver_inner(db, krate, &resolver, ty)) |
1507 | } | 1507 | } |