diff options
author | Florian Diebold <[email protected]> | 2021-04-03 12:08:29 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-03 12:08:29 +0100 |
commit | c551604b5a0b74a43f5efe567bcbd979daa2f3cc (patch) | |
tree | aba0fc8a8b9dcd3456f47ae5cd28fa672a7a6911 /crates/hir_ty/src/method_resolution.rs | |
parent | 8289b96216b5d4ddd0b6cf9feccb7af574d022a8 (diff) |
Rename Ty::interned to Ty::kind
... since that's the actual method on Chalk side that matches the signature.
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 054896475..338851fa8 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -47,7 +47,7 @@ impl TyFingerprint { | |||
47 | /// have impls: if we have some `struct S`, we can have an `impl S`, but not | 47 | /// have impls: if we have some `struct S`, we can have an `impl S`, but not |
48 | /// `impl &S`. Hence, this will return `None` for reference types and such. | 48 | /// `impl &S`. Hence, this will return `None` for reference types and such. |
49 | pub fn for_impl(ty: &Ty) -> Option<TyFingerprint> { | 49 | pub fn for_impl(ty: &Ty) -> Option<TyFingerprint> { |
50 | let fp = match *ty.interned(&Interner) { | 50 | let fp = match *ty.kind(&Interner) { |
51 | TyKind::Str => TyFingerprint::Str, | 51 | TyKind::Str => TyFingerprint::Str, |
52 | TyKind::Never => TyFingerprint::Never, | 52 | TyKind::Never => TyFingerprint::Never, |
53 | TyKind::Slice(..) => TyFingerprint::Slice, | 53 | TyKind::Slice(..) => TyFingerprint::Slice, |
@@ -243,7 +243,7 @@ impl Ty { | |||
243 | 243 | ||
244 | let mod_to_crate_ids = |module: ModuleId| Some(std::iter::once(module.krate()).collect()); | 244 | let mod_to_crate_ids = |module: ModuleId| Some(std::iter::once(module.krate()).collect()); |
245 | 245 | ||
246 | let lang_item_targets = match self.interned(&Interner) { | 246 | let lang_item_targets = match self.kind(&Interner) { |
247 | TyKind::Adt(AdtId(def_id), _) => { | 247 | TyKind::Adt(AdtId(def_id), _) => { |
248 | return mod_to_crate_ids(def_id.module(db.upcast())); | 248 | return mod_to_crate_ids(def_id.module(db.upcast())); |
249 | } | 249 | } |
@@ -563,7 +563,7 @@ fn iterate_trait_method_candidates( | |||
563 | // if ty is `dyn Trait`, the trait doesn't need to be in scope | 563 | // if ty is `dyn Trait`, the trait doesn't need to be in scope |
564 | let inherent_trait = | 564 | let inherent_trait = |
565 | self_ty.value.dyn_trait().into_iter().flat_map(|t| all_super_traits(db.upcast(), t)); | 565 | self_ty.value.dyn_trait().into_iter().flat_map(|t| all_super_traits(db.upcast(), t)); |
566 | let env_traits = if let TyKind::Placeholder(_) = self_ty.value.interned(&Interner) { | 566 | let env_traits = if let TyKind::Placeholder(_) = self_ty.value.kind(&Interner) { |
567 | // if we have `T: Trait` in the param env, the trait doesn't need to be in scope | 567 | // if we have `T: Trait` in the param env, the trait doesn't need to be in scope |
568 | env.traits_in_scope_from_clauses(&self_ty.value) | 568 | env.traits_in_scope_from_clauses(&self_ty.value) |
569 | .flat_map(|t| all_super_traits(db.upcast(), t)) | 569 | .flat_map(|t| all_super_traits(db.upcast(), t)) |
@@ -741,7 +741,7 @@ pub(crate) fn inherent_impl_substs( | |||
741 | fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution { | 741 | fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution { |
742 | s.fold_binders( | 742 | s.fold_binders( |
743 | &mut |ty, binders| { | 743 | &mut |ty, binders| { |
744 | if let TyKind::BoundVar(bound) = ty.interned(&Interner) { | 744 | if let TyKind::BoundVar(bound) = ty.kind(&Interner) { |
745 | if bound.index >= num_vars_to_keep && bound.debruijn >= binders { | 745 | if bound.index >= num_vars_to_keep && bound.debruijn >= binders { |
746 | TyKind::Unknown.intern(&Interner) | 746 | TyKind::Unknown.intern(&Interner) |
747 | } else { | 747 | } else { |
@@ -839,9 +839,7 @@ fn autoderef_method_receiver( | |||
839 | ) -> Vec<Canonical<Ty>> { | 839 | ) -> Vec<Canonical<Ty>> { |
840 | let mut deref_chain: Vec<_> = autoderef::autoderef(db, Some(krate), ty).collect(); | 840 | let mut deref_chain: Vec<_> = autoderef::autoderef(db, Some(krate), ty).collect(); |
841 | // As a last step, we can do array unsizing (that's the only unsizing that rustc does for method receivers!) | 841 | // As a last step, we can do array unsizing (that's the only unsizing that rustc does for method receivers!) |
842 | if let Some(TyKind::Array(parameters)) = | 842 | if let Some(TyKind::Array(parameters)) = deref_chain.last().map(|ty| ty.value.kind(&Interner)) { |
843 | deref_chain.last().map(|ty| ty.value.interned(&Interner)) | ||
844 | { | ||
845 | let kinds = deref_chain.last().unwrap().binders.clone(); | 843 | let kinds = deref_chain.last().unwrap().binders.clone(); |
846 | let unsized_ty = TyKind::Slice(parameters.clone()).intern(&Interner); | 844 | let unsized_ty = TyKind::Slice(parameters.clone()).intern(&Interner); |
847 | deref_chain.push(Canonical { value: unsized_ty, binders: kinds }) | 845 | deref_chain.push(Canonical { value: unsized_ty, binders: kinds }) |