aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/display.rs4
-rw-r--r--crates/hir/src/lib.rs16
-rw-r--r--crates/hir/src/source_analyzer.rs4
3 files changed, 12 insertions, 12 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs
index 81f0e04e5..9f6d7be48 100644
--- a/crates/hir/src/display.rs
+++ b/crates/hir/src/display.rs
@@ -13,7 +13,7 @@ use syntax::ast::{self, NameOwner};
13 13
14use crate::{ 14use 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, Substs, Trait, Type, TypeAlias, TypeParam, Union, Variant, 16 Module, Static, Struct, Substitution, Trait, Type, TypeAlias, TypeParam, Union, Variant,
17}; 17};
18 18
19impl HirDisplay for Function { 19impl HirDisplay for Function {
@@ -235,7 +235,7 @@ impl HirDisplay for TypeParam {
235 fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { 235 fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
236 write!(f, "{}", self.name(f.db))?; 236 write!(f, "{}", self.name(f.db))?;
237 let bounds = f.db.generic_predicates_for_param(self.id); 237 let bounds = f.db.generic_predicates_for_param(self.id);
238 let substs = Substs::type_params(f.db, self.id.parent); 238 let substs = Substitution::type_params(f.db, self.id.parent);
239 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); 239 let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>();
240 if !(predicates.is_empty() || f.omit_verbose_types()) { 240 if !(predicates.is_empty() || f.omit_verbose_types()) {
241 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; 241 write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?;
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index ad79a79f8..12dd5fb38 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -57,8 +57,8 @@ use hir_ty::{
57 to_assoc_type_id, 57 to_assoc_type_id,
58 traits::{FnTrait, Solution, SolutionVariables}, 58 traits::{FnTrait, Solution, SolutionVariables},
59 AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, 59 AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate,
60 InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, Ty, 60 InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substitution,
61 TyDefId, TyKind, TyVariableKind, 61 Ty, TyDefId, TyKind, TyVariableKind,
62}; 62};
63use itertools::Itertools; 63use itertools::Itertools;
64use rustc_hash::FxHashSet; 64use rustc_hash::FxHashSet;
@@ -518,7 +518,7 @@ impl Field {
518 VariantDef::Union(it) => it.id.into(), 518 VariantDef::Union(it) => it.id.into(),
519 VariantDef::Variant(it) => it.parent.id.into(), 519 VariantDef::Variant(it) => it.parent.id.into(),
520 }; 520 };
521 let substs = Substs::type_params(db, generic_def_id); 521 let substs = Substitution::type_params(db, generic_def_id);
522 let ty = db.field_types(var_id)[self.id].clone().subst(&substs); 522 let ty = db.field_types(var_id)[self.id].clone().subst(&substs);
523 Type::new(db, self.parent.module(db).id.krate(), var_id, ty) 523 Type::new(db, self.parent.module(db).id.krate(), var_id, ty)
524 } 524 }
@@ -1471,7 +1471,7 @@ impl TypeParam {
1471 let resolver = self.id.parent.resolver(db.upcast()); 1471 let resolver = self.id.parent.resolver(db.upcast());
1472 let krate = self.id.parent.module(db.upcast()).krate(); 1472 let krate = self.id.parent.module(db.upcast()).krate();
1473 let ty = params.get(local_idx)?.clone(); 1473 let ty = params.get(local_idx)?.clone();
1474 let subst = Substs::type_params(db, self.id.parent); 1474 let subst = Substitution::type_params(db, self.id.parent);
1475 let ty = ty.subst(&subst.prefix(local_idx)); 1475 let ty = ty.subst(&subst.prefix(local_idx));
1476 Some(Type::new_with_resolver_inner(db, krate, &resolver, ty)) 1476 Some(Type::new_with_resolver_inner(db, krate, &resolver, ty))
1477 } 1477 }
@@ -1674,7 +1674,7 @@ impl Type {
1674 krate: CrateId, 1674 krate: CrateId,
1675 def: impl HasResolver + Into<TyDefId> + Into<GenericDefId>, 1675 def: impl HasResolver + Into<TyDefId> + Into<GenericDefId>,
1676 ) -> Type { 1676 ) -> Type {
1677 let substs = Substs::build_for_def(db, def).fill_with_unknown().build(); 1677 let substs = Substitution::build_for_def(db, def).fill_with_unknown().build();
1678 let ty = db.ty(def.into()).subst(&substs); 1678 let ty = db.ty(def.into()).subst(&substs);
1679 Type::new(db, krate, def, ty) 1679 Type::new(db, krate, def, ty)
1680 } 1680 }
@@ -1754,7 +1754,7 @@ impl Type {
1754 pub fn impls_trait(&self, db: &dyn HirDatabase, trait_: Trait, args: &[Type]) -> bool { 1754 pub fn impls_trait(&self, db: &dyn HirDatabase, trait_: Trait, args: &[Type]) -> bool {
1755 let trait_ref = hir_ty::TraitRef { 1755 let trait_ref = hir_ty::TraitRef {
1756 trait_: trait_.id, 1756 trait_: trait_.id,
1757 substs: Substs::build_for_def(db, trait_.id) 1757 substs: Substitution::build_for_def(db, trait_.id)
1758 .push(self.ty.value.clone()) 1758 .push(self.ty.value.clone())
1759 .fill(args.iter().map(|t| t.ty.value.clone())) 1759 .fill(args.iter().map(|t| t.ty.value.clone()))
1760 .build(), 1760 .build(),
@@ -1778,7 +1778,7 @@ impl Type {
1778 args: &[Type], 1778 args: &[Type],
1779 alias: TypeAlias, 1779 alias: TypeAlias,
1780 ) -> Option<Type> { 1780 ) -> Option<Type> {
1781 let subst = Substs::build_for_def(db, trait_.id) 1781 let subst = Substitution::build_for_def(db, trait_.id)
1782 .push(self.ty.value.clone()) 1782 .push(self.ty.value.clone())
1783 .fill(args.iter().map(|t| t.ty.value.clone())) 1783 .fill(args.iter().map(|t| t.ty.value.clone()))
1784 .build(); 1784 .build();
@@ -2045,7 +2045,7 @@ impl Type {
2045 fn walk_substs( 2045 fn walk_substs(
2046 db: &dyn HirDatabase, 2046 db: &dyn HirDatabase,
2047 type_: &Type, 2047 type_: &Type,
2048 substs: &Substs, 2048 substs: &Substitution,
2049 cb: &mut impl FnMut(Type), 2049 cb: &mut impl FnMut(Type),
2050 ) { 2050 ) {
2051 for ty in substs.iter() { 2051 for ty in substs.iter() {
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 4d59293e9..117f32a9e 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -20,7 +20,7 @@ use hir_def::{
20use hir_expand::{hygiene::Hygiene, name::AsName, HirFileId, InFile}; 20use hir_expand::{hygiene::Hygiene, name::AsName, HirFileId, InFile};
21use hir_ty::{ 21use hir_ty::{
22 diagnostics::{record_literal_missing_fields, record_pattern_missing_fields}, 22 diagnostics::{record_literal_missing_fields, record_pattern_missing_fields},
23 InferenceResult, Substs, 23 InferenceResult, Substitution,
24}; 24};
25use syntax::{ 25use syntax::{
26 ast::{self, AstNode}, 26 ast::{self, AstNode},
@@ -329,7 +329,7 @@ impl SourceAnalyzer {
329 &self, 329 &self,
330 db: &dyn HirDatabase, 330 db: &dyn HirDatabase,
331 krate: CrateId, 331 krate: CrateId,
332 substs: &Substs, 332 substs: &Substitution,
333 variant: VariantId, 333 variant: VariantId,
334 missing_fields: Vec<LocalFieldId>, 334 missing_fields: Vec<LocalFieldId>,
335 ) -> Vec<(Field, Type)> { 335 ) -> Vec<(Field, Type)> {