aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 117d69f01..3d134453f 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -120,7 +120,7 @@ pub enum Ty {
120 Scalar(Scalar), 120 Scalar(Scalar),
121 121
122 /// A tuple type. For example, `(i32, bool)`. 122 /// A tuple type. For example, `(i32, bool)`.
123 Tuple { cardinality: u16, substs: Substs }, 123 Tuple(usize, Substs),
124 124
125 /// An array with the given length. Written as `[T; n]`. 125 /// An array with the given length. Written as `[T; n]`.
126 Array(Substs), 126 Array(Substs),
@@ -582,7 +582,7 @@ impl TypeWalk for FnSig {
582 582
583impl Ty { 583impl Ty {
584 pub fn unit() -> Self { 584 pub fn unit() -> Self {
585 Ty::Tuple { cardinality: 0, substs: Substs::empty() } 585 Ty::Tuple(0, Substs::empty())
586 } 586 }
587 587
588 pub fn fn_ptr(sig: FnSig) -> Self { 588 pub fn fn_ptr(sig: FnSig) -> Self {
@@ -642,7 +642,7 @@ impl Ty {
642 642
643 pub fn as_tuple(&self) -> Option<&Substs> { 643 pub fn as_tuple(&self) -> Option<&Substs> {
644 match self { 644 match self {
645 Ty::Tuple { substs: parameters, .. } => Some(parameters), 645 Ty::Tuple(_, substs) => Some(substs),
646 _ => None, 646 _ => None,
647 } 647 }
648 } 648 }
@@ -684,9 +684,7 @@ impl Ty {
684 Ty::FnPtr { num_args, is_varargs, .. }, 684 Ty::FnPtr { num_args, is_varargs, .. },
685 Ty::FnPtr { num_args: num_args2, is_varargs: is_varargs2, .. }, 685 Ty::FnPtr { num_args: num_args2, is_varargs: is_varargs2, .. },
686 ) => num_args == num_args2 && is_varargs == is_varargs2, 686 ) => num_args == num_args2 && is_varargs == is_varargs2,
687 (Ty::Tuple { cardinality, .. }, Ty::Tuple { cardinality: cardinality2, .. }) => { 687 (Ty::Tuple(cardinality, _), Ty::Tuple(cardinality2, _)) => cardinality == cardinality2,
688 cardinality == cardinality2
689 }
690 (Ty::Str, Ty::Str) | (Ty::Never, Ty::Never) => true, 688 (Ty::Str, Ty::Str) | (Ty::Never, Ty::Never) => true,
691 (Ty::Scalar(scalar), Ty::Scalar(scalar2)) => scalar == scalar2, 689 (Ty::Scalar(scalar), Ty::Scalar(scalar2)) => scalar == scalar2,
692 _ => false, 690 _ => false,
@@ -754,7 +752,7 @@ impl Ty {
754 | Ty::Ref(_, substs) 752 | Ty::Ref(_, substs)
755 | Ty::FnDef(_, substs) 753 | Ty::FnDef(_, substs)
756 | Ty::FnPtr { substs, .. } 754 | Ty::FnPtr { substs, .. }
757 | Ty::Tuple { substs, .. } 755 | Ty::Tuple(_, substs)
758 | Ty::OpaqueType(_, substs) 756 | Ty::OpaqueType(_, substs)
759 | Ty::AssociatedType(_, substs) 757 | Ty::AssociatedType(_, substs)
760 | Ty::ForeignType(_, substs) 758 | Ty::ForeignType(_, substs)
@@ -778,7 +776,7 @@ impl Ty {
778 | Ty::Ref(_, substs) 776 | Ty::Ref(_, substs)
779 | Ty::FnDef(_, substs) 777 | Ty::FnDef(_, substs)
780 | Ty::FnPtr { substs, .. } 778 | Ty::FnPtr { substs, .. }
781 | Ty::Tuple { substs, .. } 779 | Ty::Tuple(_, substs)
782 | Ty::OpaqueType(_, substs) 780 | Ty::OpaqueType(_, substs)
783 | Ty::AssociatedType(_, substs) 781 | Ty::AssociatedType(_, substs)
784 | Ty::ForeignType(_, substs) 782 | Ty::ForeignType(_, substs)
@@ -796,7 +794,7 @@ impl Ty {
796 | Ty::Ref(_, substs) 794 | Ty::Ref(_, substs)
797 | Ty::FnDef(_, substs) 795 | Ty::FnDef(_, substs)
798 | Ty::FnPtr { substs, .. } 796 | Ty::FnPtr { substs, .. }
799 | Ty::Tuple { substs, .. } 797 | Ty::Tuple(_, substs)
800 | Ty::OpaqueType(_, substs) 798 | Ty::OpaqueType(_, substs)
801 | Ty::AssociatedType(_, substs) 799 | Ty::AssociatedType(_, substs)
802 | Ty::ForeignType(_, substs) 800 | Ty::ForeignType(_, substs)