aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-03 12:09:43 +0100
committerGitHub <[email protected]>2021-04-03 12:09:43 +0100
commit2f87ee7f3f9c1efd726774511c9ce02caef73872 (patch)
treeaba0fc8a8b9dcd3456f47ae5cd28fa672a7a6911 /crates/hir_ty/src
parent8289b96216b5d4ddd0b6cf9feccb7af574d022a8 (diff)
parentc551604b5a0b74a43f5efe567bcbd979daa2f3cc (diff)
Merge #8310
8310: Rename Ty::interned to Ty::kind r=flodiebold a=flodiebold ... since that's the actual method on Chalk side that matches the signature. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/autoderef.rs2
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs2
-rw-r--r--crates/hir_ty/src/diagnostics/match_check.rs2
-rw-r--r--crates/hir_ty/src/diagnostics/unsafe_check.rs2
-rw-r--r--crates/hir_ty/src/display.rs8
-rw-r--r--crates/hir_ty/src/infer.rs4
-rw-r--r--crates/hir_ty/src/infer/coerce.rs8
-rw-r--r--crates/hir_ty/src/infer/expr.rs12
-rw-r--r--crates/hir_ty/src/infer/pat.rs2
-rw-r--r--crates/hir_ty/src/infer/path.rs4
-rw-r--r--crates/hir_ty/src/infer/unify.rs12
-rw-r--r--crates/hir_ty/src/lib.rs40
-rw-r--r--crates/hir_ty/src/method_resolution.rs12
-rw-r--r--crates/hir_ty/src/op.rs8
-rw-r--r--crates/hir_ty/src/traits.rs2
-rw-r--r--crates/hir_ty/src/traits/chalk.rs2
16 files changed, 60 insertions, 62 deletions
diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs
index 5e3c018a8..c859f9491 100644
--- a/crates/hir_ty/src/autoderef.rs
+++ b/crates/hir_ty/src/autoderef.rs
@@ -131,7 +131,7 @@ fn deref_by_trait(
131 // new variables in that case 131 // new variables in that case
132 132
133 for i in 1..vars.0.binders.len(&Interner) { 133 for i in 1..vars.0.binders.len(&Interner) {
134 if vars.0.value.at(&Interner, i - 1).assert_ty_ref(&Interner).interned(&Interner) 134 if vars.0.value.at(&Interner, i - 1).assert_ty_ref(&Interner).kind(&Interner)
135 != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) 135 != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1))
136 { 136 {
137 warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.goal, solution); 137 warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.goal, solution);
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index 373d1cb74..ad1259b34 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -378,7 +378,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
378 _ => return, 378 _ => return,
379 }; 379 };
380 380
381 let (params, required) = match mismatch.expected.interned(&Interner) { 381 let (params, required) = match mismatch.expected.kind(&Interner) {
382 TyKind::Adt(AdtId(hir_def::AdtId::EnumId(enum_id)), ref parameters) 382 TyKind::Adt(AdtId(hir_def::AdtId::EnumId(enum_id)), ref parameters)
383 if *enum_id == core_result_enum => 383 if *enum_id == core_result_enum =>
384 { 384 {
diff --git a/crates/hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs
index 85ba58c44..34291578a 100644
--- a/crates/hir_ty/src/diagnostics/match_check.rs
+++ b/crates/hir_ty/src/diagnostics/match_check.rs
@@ -626,7 +626,7 @@ pub(super) fn is_useful(
626 // - enum with no variants 626 // - enum with no variants
627 // - `!` type 627 // - `!` type
628 // In those cases, no match arm is useful. 628 // In those cases, no match arm is useful.
629 match cx.infer[cx.match_expr].strip_references().interned(&Interner) { 629 match cx.infer[cx.match_expr].strip_references().kind(&Interner) {
630 TyKind::Adt(AdtId(hir_def::AdtId::EnumId(enum_id)), ..) => { 630 TyKind::Adt(AdtId(hir_def::AdtId::EnumId(enum_id)), ..) => {
631 if cx.db.enum_data(*enum_id).variants.is_empty() { 631 if cx.db.enum_data(*enum_id).variants.is_empty() {
632 return Ok(Usefulness::NotUseful); 632 return Ok(Usefulness::NotUseful);
diff --git a/crates/hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs
index 1f49a4909..a71eebc6f 100644
--- a/crates/hir_ty/src/diagnostics/unsafe_check.rs
+++ b/crates/hir_ty/src/diagnostics/unsafe_check.rs
@@ -110,7 +110,7 @@ fn walk_unsafe(
110 } 110 }
111 } 111 }
112 Expr::UnaryOp { expr, op: UnaryOp::Deref } => { 112 Expr::UnaryOp { expr, op: UnaryOp::Deref } => {
113 if let TyKind::Raw(..) = &infer[*expr].interned(&Interner) { 113 if let TyKind::Raw(..) = &infer[*expr].kind(&Interner) {
114 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block }); 114 unsafe_exprs.push(UnsafeExpr { expr: current, inside_unsafe_block });
115 } 115 }
116 } 116 }
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 59fd18c2a..97f1092c6 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -292,7 +292,7 @@ impl HirDisplay for Ty {
292 return write!(f, "{}", TYPE_HINT_TRUNCATION); 292 return write!(f, "{}", TYPE_HINT_TRUNCATION);
293 } 293 }
294 294
295 match self.interned(&Interner) { 295 match self.kind(&Interner) {
296 TyKind::Never => write!(f, "!")?, 296 TyKind::Never => write!(f, "!")?,
297 TyKind::Str => write!(f, "str")?, 297 TyKind::Str => write!(f, "str")?,
298 TyKind::Scalar(Scalar::Bool) => write!(f, "bool")?, 298 TyKind::Scalar(Scalar::Bool) => write!(f, "bool")?,
@@ -314,7 +314,7 @@ impl HirDisplay for Ty {
314 let ty_display = 314 let ty_display =
315 t.into_displayable(f.db, f.max_size, f.omit_verbose_types, f.display_target); 315 t.into_displayable(f.db, f.max_size, f.omit_verbose_types, f.display_target);
316 316
317 if matches!(self.interned(&Interner), TyKind::Raw(..)) { 317 if matches!(self.kind(&Interner), TyKind::Raw(..)) {
318 write!( 318 write!(
319 f, 319 f,
320 "*{}", 320 "*{}",
@@ -336,7 +336,7 @@ impl HirDisplay for Ty {
336 336
337 // FIXME: all this just to decide whether to use parentheses... 337 // FIXME: all this just to decide whether to use parentheses...
338 let datas; 338 let datas;
339 let predicates: Vec<_> = match t.interned(&Interner) { 339 let predicates: Vec<_> = match t.kind(&Interner) {
340 TyKind::Dyn(dyn_ty) if dyn_ty.bounds.skip_binders().interned().len() > 1 => { 340 TyKind::Dyn(dyn_ty) if dyn_ty.bounds.skip_binders().interned().len() > 1 => {
341 dyn_ty.bounds.skip_binders().interned().iter().cloned().collect() 341 dyn_ty.bounds.skip_binders().interned().iter().cloned().collect()
342 } 342 }
@@ -473,7 +473,7 @@ impl HirDisplay for Ty {
473 let mut default_from = 0; 473 let mut default_from = 0;
474 for (i, parameter) in parameters.iter(&Interner).enumerate() { 474 for (i, parameter) in parameters.iter(&Interner).enumerate() {
475 match ( 475 match (
476 parameter.assert_ty_ref(&Interner).interned(&Interner), 476 parameter.assert_ty_ref(&Interner).kind(&Interner),
477 default_parameters.get(i), 477 default_parameters.get(i),
478 ) { 478 ) {
479 (&TyKind::Unknown, _) | (_, None) => { 479 (&TyKind::Unknown, _) | (_, None) => {
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index 674e9e6f9..b871594bd 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -325,7 +325,7 @@ impl<'a> InferenceContext<'a> {
325 325
326 /// Replaces Ty::Unknown by a new type var, so we can maybe still infer it. 326 /// Replaces Ty::Unknown by a new type var, so we can maybe still infer it.
327 fn insert_type_vars_shallow(&mut self, ty: Ty) -> Ty { 327 fn insert_type_vars_shallow(&mut self, ty: Ty) -> Ty {
328 match ty.interned(&Interner) { 328 match ty.kind(&Interner) {
329 TyKind::Unknown => self.table.new_type_var(), 329 TyKind::Unknown => self.table.new_type_var(),
330 _ => ty, 330 _ => ty,
331 } 331 }
@@ -438,7 +438,7 @@ impl<'a> InferenceContext<'a> {
438 /// to do it as well. 438 /// to do it as well.
439 fn normalize_associated_types_in(&mut self, ty: Ty) -> Ty { 439 fn normalize_associated_types_in(&mut self, ty: Ty) -> Ty {
440 let ty = self.resolve_ty_as_possible(ty); 440 let ty = self.resolve_ty_as_possible(ty);
441 ty.fold(&mut |ty| match ty.interned(&Interner) { 441 ty.fold(&mut |ty| match ty.kind(&Interner) {
442 TyKind::Alias(AliasTy::Projection(proj_ty)) => { 442 TyKind::Alias(AliasTy::Projection(proj_ty)) => {
443 self.normalize_projection_ty(proj_ty.clone()) 443 self.normalize_projection_ty(proj_ty.clone())
444 } 444 }
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> {
36 ty1.clone() 36 ty1.clone()
37 } else { 37 } else {
38 if let (TyKind::FnDef(..), TyKind::FnDef(..)) = 38 if let (TyKind::FnDef(..), TyKind::FnDef(..)) =
39 (ty1.interned(&Interner), ty2.interned(&Interner)) 39 (ty1.kind(&Interner), ty2.kind(&Interner))
40 { 40 {
41 cov_mark::hit!(coerce_fn_reification); 41 cov_mark::hit!(coerce_fn_reification);
42 // Special case: two function types. Try to coerce both to 42 // Special case: two function types. Try to coerce both to
@@ -55,7 +55,7 @@ impl<'a> InferenceContext<'a> {
55 } 55 }
56 56
57 fn coerce_inner(&mut self, mut from_ty: Ty, to_ty: &Ty) -> bool { 57 fn coerce_inner(&mut self, mut from_ty: Ty, to_ty: &Ty) -> bool {
58 match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { 58 match (from_ty.kind(&Interner), to_ty.kind(&Interner)) {
59 // Never type will make type variable to fallback to Never Type instead of Unknown. 59 // Never type will make type variable to fallback to Never Type instead of Unknown.
60 (TyKind::Never, TyKind::InferenceVar(tv, TyVariableKind::General)) => { 60 (TyKind::Never, TyKind::InferenceVar(tv, TyVariableKind::General)) => {
61 self.table.type_variable_table.set_diverging(*tv, true); 61 self.table.type_variable_table.set_diverging(*tv, true);
@@ -73,7 +73,7 @@ impl<'a> InferenceContext<'a> {
73 } 73 }
74 74
75 // Pointer weakening and function to pointer 75 // Pointer weakening and function to pointer
76 match (from_ty.interned_mut(), to_ty.interned(&Interner)) { 76 match (from_ty.interned_mut(), to_ty.kind(&Interner)) {
77 // `*mut T` -> `*const T` 77 // `*mut T` -> `*const T`
78 // `&mut T` -> `&T` 78 // `&mut T` -> `&T`
79 (TyKind::Raw(m1, ..), TyKind::Raw(m2 @ Mutability::Not, ..)) 79 (TyKind::Raw(m1, ..), TyKind::Raw(m2 @ Mutability::Not, ..))
@@ -111,7 +111,7 @@ impl<'a> InferenceContext<'a> {
111 } 111 }
112 112
113 // Auto Deref if cannot coerce 113 // Auto Deref if cannot coerce
114 match (from_ty.interned(&Interner), to_ty.interned(&Interner)) { 114 match (from_ty.kind(&Interner), to_ty.kind(&Interner)) {
115 // FIXME: DerefMut 115 // FIXME: DerefMut
116 (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2), 116 (TyKind::Ref(_, st1), TyKind::Ref(_, st2)) => self.unify_autoderef_behind_ref(st1, st2),
117 117
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> {
455 }) 455 })
456 .unwrap_or(true) 456 .unwrap_or(true)
457 }; 457 };
458 match canonicalized.decanonicalize_ty(derefed_ty.value).interned(&Interner) { 458 match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) {
459 TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { 459 TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| {
460 substs 460 substs
461 .interned(&Interner) 461 .interned(&Interner)
@@ -577,7 +577,7 @@ impl<'a> InferenceContext<'a> {
577 None => self.err_ty(), 577 None => self.err_ty(),
578 }, 578 },
579 UnaryOp::Neg => { 579 UnaryOp::Neg => {
580 match inner_ty.interned(&Interner) { 580 match inner_ty.kind(&Interner) {
581 // Fast path for builtins 581 // Fast path for builtins
582 TyKind::Scalar(Scalar::Int(_)) 582 TyKind::Scalar(Scalar::Int(_))
583 | TyKind::Scalar(Scalar::Uint(_)) 583 | TyKind::Scalar(Scalar::Uint(_))
@@ -590,7 +590,7 @@ impl<'a> InferenceContext<'a> {
590 } 590 }
591 } 591 }
592 UnaryOp::Not => { 592 UnaryOp::Not => {
593 match inner_ty.interned(&Interner) { 593 match inner_ty.kind(&Interner) {
594 // Fast path for builtins 594 // Fast path for builtins
595 TyKind::Scalar(Scalar::Bool) 595 TyKind::Scalar(Scalar::Bool)
596 | TyKind::Scalar(Scalar::Int(_)) 596 | TyKind::Scalar(Scalar::Int(_))
@@ -696,7 +696,7 @@ impl<'a> InferenceContext<'a> {
696 } 696 }
697 } 697 }
698 Expr::Tuple { exprs } => { 698 Expr::Tuple { exprs } => {
699 let mut tys = match expected.ty.interned(&Interner) { 699 let mut tys = match expected.ty.kind(&Interner) {
700 TyKind::Tuple(_, substs) => substs 700 TyKind::Tuple(_, substs) => substs
701 .iter(&Interner) 701 .iter(&Interner)
702 .map(|a| a.assert_ty_ref(&Interner).clone()) 702 .map(|a| a.assert_ty_ref(&Interner).clone())
@@ -713,7 +713,7 @@ impl<'a> InferenceContext<'a> {
713 TyKind::Tuple(tys.len(), Substitution::from_iter(&Interner, tys)).intern(&Interner) 713 TyKind::Tuple(tys.len(), Substitution::from_iter(&Interner, tys)).intern(&Interner)
714 } 714 }
715 Expr::Array(array) => { 715 Expr::Array(array) => {
716 let elem_ty = match expected.ty.interned(&Interner) { 716 let elem_ty = match expected.ty.kind(&Interner) {
717 TyKind::Array(st) | TyKind::Slice(st) => st.clone(), 717 TyKind::Array(st) | TyKind::Slice(st) => st.clone(),
718 _ => self.table.new_type_var(), 718 _ => self.table.new_type_var(),
719 }; 719 };
@@ -961,7 +961,7 @@ impl<'a> InferenceContext<'a> {
961 } 961 }
962 962
963 fn register_obligations_for_call(&mut self, callable_ty: &Ty) { 963 fn register_obligations_for_call(&mut self, callable_ty: &Ty) {
964 if let TyKind::FnDef(fn_def, parameters) = callable_ty.interned(&Interner) { 964 if let TyKind::FnDef(fn_def, parameters) = callable_ty.kind(&Interner) {
965 let def: CallableDefId = from_chalk(self.db, *fn_def); 965 let def: CallableDefId = from_chalk(self.db, *fn_def);
966 let generic_predicates = self.db.generic_predicates(def.into()); 966 let generic_predicates = self.db.generic_predicates(def.into());
967 for predicate in generic_predicates.iter() { 967 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> {
211 return inner_ty; 211 return inner_ty;
212 } 212 }
213 Pat::Slice { prefix, slice, suffix } => { 213 Pat::Slice { prefix, slice, suffix } => {
214 let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.interned(&Interner) { 214 let (container_ty, elem_ty): (fn(_) -> _, _) = match expected.kind(&Interner) {
215 TyKind::Array(st) => (TyKind::Array, st.clone()), 215 TyKind::Array(st) => (TyKind::Array, st.clone()),
216 TyKind::Slice(st) => (TyKind::Slice, st.clone()), 216 TyKind::Slice(st) => (TyKind::Slice, st.clone()),
217 _ => (TyKind::Slice, self.err_ty()), 217 _ => (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> {
147 remaining_segments_for_ty, 147 remaining_segments_for_ty,
148 true, 148 true,
149 ); 149 );
150 if let TyKind::Unknown = ty.interned(&Interner) { 150 if let TyKind::Unknown = ty.kind(&Interner) {
151 return None; 151 return None;
152 } 152 }
153 153
@@ -212,7 +212,7 @@ impl<'a> InferenceContext<'a> {
212 name: &Name, 212 name: &Name,
213 id: ExprOrPatId, 213 id: ExprOrPatId,
214 ) -> Option<(ValueNs, Option<Substitution>)> { 214 ) -> Option<(ValueNs, Option<Substitution>)> {
215 if let TyKind::Unknown = ty.interned(&Interner) { 215 if let TyKind::Unknown = ty.kind(&Interner) {
216 return None; 216 return None;
217 } 217 }
218 218
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> {
49 49
50 fn do_canonicalize<T: TypeWalk>(&mut self, t: T, binders: DebruijnIndex) -> T { 50 fn do_canonicalize<T: TypeWalk>(&mut self, t: T, binders: DebruijnIndex) -> T {
51 t.fold_binders( 51 t.fold_binders(
52 &mut |ty, binders| match ty.interned(&Interner) { 52 &mut |ty, binders| match ty.kind(&Interner) {
53 &TyKind::InferenceVar(var, kind) => { 53 &TyKind::InferenceVar(var, kind) => {
54 let inner = var.to_inner(); 54 let inner = var.to_inner();
55 if self.var_stack.contains(&inner) { 55 if self.var_stack.contains(&inner) {
@@ -304,7 +304,7 @@ impl InferenceTable {
304 let ty1 = self.resolve_ty_shallow(ty1); 304 let ty1 = self.resolve_ty_shallow(ty1);
305 let ty2 = self.resolve_ty_shallow(ty2); 305 let ty2 = self.resolve_ty_shallow(ty2);
306 if ty1.equals_ctor(&ty2) { 306 if ty1.equals_ctor(&ty2) {
307 match (ty1.interned(&Interner), ty2.interned(&Interner)) { 307 match (ty1.kind(&Interner), ty2.kind(&Interner)) {
308 (TyKind::Adt(_, substs1), TyKind::Adt(_, substs2)) 308 (TyKind::Adt(_, substs1), TyKind::Adt(_, substs2))
309 | (TyKind::FnDef(_, substs1), TyKind::FnDef(_, substs2)) 309 | (TyKind::FnDef(_, substs1), TyKind::FnDef(_, substs2))
310 | ( 310 | (
@@ -329,7 +329,7 @@ impl InferenceTable {
329 } 329 }
330 330
331 pub(super) fn unify_inner_trivial(&mut self, ty1: &Ty, ty2: &Ty, depth: usize) -> bool { 331 pub(super) fn unify_inner_trivial(&mut self, ty1: &Ty, ty2: &Ty, depth: usize) -> bool {
332 match (ty1.interned(&Interner), ty2.interned(&Interner)) { 332 match (ty1.kind(&Interner), ty2.kind(&Interner)) {
333 (TyKind::Unknown, _) | (_, TyKind::Unknown) => true, 333 (TyKind::Unknown, _) | (_, TyKind::Unknown) => true,
334 334
335 (TyKind::Placeholder(p1), TyKind::Placeholder(p2)) if *p1 == *p2 => true, 335 (TyKind::Placeholder(p1), TyKind::Placeholder(p2)) if *p1 == *p2 => true,
@@ -458,7 +458,7 @@ impl InferenceTable {
458 if i > 0 { 458 if i > 0 {
459 cov_mark::hit!(type_var_resolves_to_int_var); 459 cov_mark::hit!(type_var_resolves_to_int_var);
460 } 460 }
461 match ty.interned(&Interner) { 461 match ty.kind(&Interner) {
462 TyKind::InferenceVar(tv, _) => { 462 TyKind::InferenceVar(tv, _) => {
463 let inner = tv.to_inner(); 463 let inner = tv.to_inner();
464 match self.var_unification_table.inlined_probe_value(inner).known() { 464 match self.var_unification_table.inlined_probe_value(inner).known() {
@@ -481,7 +481,7 @@ impl InferenceTable {
481 /// be resolved as far as possible, i.e. contain no type variables with 481 /// be resolved as far as possible, i.e. contain no type variables with
482 /// known type. 482 /// known type.
483 fn resolve_ty_as_possible_inner(&mut self, tv_stack: &mut Vec<TypeVarId>, ty: Ty) -> Ty { 483 fn resolve_ty_as_possible_inner(&mut self, tv_stack: &mut Vec<TypeVarId>, ty: Ty) -> Ty {
484 ty.fold(&mut |ty| match ty.interned(&Interner) { 484 ty.fold(&mut |ty| match ty.kind(&Interner) {
485 &TyKind::InferenceVar(tv, kind) => { 485 &TyKind::InferenceVar(tv, kind) => {
486 let inner = tv.to_inner(); 486 let inner = tv.to_inner();
487 if tv_stack.contains(&inner) { 487 if tv_stack.contains(&inner) {
@@ -508,7 +508,7 @@ impl InferenceTable {
508 /// Resolves the type completely; type variables without known type are 508 /// Resolves the type completely; type variables without known type are
509 /// replaced by TyKind::Unknown. 509 /// replaced by TyKind::Unknown.
510 fn resolve_ty_completely_inner(&mut self, tv_stack: &mut Vec<TypeVarId>, ty: Ty) -> Ty { 510 fn resolve_ty_completely_inner(&mut self, tv_stack: &mut Vec<TypeVarId>, ty: Ty) -> Ty {
511 ty.fold(&mut |ty| match ty.interned(&Interner) { 511 ty.fold(&mut |ty| match ty.kind(&Interner) {
512 &TyKind::InferenceVar(tv, kind) => { 512 &TyKind::InferenceVar(tv, kind) => {
513 let inner = tv.to_inner(); 513 let inner = tv.to_inner();
514 if tv_stack.contains(&inner) { 514 if tv_stack.contains(&inner) {
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index c927ed973..4c3d904bf 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -312,7 +312,7 @@ impl TyKind {
312} 312}
313 313
314impl Ty { 314impl Ty {
315 pub fn interned(&self, _interner: &Interner) -> &TyKind { 315 pub fn kind(&self, _interner: &Interner) -> &TyKind {
316 &self.0 316 &self.0
317 } 317 }
318 318
@@ -846,14 +846,14 @@ impl Ty {
846 } 846 }
847 847
848 pub fn as_reference(&self) -> Option<(&Ty, Mutability)> { 848 pub fn as_reference(&self) -> Option<(&Ty, Mutability)> {
849 match self.interned(&Interner) { 849 match self.kind(&Interner) {
850 TyKind::Ref(mutability, ty) => Some((ty, *mutability)), 850 TyKind::Ref(mutability, ty) => Some((ty, *mutability)),
851 _ => None, 851 _ => None,
852 } 852 }
853 } 853 }
854 854
855 pub fn as_reference_or_ptr(&self) -> Option<(&Ty, Rawness, Mutability)> { 855 pub fn as_reference_or_ptr(&self) -> Option<(&Ty, Rawness, Mutability)> {
856 match self.interned(&Interner) { 856 match self.kind(&Interner) {
857 TyKind::Ref(mutability, ty) => Some((ty, Rawness::Ref, *mutability)), 857 TyKind::Ref(mutability, ty) => Some((ty, Rawness::Ref, *mutability)),
858 TyKind::Raw(mutability, ty) => Some((ty, Rawness::RawPtr, *mutability)), 858 TyKind::Raw(mutability, ty) => Some((ty, Rawness::RawPtr, *mutability)),
859 _ => None, 859 _ => None,
@@ -863,7 +863,7 @@ impl Ty {
863 pub fn strip_references(&self) -> &Ty { 863 pub fn strip_references(&self) -> &Ty {
864 let mut t: &Ty = self; 864 let mut t: &Ty = self;
865 865
866 while let TyKind::Ref(_mutability, ty) = t.interned(&Interner) { 866 while let TyKind::Ref(_mutability, ty) = t.kind(&Interner) {
867 t = ty; 867 t = ty;
868 } 868 }
869 869
@@ -871,21 +871,21 @@ impl Ty {
871 } 871 }
872 872
873 pub fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)> { 873 pub fn as_adt(&self) -> Option<(hir_def::AdtId, &Substitution)> {
874 match self.interned(&Interner) { 874 match self.kind(&Interner) {
875 TyKind::Adt(AdtId(adt), parameters) => Some((*adt, parameters)), 875 TyKind::Adt(AdtId(adt), parameters) => Some((*adt, parameters)),
876 _ => None, 876 _ => None,
877 } 877 }
878 } 878 }
879 879
880 pub fn as_tuple(&self) -> Option<&Substitution> { 880 pub fn as_tuple(&self) -> Option<&Substitution> {
881 match self.interned(&Interner) { 881 match self.kind(&Interner) {
882 TyKind::Tuple(_, substs) => Some(substs), 882 TyKind::Tuple(_, substs) => Some(substs),
883 _ => None, 883 _ => None,
884 } 884 }
885 } 885 }
886 886
887 pub fn as_generic_def(&self, db: &dyn HirDatabase) -> Option<GenericDefId> { 887 pub fn as_generic_def(&self, db: &dyn HirDatabase) -> Option<GenericDefId> {
888 match *self.interned(&Interner) { 888 match *self.kind(&Interner) {
889 TyKind::Adt(AdtId(adt), ..) => Some(adt.into()), 889 TyKind::Adt(AdtId(adt), ..) => Some(adt.into()),
890 TyKind::FnDef(callable, ..) => { 890 TyKind::FnDef(callable, ..) => {
891 Some(db.lookup_intern_callable_def(callable.into()).into()) 891 Some(db.lookup_intern_callable_def(callable.into()).into())
@@ -897,15 +897,15 @@ impl Ty {
897 } 897 }
898 898
899 pub fn is_never(&self) -> bool { 899 pub fn is_never(&self) -> bool {
900 matches!(self.interned(&Interner), TyKind::Never) 900 matches!(self.kind(&Interner), TyKind::Never)
901 } 901 }
902 902
903 pub fn is_unknown(&self) -> bool { 903 pub fn is_unknown(&self) -> bool {
904 matches!(self.interned(&Interner), TyKind::Unknown) 904 matches!(self.kind(&Interner), TyKind::Unknown)
905 } 905 }
906 906
907 pub fn equals_ctor(&self, other: &Ty) -> bool { 907 pub fn equals_ctor(&self, other: &Ty) -> bool {
908 match (self.interned(&Interner), other.interned(&Interner)) { 908 match (self.kind(&Interner), other.kind(&Interner)) {
909 (TyKind::Adt(adt, ..), TyKind::Adt(adt2, ..)) => adt == adt2, 909 (TyKind::Adt(adt, ..), TyKind::Adt(adt2, ..)) => adt == adt2,
910 (TyKind::Slice(_), TyKind::Slice(_)) | (TyKind::Array(_), TyKind::Array(_)) => true, 910 (TyKind::Slice(_), TyKind::Slice(_)) | (TyKind::Array(_), TyKind::Array(_)) => true,
911 (TyKind::FnDef(def_id, ..), TyKind::FnDef(def_id2, ..)) => def_id == def_id2, 911 (TyKind::FnDef(def_id, ..), TyKind::FnDef(def_id2, ..)) => def_id == def_id2,
@@ -934,7 +934,7 @@ impl Ty {
934 934
935 /// If this is a `dyn Trait` type, this returns the `Trait` part. 935 /// If this is a `dyn Trait` type, this returns the `Trait` part.
936 fn dyn_trait_ref(&self) -> Option<&TraitRef> { 936 fn dyn_trait_ref(&self) -> Option<&TraitRef> {
937 match self.interned(&Interner) { 937 match self.kind(&Interner) {
938 TyKind::Dyn(dyn_ty) => { 938 TyKind::Dyn(dyn_ty) => {
939 dyn_ty.bounds.value.interned().get(0).and_then(|b| match b.skip_binders() { 939 dyn_ty.bounds.value.interned().get(0).and_then(|b| match b.skip_binders() {
940 WhereClause::Implemented(trait_ref) => Some(trait_ref), 940 WhereClause::Implemented(trait_ref) => Some(trait_ref),
@@ -951,7 +951,7 @@ impl Ty {
951 } 951 }
952 952
953 fn builtin_deref(&self) -> Option<Ty> { 953 fn builtin_deref(&self) -> Option<Ty> {
954 match self.interned(&Interner) { 954 match self.kind(&Interner) {
955 TyKind::Ref(.., ty) => Some(ty.clone()), 955 TyKind::Ref(.., ty) => Some(ty.clone()),
956 TyKind::Raw(.., ty) => Some(ty.clone()), 956 TyKind::Raw(.., ty) => Some(ty.clone()),
957 _ => None, 957 _ => None,
@@ -959,7 +959,7 @@ impl Ty {
959 } 959 }
960 960
961 pub fn callable_def(&self, db: &dyn HirDatabase) -> Option<CallableDefId> { 961 pub fn callable_def(&self, db: &dyn HirDatabase) -> Option<CallableDefId> {
962 match self.interned(&Interner) { 962 match self.kind(&Interner) {
963 &TyKind::FnDef(def, ..) => Some(db.lookup_intern_callable_def(def.into())), 963 &TyKind::FnDef(def, ..) => Some(db.lookup_intern_callable_def(def.into())),
964 _ => None, 964 _ => None,
965 } 965 }
@@ -974,7 +974,7 @@ impl Ty {
974 } 974 }
975 975
976 pub fn callable_sig(&self, db: &dyn HirDatabase) -> Option<CallableSig> { 976 pub fn callable_sig(&self, db: &dyn HirDatabase) -> Option<CallableSig> {
977 match self.interned(&Interner) { 977 match self.kind(&Interner) {
978 TyKind::Function(fn_ptr) => Some(CallableSig::from_fn_ptr(fn_ptr)), 978 TyKind::Function(fn_ptr) => Some(CallableSig::from_fn_ptr(fn_ptr)),
979 TyKind::FnDef(def, parameters) => { 979 TyKind::FnDef(def, parameters) => {
980 let callable_def = db.lookup_intern_callable_def((*def).into()); 980 let callable_def = db.lookup_intern_callable_def((*def).into());
@@ -992,7 +992,7 @@ impl Ty {
992 /// Returns the type parameters of this type if it has some (i.e. is an ADT 992 /// Returns the type parameters of this type if it has some (i.e. is an ADT
993 /// or function); so if `self` is `Option<u32>`, this returns the `u32`. 993 /// or function); so if `self` is `Option<u32>`, this returns the `u32`.
994 pub fn substs(&self) -> Option<&Substitution> { 994 pub fn substs(&self) -> Option<&Substitution> {
995 match self.interned(&Interner) { 995 match self.kind(&Interner) {
996 TyKind::Adt(_, substs) 996 TyKind::Adt(_, substs)
997 | TyKind::FnDef(_, substs) 997 | TyKind::FnDef(_, substs)
998 | TyKind::Function(FnPointer { substs, .. }) 998 | TyKind::Function(FnPointer { substs, .. })
@@ -1018,7 +1018,7 @@ impl Ty {
1018 } 1018 }
1019 1019
1020 pub fn impl_trait_bounds(&self, db: &dyn HirDatabase) -> Option<Vec<QuantifiedWhereClause>> { 1020 pub fn impl_trait_bounds(&self, db: &dyn HirDatabase) -> Option<Vec<QuantifiedWhereClause>> {
1021 match self.interned(&Interner) { 1021 match self.kind(&Interner) {
1022 TyKind::OpaqueType(opaque_ty_id, ..) => { 1022 TyKind::OpaqueType(opaque_ty_id, ..) => {
1023 match db.lookup_intern_impl_trait_id((*opaque_ty_id).into()) { 1023 match db.lookup_intern_impl_trait_id((*opaque_ty_id).into()) {
1024 ImplTraitId::AsyncBlockTypeImplTrait(def, _expr) => { 1024 ImplTraitId::AsyncBlockTypeImplTrait(def, _expr) => {
@@ -1093,7 +1093,7 @@ impl Ty {
1093 } 1093 }
1094 1094
1095 pub fn associated_type_parent_trait(&self, db: &dyn HirDatabase) -> Option<TraitId> { 1095 pub fn associated_type_parent_trait(&self, db: &dyn HirDatabase) -> Option<TraitId> {
1096 match self.interned(&Interner) { 1096 match self.kind(&Interner) {
1097 TyKind::AssociatedType(id, ..) => { 1097 TyKind::AssociatedType(id, ..) => {
1098 match from_assoc_type_id(*id).lookup(db.upcast()).container { 1098 match from_assoc_type_id(*id).lookup(db.upcast()).container {
1099 AssocContainerId::TraitId(trait_id) => Some(trait_id), 1099 AssocContainerId::TraitId(trait_id) => Some(trait_id),
@@ -1201,7 +1201,7 @@ pub trait TypeWalk {
1201 Self: Sized, 1201 Self: Sized,
1202 { 1202 {
1203 self.fold_binders( 1203 self.fold_binders(
1204 &mut |ty, binders| match ty.interned(&Interner) { 1204 &mut |ty, binders| match ty.kind(&Interner) {
1205 TyKind::BoundVar(bound) if bound.debruijn >= binders => { 1205 TyKind::BoundVar(bound) if bound.debruijn >= binders => {
1206 TyKind::BoundVar(bound.shifted_in_from(n)).intern(&Interner) 1206 TyKind::BoundVar(bound.shifted_in_from(n)).intern(&Interner)
1207 } 1207 }
@@ -1217,7 +1217,7 @@ pub trait TypeWalk {
1217 Self: Sized + std::fmt::Debug, 1217 Self: Sized + std::fmt::Debug,
1218 { 1218 {
1219 self.fold_binders( 1219 self.fold_binders(
1220 &mut |ty, binders| match ty.interned(&Interner) { 1220 &mut |ty, binders| match ty.kind(&Interner) {
1221 TyKind::BoundVar(bound) if bound.debruijn >= binders => { 1221 TyKind::BoundVar(bound) if bound.debruijn >= binders => {
1222 TyKind::BoundVar(bound.shifted_out_to(n).unwrap_or(bound.clone())) 1222 TyKind::BoundVar(bound.shifted_out_to(n).unwrap_or(bound.clone()))
1223 .intern(&Interner) 1223 .intern(&Interner)
@@ -1231,7 +1231,7 @@ pub trait TypeWalk {
1231 1231
1232impl TypeWalk for Ty { 1232impl TypeWalk for Ty {
1233 fn walk(&self, f: &mut impl FnMut(&Ty)) { 1233 fn walk(&self, f: &mut impl FnMut(&Ty)) {
1234 match self.interned(&Interner) { 1234 match self.kind(&Interner) {
1235 TyKind::Alias(AliasTy::Projection(p_ty)) => { 1235 TyKind::Alias(AliasTy::Projection(p_ty)) => {
1236 for t in p_ty.substitution.iter(&Interner) { 1236 for t in p_ty.substitution.iter(&Interner) {
1237 t.walk(f); 1237 t.walk(f);
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(
741fn fallback_bound_vars(s: Substitution, num_vars_to_keep: usize) -> Substitution { 741fn 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 })
diff --git a/crates/hir_ty/src/op.rs b/crates/hir_ty/src/op.rs
index 527c5cbbd..8533e1ed8 100644
--- a/crates/hir_ty/src/op.rs
+++ b/crates/hir_ty/src/op.rs
@@ -9,7 +9,7 @@ pub(super) fn binary_op_return_ty(op: BinaryOp, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => TyKind::Scalar(Scalar::Bool).intern(&Interner), 9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => TyKind::Scalar(Scalar::Bool).intern(&Interner),
10 BinaryOp::Assignment { .. } => Ty::unit(), 10 BinaryOp::Assignment { .. } => Ty::unit(),
11 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => { 11 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => {
12 match lhs_ty.interned(&Interner) { 12 match lhs_ty.kind(&Interner) {
13 TyKind::Scalar(Scalar::Int(_)) 13 TyKind::Scalar(Scalar::Int(_))
14 | TyKind::Scalar(Scalar::Uint(_)) 14 | TyKind::Scalar(Scalar::Uint(_))
15 | TyKind::Scalar(Scalar::Float(_)) => lhs_ty, 15 | TyKind::Scalar(Scalar::Float(_)) => lhs_ty,
@@ -18,7 +18,7 @@ pub(super) fn binary_op_return_ty(op: BinaryOp, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
18 _ => TyKind::Unknown.intern(&Interner), 18 _ => TyKind::Unknown.intern(&Interner),
19 } 19 }
20 } 20 }
21 BinaryOp::ArithOp(_) => match rhs_ty.interned(&Interner) { 21 BinaryOp::ArithOp(_) => match rhs_ty.kind(&Interner) {
22 TyKind::Scalar(Scalar::Int(_)) 22 TyKind::Scalar(Scalar::Int(_))
23 | TyKind::Scalar(Scalar::Uint(_)) 23 | TyKind::Scalar(Scalar::Uint(_))
24 | TyKind::Scalar(Scalar::Float(_)) => rhs_ty, 24 | TyKind::Scalar(Scalar::Float(_)) => rhs_ty,
@@ -33,7 +33,7 @@ pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty {
33 match op { 33 match op {
34 BinaryOp::LogicOp(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner), 34 BinaryOp::LogicOp(..) => TyKind::Scalar(Scalar::Bool).intern(&Interner),
35 BinaryOp::Assignment { op: None } => lhs_ty, 35 BinaryOp::Assignment { op: None } => lhs_ty,
36 BinaryOp::CmpOp(CmpOp::Eq { .. }) => match lhs_ty.interned(&Interner) { 36 BinaryOp::CmpOp(CmpOp::Eq { .. }) => match lhs_ty.kind(&Interner) {
37 TyKind::Scalar(_) | TyKind::Str => lhs_ty, 37 TyKind::Scalar(_) | TyKind::Str => lhs_ty,
38 TyKind::InferenceVar(_, TyVariableKind::Integer) 38 TyKind::InferenceVar(_, TyVariableKind::Integer)
39 | TyKind::InferenceVar(_, TyVariableKind::Float) => lhs_ty, 39 | TyKind::InferenceVar(_, TyVariableKind::Float) => lhs_ty,
@@ -44,7 +44,7 @@ pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty {
44 } 44 }
45 BinaryOp::CmpOp(CmpOp::Ord { .. }) 45 BinaryOp::CmpOp(CmpOp::Ord { .. })
46 | BinaryOp::Assignment { op: Some(_) } 46 | BinaryOp::Assignment { op: Some(_) }
47 | BinaryOp::ArithOp(_) => match lhs_ty.interned(&Interner) { 47 | BinaryOp::ArithOp(_) => match lhs_ty.kind(&Interner) {
48 TyKind::Scalar(Scalar::Int(_)) 48 TyKind::Scalar(Scalar::Int(_))
49 | TyKind::Scalar(Scalar::Uint(_)) 49 | TyKind::Scalar(Scalar::Uint(_))
50 | TyKind::Scalar(Scalar::Float(_)) => lhs_ty, 50 | TyKind::Scalar(Scalar::Float(_)) => lhs_ty,
diff --git a/crates/hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs
index a15b6486e..e5e8cff33 100644
--- a/crates/hir_ty/src/traits.rs
+++ b/crates/hir_ty/src/traits.rs
@@ -138,7 +138,7 @@ pub(crate) fn trait_solve_query(
138 .. 138 ..
139 })) = &goal.value.goal 139 })) = &goal.value.goal
140 { 140 {
141 if let TyKind::BoundVar(_) = projection_ty.self_type_parameter().interned(&Interner) { 141 if let TyKind::BoundVar(_) = projection_ty.self_type_parameter().kind(&Interner) {
142 // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible 142 // Hack: don't ask Chalk to normalize with an unknown self type, it'll say that's impossible
143 return Some(Solution::Ambig(Guidance::Unknown)); 143 return Some(Solution::Ambig(Guidance::Unknown));
144 } 144 }
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
index cf7ed1e11..fbac51b05 100644
--- a/crates/hir_ty/src/traits/chalk.rs
+++ b/crates/hir_ty/src/traits/chalk.rs
@@ -92,7 +92,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
92 ty: &Ty, 92 ty: &Ty,
93 binders: &CanonicalVarKinds<Interner>, 93 binders: &CanonicalVarKinds<Interner>,
94 ) -> Option<chalk_ir::TyVariableKind> { 94 ) -> Option<chalk_ir::TyVariableKind> {
95 if let TyKind::BoundVar(bv) = ty.interned(&Interner) { 95 if let TyKind::BoundVar(bv) = ty.kind(&Interner) {
96 let binders = binders.as_slice(&Interner); 96 let binders = binders.as_slice(&Interner);
97 if bv.debruijn == DebruijnIndex::INNERMOST { 97 if bv.debruijn == DebruijnIndex::INNERMOST {
98 if let chalk_ir::VariableKind::Ty(tk) = binders[bv.index].kind { 98 if let chalk_ir::VariableKind::Ty(tk) = binders[bv.index].kind {