From ce2cae45b5242d59b744018dd79bc2ab74670edc Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 15 Mar 2021 21:02:34 +0100 Subject: Rename Substs -> Substitution --- crates/hir/src/display.rs | 4 ++-- crates/hir/src/lib.rs | 16 ++++++++-------- crates/hir/src/source_analyzer.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'crates/hir/src') 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}; use crate::{ Adt, Const, ConstParam, Enum, Field, Function, GenericParam, HasVisibility, LifetimeParam, - Module, Static, Struct, Substs, Trait, Type, TypeAlias, TypeParam, Union, Variant, + Module, Static, Struct, Substitution, Trait, Type, TypeAlias, TypeParam, Union, Variant, }; impl HirDisplay for Function { @@ -235,7 +235,7 @@ impl HirDisplay for TypeParam { fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { write!(f, "{}", self.name(f.db))?; let bounds = f.db.generic_predicates_for_param(self.id); - let substs = Substs::type_params(f.db, self.id.parent); + let substs = Substitution::type_params(f.db, self.id.parent); let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::>(); if !(predicates.is_empty() || f.omit_verbose_types()) { 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::{ to_assoc_type_id, traits::{FnTrait, Solution, SolutionVariables}, AliasTy, BoundVar, CallableDefId, CallableSig, Canonical, DebruijnIndex, GenericPredicate, - InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substs, Ty, - TyDefId, TyKind, TyVariableKind, + InEnvironment, Interner, Obligation, ProjectionPredicate, ProjectionTy, Scalar, Substitution, + Ty, TyDefId, TyKind, TyVariableKind, }; use itertools::Itertools; use rustc_hash::FxHashSet; @@ -518,7 +518,7 @@ impl Field { VariantDef::Union(it) => it.id.into(), VariantDef::Variant(it) => it.parent.id.into(), }; - let substs = Substs::type_params(db, generic_def_id); + let substs = Substitution::type_params(db, generic_def_id); let ty = db.field_types(var_id)[self.id].clone().subst(&substs); Type::new(db, self.parent.module(db).id.krate(), var_id, ty) } @@ -1471,7 +1471,7 @@ impl TypeParam { let resolver = self.id.parent.resolver(db.upcast()); let krate = self.id.parent.module(db.upcast()).krate(); let ty = params.get(local_idx)?.clone(); - let subst = Substs::type_params(db, self.id.parent); + let subst = Substitution::type_params(db, self.id.parent); let ty = ty.subst(&subst.prefix(local_idx)); Some(Type::new_with_resolver_inner(db, krate, &resolver, ty)) } @@ -1674,7 +1674,7 @@ impl Type { krate: CrateId, def: impl HasResolver + Into + Into, ) -> Type { - let substs = Substs::build_for_def(db, def).fill_with_unknown().build(); + let substs = Substitution::build_for_def(db, def).fill_with_unknown().build(); let ty = db.ty(def.into()).subst(&substs); Type::new(db, krate, def, ty) } @@ -1754,7 +1754,7 @@ impl Type { pub fn impls_trait(&self, db: &dyn HirDatabase, trait_: Trait, args: &[Type]) -> bool { let trait_ref = hir_ty::TraitRef { trait_: trait_.id, - substs: Substs::build_for_def(db, trait_.id) + substs: Substitution::build_for_def(db, trait_.id) .push(self.ty.value.clone()) .fill(args.iter().map(|t| t.ty.value.clone())) .build(), @@ -1778,7 +1778,7 @@ impl Type { args: &[Type], alias: TypeAlias, ) -> Option { - let subst = Substs::build_for_def(db, trait_.id) + let subst = Substitution::build_for_def(db, trait_.id) .push(self.ty.value.clone()) .fill(args.iter().map(|t| t.ty.value.clone())) .build(); @@ -2045,7 +2045,7 @@ impl Type { fn walk_substs( db: &dyn HirDatabase, type_: &Type, - substs: &Substs, + substs: &Substitution, cb: &mut impl FnMut(Type), ) { 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::{ use hir_expand::{hygiene::Hygiene, name::AsName, HirFileId, InFile}; use hir_ty::{ diagnostics::{record_literal_missing_fields, record_pattern_missing_fields}, - InferenceResult, Substs, + InferenceResult, Substitution, }; use syntax::{ ast::{self, AstNode}, @@ -329,7 +329,7 @@ impl SourceAnalyzer { &self, db: &dyn HirDatabase, krate: CrateId, - substs: &Substs, + substs: &Substitution, variant: VariantId, missing_fields: Vec, ) -> Vec<(Field, Type)> { -- cgit v1.2.3