aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/chalk_ext.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-21 18:51:53 +0100
committerGitHub <[email protected]>2021-05-21 18:51:53 +0100
commitedbde25ca2f13ffacfd006ada7b38618d36d97c6 (patch)
treeb1c5208c74ce56a36c8a9c454b9c479a3312ee94 /crates/hir_ty/src/chalk_ext.rs
parentde403b10448e23f232804596538de92fc57203d6 (diff)
parentef558c97d09b0be8639c92f490e5ad380aa04288 (diff)
Merge #8856
8856: Use Chalk for unification r=flodiebold a=flodiebold - use Chalk's unification, get rid of our own `unify` - rewrite coercion to not use unification internals and to be more analogous to rustc - fix various coercion bugs - rewrite handling of obligations, since the old hacky optimization where we noted when an inference variable changes wasn't possible anymore - stop trying to deeply resolve types all the time during inference, instead only do it shallowly where necessary Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/chalk_ext.rs')
-rw-r--r--crates/hir_ty/src/chalk_ext.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/hir_ty/src/chalk_ext.rs b/crates/hir_ty/src/chalk_ext.rs
index 5232a7d80..df340a6ca 100644
--- a/crates/hir_ty/src/chalk_ext.rs
+++ b/crates/hir_ty/src/chalk_ext.rs
@@ -18,6 +18,7 @@ pub trait TyExt {
18 fn is_unit(&self) -> bool; 18 fn is_unit(&self) -> bool;
19 fn is_never(&self) -> bool; 19 fn is_never(&self) -> bool;
20 fn is_unknown(&self) -> bool; 20 fn is_unknown(&self) -> bool;
21 fn is_ty_var(&self) -> bool;
21 22
22 fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)>; 23 fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)>;
23 fn as_builtin(&self) -> Option<BuiltinType>; 24 fn as_builtin(&self) -> Option<BuiltinType>;
@@ -55,6 +56,10 @@ impl TyExt for Ty {
55 matches!(self.kind(&Interner), TyKind::Error) 56 matches!(self.kind(&Interner), TyKind::Error)
56 } 57 }
57 58
59 fn is_ty_var(&self) -> bool {
60 matches!(self.kind(&Interner), TyKind::InferenceVar(_, _))
61 }
62
58 fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)> { 63 fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)> {
59 match self.kind(&Interner) { 64 match self.kind(&Interner) {
60 TyKind::Adt(AdtId(adt), parameters) => Some((*adt, parameters)), 65 TyKind::Adt(AdtId(adt), parameters) => Some((*adt, parameters)),