From c551604b5a0b74a43f5efe567bcbd979daa2f3cc Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 3 Apr 2021 13:08:29 +0200 Subject: Rename Ty::interned to Ty::kind ... since that's the actual method on Chalk side that matches the signature. --- crates/hir_ty/src/infer/coerce.rs | 8 ++++---- crates/hir_ty/src/infer/expr.rs | 12 ++++++------ crates/hir_ty/src/infer/pat.rs | 2 +- crates/hir_ty/src/infer/path.rs | 4 ++-- crates/hir_ty/src/infer/unify.rs | 12 ++++++------ 5 files changed, 19 insertions(+), 19 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 8f7322b36..d887e21a2 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -36,7 +36,7 @@ impl<'a> InferenceContext<'a> { ty1.clone() } else { if let (TyKind::FnDef(..), TyKind::FnDef(..)) = - (ty1.interned(&Interner), ty2.interned(&Interner)) + (ty1.kind(&Interner), ty2.kind(&Interner)) { cov_mark::hit!(coerce_fn_reification); // Special case: two function types. Try to coerce both to @@ -55,7 +55,7 @@ impl<'a> InferenceContext<'a> { } fn coerce_inner(&mut self, mut from_ty: Ty, to_ty: &Ty) -> bool { - match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { + match (from_ty.kind(&Interner), to_ty.kind(&Interner)) { // Never type will make type variable to fallback to Never Type instead of Unknown. (TyKind::Never, TyKind::InferenceVar(tv, TyVariableKind::General)) => { self.table.type_variable_table.set_diverging(*tv, true); @@ -73,7 +73,7 @@ impl<'a> InferenceContext<'a> { } // Pointer weakening and function to pointer - match (from_ty.interned_mut(), to_ty.interned(&Interner)) { + match (from_ty.interned_mut(), to_ty.kind(&Interner)) { // `*mut T` -> `*const T` // `&mut T` -> `&T` (TyKind::Raw(m1, ..), TyKind::Raw(m2 @ Mutability::Not, ..)) @@ -111,7 +111,7 @@ impl<'a> InferenceContext<'a> { } // Auto Deref if cannot coerce - match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { + match (from_ty.kind(&Interner), to_ty.kind(&Interner)) { // FIXME: DerefMut (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2), diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index b99b6cd21..dd3914ec3 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -455,7 +455,7 @@ impl<'a> InferenceContext<'a> { }) .unwrap_or(true) }; - match canonicalized.decanonicalize_ty(derefed_ty.value).interned(&Interner) { + match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { substs .interned(&Interner) @@ -577,7 +577,7 @@ impl<'a> InferenceContext<'a> { None => self.err_ty(), }, UnaryOp::Neg => { - match inner_ty.interned(&Interner) { + match inner_ty.kind(&Interner) { // Fast path for builtins TyKind::Scalar(Scalar::Int(_)) | TyKind::Scalar(Scalar::Uint(_)) @@ -590,7 +590,7 @@ impl<'a> InferenceContext<'a> { } } UnaryOp::Not => { - match inner_ty.interned(&Interner) { + match inner_ty.kind(&Interner) { // Fast path for builtins TyKind::Scalar(Scalar::Bool) | TyKind::Scalar(Scalar::Int(_)) @@ -696,7 +696,7 @@ impl<'a> InferenceContext<'a> { } } Expr::Tuple { exprs } => { - let mut tys = match expected.ty.interned(&Interner) { + let mut tys = match expected.ty.kind(&Interner) { TyKind::Tuple(_, substs) => substs .iter(&Interner) .map(|a| a.assert_ty_ref(&Interner).clone()) @@ -713,7 +713,7 @@ impl<'a> InferenceContext<'a> { TyKind::Tuple(tys.len(), Substitution::from_iter(&Interner, tys)).intern(&Interner) } Expr::Array(array) => { - let elem_ty = match expected.ty.interned(&Interner) { + let elem_ty = match expected.ty.kind(&Interner) { TyKind::Array(st) | TyKind::Slice(st) => st.clone(), _ => self.table.new_type_var(), }; @@ -961,7 +961,7 @@ impl<'a> InferenceContext<'a> { } fn register_obligations_for_call(&mut self, callable_ty: &Ty) { - if let TyKind::FnDef(fn_def, parameters) = callable_ty.interned(&Interner) { + if let TyKind::FnDef(fn_def, parameters) = callable_ty.kind(&Interner) { let def: CallableDefId = from_chalk(self.db, *fn_def); let generic_predicates = self.db.generic_predicates(def.into()); for predicate in generic_predicates.iter() { diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index f1316415f..10df8d8cb 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -211,7 +211,7 @@ impl<'a> InferenceContext<'a> { return inner_ty; } Pat::Slice { prefix, slice, suffix } => { - let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.interned(&Interner) { + let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.kind(&Interner) { TyKind::Array(st) => (TyKind::Array, st.clone()), TyKind::Slice(st) => (TyKind::Slice, st.clone()), _ => (TyKind::Slice, self.err_ty()), diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index b96391776..1ba15f737 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs @@ -147,7 +147,7 @@ impl<'a> InferenceContext<'a> { remaining_segments_for_ty, true, ); - if let TyKind::Unknown = ty.interned(&Interner) { + if let TyKind::Unknown = ty.kind(&Interner) { return None; } @@ -212,7 +212,7 @@ impl<'a> InferenceContext<'a> { name: &Name, id: ExprOrPatId, ) -> Option<(ValueNs, Option)> { - if let TyKind::Unknown = ty.interned(&Interner) { + if let TyKind::Unknown = ty.kind(&Interner) { return None; } diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 0efc62e53..d2496db3b 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -49,7 +49,7 @@ impl<'a, 'b> Canonicalizer<'a, 'b> { fn do_canonicalize(&mut self, t: T, binders: DebruijnIndex) -> T { t.fold_binders( - &mut |ty, binders| match ty.interned(&Interner) { + &mut |ty, binders| match ty.kind(&Interner) { &TyKind::InferenceVar(var, kind) => { let inner = var.to_inner(); if self.var_stack.contains(&inner) { @@ -304,7 +304,7 @@ impl InferenceTable { let ty1 = self.resolve_ty_shallow(ty1); let ty2 = self.resolve_ty_shallow(ty2); if ty1.equals_ctor(&ty2) { - match (ty1.interned(&Interner), ty2.interned(&Interner)) { + match (ty1.kind(&Interner), ty2.kind(&Interner)) { (TyKind::Adt(_, substs1), TyKind::Adt(_, substs2)) | (TyKind::FnDef(_, substs1), TyKind::FnDef(_, substs2)) | ( @@ -329,7 +329,7 @@ impl InferenceTable { } pub(super) fn unify_inner_trivial(&mut self, ty1: &Ty, ty2: &Ty, depth: usize) -> bool { - match (ty1.interned(&Interner), ty2.interned(&Interner)) { + match (ty1.kind(&Interner), ty2.kind(&Interner)) { (TyKind::Unknown, _) | (_, TyKind::Unknown) => true, (TyKind::Placeholder(p1), TyKind::Placeholder(p2)) if *p1 == *p2 => true, @@ -458,7 +458,7 @@ impl InferenceTable { if i > 0 { cov_mark::hit!(type_var_resolves_to_int_var); } - match ty.interned(&Interner) { + match ty.kind(&Interner) { TyKind::InferenceVar(tv, _) => { let inner = tv.to_inner(); match self.var_unification_table.inlined_probe_value(inner).known() { @@ -481,7 +481,7 @@ impl InferenceTable { /// be resolved as far as possible, i.e. contain no type variables with /// known type. fn resolve_ty_as_possible_inner(&mut self, tv_stack: &mut Vec, ty: Ty) -> Ty { - ty.fold(&mut |ty| match ty.interned(&Interner) { + ty.fold(&mut |ty| match ty.kind(&Interner) { &TyKind::InferenceVar(tv, kind) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { @@ -508,7 +508,7 @@ impl InferenceTable { /// Resolves the type completely; type variables without known type are /// replaced by TyKind::Unknown. fn resolve_ty_completely_inner(&mut self, tv_stack: &mut Vec, ty: Ty) -> Ty { - ty.fold(&mut |ty| match ty.interned(&Interner) { + ty.fold(&mut |ty| match ty.kind(&Interner) { &TyKind::InferenceVar(tv, kind) => { let inner = tv.to_inner(); if tv_stack.contains(&inner) { -- cgit v1.2.3