From 508a1ecad3cf9c9f01022b3e95f9d6a7ad7a4cd5 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 4 Apr 2021 20:22:00 +0200 Subject: Move things in hir_ty into submodules - all the types that will be replaced by Chalk go to `types` - `TypeWalk` impls go to `walk` --- crates/hir_ty/src/infer/expr.rs | 6 +----- crates/hir_ty/src/infer/pat.rs | 4 ++-- crates/hir_ty/src/infer/path.rs | 2 +- crates/hir_ty/src/infer/unify.rs | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'crates/hir_ty/src/infer') diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index c584a2c08..a87429a24 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -452,11 +452,7 @@ impl<'a> InferenceContext<'a> { }; match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { - substs - .interned(&Interner) - .get(idx) - .map(|a| a.assert_ty_ref(&Interner)) - .cloned() + substs.interned().get(idx).map(|a| a.assert_ty_ref(&Interner)).cloned() }), TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { let local_id = self.db.struct_data(*s).variant_data.field(name)?; diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 5b70d5e5a..469f37dd9 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -123,7 +123,7 @@ impl<'a> InferenceContext<'a> { let ty = match &body[pat] { &Pat::Tuple { ref args, ellipsis } => { let expectations = match expected.as_tuple() { - Some(parameters) => &*parameters.0, + Some(parameters) => &*parameters.interned(), _ => &[], }; @@ -239,7 +239,7 @@ impl<'a> InferenceContext<'a> { let (inner_ty, alloc_ty) = match expected.as_adt() { Some((adt, subst)) if adt == box_adt => ( subst.at(&Interner, 0).assert_ty_ref(&Interner).clone(), - subst.interned(&Interner).get(1).and_then(|a| a.ty(&Interner).cloned()), + subst.interned().get(1).and_then(|a| a.ty(&Interner).cloned()), ), _ => (self.result.standard_types.unknown.clone(), None), }; diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 671ea355f..637341b53 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs @@ -98,7 +98,7 @@ impl<'a> InferenceContext<'a> { let substs = ctx.substs_from_path(path, typable, true); let ty = TyBuilder::value_ty(self.db, typable) .use_parent_substs(&parent_substs) - .fill(substs.interned(&Interner)[parent_substs.len(&Interner)..].iter().cloned()) + .fill(substs.interned()[parent_substs.len(&Interner)..].iter().cloned()) .build(); Some(ty) } diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index a04b935ef..b7bc48569 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -284,7 +284,7 @@ impl InferenceTable { substs2: &Substitution, depth: usize, ) -> bool { - substs1.0.iter().zip(substs2.0.iter()).all(|(t1, t2)| { + substs1.iter(&Interner).zip(substs2.iter(&Interner)).all(|(t1, t2)| { self.unify_inner(t1.assert_ty_ref(&Interner), t2.assert_ty_ref(&Interner), depth) }) } -- cgit v1.2.3 From 645a9c3a274109512839b79d8e86a805a39cd6e1 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 4 Apr 2021 20:27:40 +0200 Subject: Move things from `traits` module to `types` as well --- crates/hir_ty/src/infer/coerce.rs | 2 +- crates/hir_ty/src/infer/expr.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/hir_ty/src/infer') diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 028a4d568..32c273afc 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -7,7 +7,7 @@ use chalk_ir::{cast::Cast, Mutability, TyVariableKind}; use hir_def::lang_item::LangItemTarget; -use crate::{autoderef, traits::Solution, Interner, Ty, TyBuilder, TyKind}; +use crate::{autoderef, Interner, Solution, Ty, TyBuilder, TyKind}; use super::{InEnvironment, InferenceContext}; diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index a87429a24..ccaae53e9 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -20,10 +20,10 @@ use crate::{ method_resolution, op, primitive::{self, UintTy}, to_chalk_trait_id, - traits::{chalk::from_chalk, FnTrait, InEnvironment}, + traits::{chalk::from_chalk, FnTrait}, utils::{generics, variant_data, Generics}, - AdtId, Binders, CallableDefId, FnPointer, FnSig, Interner, Rawness, Scalar, Substitution, - TraitRef, Ty, TyBuilder, TyKind, + AdtId, Binders, CallableDefId, FnPointer, FnSig, InEnvironment, Interner, Rawness, Scalar, + Substitution, TraitRef, Ty, TyBuilder, TyKind, }; use super::{ -- cgit v1.2.3