about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhkalbasi <hamidrezakalbasi@protonmail.com>2023-07-17 20:56:31 +0330
committerhkalbasi <hamidrezakalbasi@protonmail.com>2023-07-17 20:56:31 +0330
commite64a10fc4dd5cdd87aa29bb021de6abe33449df7 (patch)
treefd532acef56563888209afd797aa5f66737c3eae
parent832eb0d94c54e9d983e4f2df2ce9b78e6edd30f6 (diff)
downloadrust-e64a10fc4dd5cdd87aa29bb021de6abe33449df7.tar.gz
rust-e64a10fc4dd5cdd87aa29bb021de6abe33449df7.zip
Use `.kind(Interner)` instead of `.data(Interner).kind`
-rw-r--r--crates/hir-ty/src/mir.rs12
-rw-r--r--crates/hir-ty/src/mir/eval.rs16
-rw-r--r--crates/hir-ty/src/mir/lower.rs6
3 files changed, 17 insertions, 17 deletions
diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs
index da5b496e141..922e49d281d 100644
--- a/crates/hir-ty/src/mir.rs
+++ b/crates/hir-ty/src/mir.rs
@@ -142,7 +142,7 @@ impl<V, T> ProjectionElem<V, T> {
         closure_field: impl FnOnce(ClosureId, &Substitution, usize) -> Ty,
         krate: CrateId,
     ) -> Ty {
-        if matches!(base.data(Interner).kind, TyKind::Alias(_) | TyKind::AssociatedType(..)) {
+        if matches!(base.kind(Interner), TyKind::Alias(_) | TyKind::AssociatedType(..)) {
             base = normalize(
                 db,
                 // FIXME: we should get this from caller
@@ -151,7 +151,7 @@ impl<V, T> ProjectionElem<V, T> {
             );
         }
         match self {
-            ProjectionElem::Deref => match &base.data(Interner).kind {
+            ProjectionElem::Deref => match &base.kind(Interner) {
                 TyKind::Raw(_, inner) | TyKind::Ref(_, _, inner) => inner.clone(),
                 TyKind::Adt(adt, subst) if is_box(db, adt.0) => {
                     subst.at(Interner, 0).assert_ty_ref(Interner).clone()
@@ -161,7 +161,7 @@ impl<V, T> ProjectionElem<V, T> {
                     return TyKind::Error.intern(Interner);
                 }
             },
-            ProjectionElem::Field(f) => match &base.data(Interner).kind {
+            ProjectionElem::Field(f) => match &base.kind(Interner) {
                 TyKind::Adt(_, subst) => {
                     db.field_types(f.parent)[f.local_id].clone().substitute(Interner, subst)
                 }
@@ -170,7 +170,7 @@ impl<V, T> ProjectionElem<V, T> {
                     return TyKind::Error.intern(Interner);
                 }
             },
-            ProjectionElem::TupleOrClosureField(f) => match &base.data(Interner).kind {
+            ProjectionElem::TupleOrClosureField(f) => match &base.kind(Interner) {
                 TyKind::Tuple(_, subst) => subst
                     .as_slice(Interner)
                     .get(*f)
@@ -187,7 +187,7 @@ impl<V, T> ProjectionElem<V, T> {
                 }
             },
             ProjectionElem::ConstantIndex { .. } | ProjectionElem::Index(_) => {
-                match &base.data(Interner).kind {
+                match &base.kind(Interner) {
                     TyKind::Array(inner, _) | TyKind::Slice(inner) => inner.clone(),
                     _ => {
                         never!("Overloaded index is not a projection");
@@ -195,7 +195,7 @@ impl<V, T> ProjectionElem<V, T> {
                     }
                 }
             }
-            &ProjectionElem::Subslice { from, to } => match &base.data(Interner).kind {
+            &ProjectionElem::Subslice { from, to } => match &base.kind(Interner) {
                 TyKind::Array(inner, c) => {
                     let next_c = usize_const(
                         db,
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index d7820de629a..16843b10d23 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -634,7 +634,7 @@ impl Evaluator<'_> {
                     addr = addr.offset(ty_size * offset);
                 }
                 &ProjectionElem::Subslice { from, to } => {
-                    let inner_ty = match &ty.data(Interner).kind {
+                    let inner_ty = match &ty.kind(Interner) {
                         TyKind::Array(inner, _) | TyKind::Slice(inner) => inner.clone(),
                         _ => TyKind::Error.intern(Interner),
                     };
@@ -793,7 +793,7 @@ impl Evaluator<'_> {
                                 .iter()
                                 .map(|it| self.operand_ty_and_eval(it, &mut locals))
                                 .collect::<Result<Vec<_>>>()?;
-                            let stack_frame = match &fn_ty.data(Interner).kind {
+                            let stack_frame = match &fn_ty.kind(Interner) {
                                 TyKind::Function(_) => {
                                     let bytes = self.eval_operand(func, &mut locals)?;
                                     self.exec_fn_pointer(
@@ -1255,7 +1255,7 @@ impl Evaluator<'_> {
                     PointerCast::ReifyFnPointer | PointerCast::ClosureFnPointer(_) => {
                         let current_ty = self.operand_ty(operand, locals)?;
                         if let TyKind::FnDef(_, _) | TyKind::Closure(_, _) =
-                            &current_ty.data(Interner).kind
+                            &current_ty.kind(Interner)
                         {
                             let id = self.vtable_map.id(current_ty);
                             let ptr_size = self.ptr_size();
@@ -1408,8 +1408,8 @@ impl Evaluator<'_> {
         addr: Interval,
     ) -> Result<IntervalOrOwned> {
         use IntervalOrOwned::*;
-        Ok(match &target_ty.data(Interner).kind {
-            TyKind::Slice(_) => match &current_ty.data(Interner).kind {
+        Ok(match &target_ty.kind(Interner) {
+            TyKind::Slice(_) => match &current_ty.kind(Interner) {
                 TyKind::Array(_, size) => {
                     let len = match try_const_usize(self.db, size) {
                         None => {
@@ -1435,7 +1435,7 @@ impl Evaluator<'_> {
                 r.extend(vtable.to_le_bytes().into_iter());
                 Owned(r)
             }
-            TyKind::Adt(id, target_subst) => match &current_ty.data(Interner).kind {
+            TyKind::Adt(id, target_subst) => match &current_ty.kind(Interner) {
                 TyKind::Adt(current_id, current_subst) => {
                     if id != current_id {
                         not_supported!("unsizing struct with different type");
@@ -1931,7 +1931,7 @@ impl Evaluator<'_> {
     ) -> Result<Option<StackFrame>> {
         let id = from_bytes!(usize, bytes.get(self)?);
         let next_ty = self.vtable_map.ty(id)?.clone();
-        match &next_ty.data(Interner).kind {
+        match &next_ty.kind(Interner) {
             TyKind::FnDef(def, generic_args) => {
                 self.exec_fn_def(*def, generic_args, destination, args, &locals, target_bb, span)
             }
@@ -2182,7 +2182,7 @@ impl Evaluator<'_> {
             let size = self.size_of_sized(&func_ty, locals, "self type of fn trait")?;
             func_data = Interval { addr: Address::from_bytes(func_data.get(self)?)?, size };
         }
-        match &func_ty.data(Interner).kind {
+        match &func_ty.kind(Interner) {
             TyKind::FnDef(def, subst) => {
                 return self.exec_fn_def(
                     *def,
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 36108587904..724b9ecb600 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -633,7 +633,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
                     );
                 }
                 let callee_ty = self.expr_ty_after_adjustments(*callee);
-                match &callee_ty.data(Interner).kind {
+                match &callee_ty.kind(Interner) {
                     chalk_ir::TyKind::FnDef(..) => {
                         let func = Operand::from_bytes(vec![], callee_ty.clone());
                         self.lower_call_and_args(
@@ -1229,7 +1229,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
             }
             Expr::Array(l) => match l {
                 Array::ElementList { elements, .. } => {
-                    let elem_ty = match &self.expr_ty_without_adjust(expr_id).data(Interner).kind {
+                    let elem_ty = match &self.expr_ty_without_adjust(expr_id).kind(Interner) {
                         TyKind::Array(ty, _) => ty.clone(),
                         _ => {
                             return Err(MirLowerError::TypeError(
@@ -1260,7 +1260,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
                     else {
                         return Ok(None);
                     };
-                    let len = match &self.expr_ty_without_adjust(expr_id).data(Interner).kind {
+                    let len = match &self.expr_ty_without_adjust(expr_id).kind(Interner) {
                         TyKind::Array(_, len) => len.clone(),
                         _ => {
                             return Err(MirLowerError::TypeError(