diff options
author | Florian Diebold <[email protected]> | 2021-03-13 13:44:51 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-13 15:17:15 +0000 |
commit | 6c32bbf3ca5980fb33c1ea28dd1c5a1524ce81cb (patch) | |
tree | f81c7438f67de3c292a233887e56c7e99bcc0a01 /crates/hir_ty/src/autoderef.rs | |
parent | 7accf6bc37c059a83a58c82f463f02a02ed2226f (diff) |
Separate `Ty` and `TyKind` like in Chalk
Currently `Ty` just wraps `TyKind`, but this allows us to change most
places to already use `intern` / `interned`.
Diffstat (limited to 'crates/hir_ty/src/autoderef.rs')
-rw-r--r-- | crates/hir_ty/src/autoderef.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index be1fd1f13..09009a3d8 100644 --- a/crates/hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs | |||
@@ -14,7 +14,7 @@ use crate::{ | |||
14 | db::HirDatabase, | 14 | db::HirDatabase, |
15 | traits::{InEnvironment, Solution}, | 15 | traits::{InEnvironment, Solution}, |
16 | utils::generics, | 16 | utils::generics, |
17 | BoundVar, Canonical, DebruijnIndex, Obligation, Substs, TraitRef, Ty, | 17 | BoundVar, Canonical, DebruijnIndex, Interner, Obligation, Substs, TraitRef, Ty, TyKind, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 20 | const AUTODEREF_RECURSION_LIMIT: usize = 10; |
@@ -81,7 +81,8 @@ fn deref_by_trait( | |||
81 | 81 | ||
82 | // Now do the assoc type projection | 82 | // Now do the assoc type projection |
83 | let projection = super::traits::ProjectionPredicate { | 83 | let projection = super::traits::ProjectionPredicate { |
84 | ty: Ty::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, ty.value.kinds.len())), | 84 | ty: TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, ty.value.kinds.len())) |
85 | .intern(&Interner), | ||
85 | projection_ty: super::ProjectionTy { associated_ty: target, parameters }, | 86 | projection_ty: super::ProjectionTy { associated_ty: target, parameters }, |
86 | }; | 87 | }; |
87 | 88 | ||
@@ -114,8 +115,8 @@ fn deref_by_trait( | |||
114 | // new variables in that case | 115 | // new variables in that case |
115 | 116 | ||
116 | for i in 1..vars.0.kinds.len() { | 117 | for i in 1..vars.0.kinds.len() { |
117 | if vars.0.value[i - 1] | 118 | if vars.0.value[i - 1].interned(&Interner) |
118 | != Ty::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) | 119 | != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) |
119 | { | 120 | { |
120 | warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.value, solution); | 121 | warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.value, solution); |
121 | return None; | 122 | return None; |