diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-28 19:56:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-28 19:56:16 +0000 |
commit | 23d7dbfa5e7ba2cebf8c3f79b5d31285d79c1527 (patch) | |
tree | c99eee1f422e009f039bc5c1fd68120bc217d417 /crates | |
parent | 2fc137b70f9d455676cc99a1a5c7e6e10c3e7cc2 (diff) | |
parent | a3fd2faba5b0736fd51c7b94cae55e0a9609cdb0 (diff) |
Merge #7814
7814: Turn Ty::Tuple variant into a tuple-variant r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/src/code_model.rs | 4 | ||||
-rw-r--r-- | crates/hir_ty/src/display.rs | 9 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 8 | ||||
-rw-r--r-- | crates/hir_ty/src/infer/pat.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/lib.rs | 21 | ||||
-rw-r--r-- | crates/hir_ty/src/lower.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 13 |
8 files changed, 29 insertions, 40 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index cdb54eca2..1c31e29ac 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -1547,7 +1547,7 @@ impl Type { | |||
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | pub fn is_unit(&self) -> bool { | 1549 | pub fn is_unit(&self) -> bool { |
1550 | matches!(self.ty.value, Ty::Tuple { cardinality: 0, .. }) | 1550 | matches!(self.ty.value, Ty::Tuple(0, ..)) |
1551 | } | 1551 | } |
1552 | pub fn is_bool(&self) -> bool { | 1552 | pub fn is_bool(&self) -> bool { |
1553 | matches!(self.ty.value, Ty::Scalar(Scalar::Bool)) | 1553 | matches!(self.ty.value, Ty::Scalar(Scalar::Bool)) |
@@ -1741,7 +1741,7 @@ impl Type { | |||
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | pub fn tuple_fields(&self, _db: &dyn HirDatabase) -> Vec<Type> { | 1743 | pub fn tuple_fields(&self, _db: &dyn HirDatabase) -> Vec<Type> { |
1744 | if let Ty::Tuple { substs, .. } = &self.ty.value { | 1744 | if let Ty::Tuple(_, substs) = &self.ty.value { |
1745 | substs.iter().map(|ty| self.derived(ty.clone())).collect() | 1745 | substs.iter().map(|ty| self.derived(ty.clone())).collect() |
1746 | } else { | 1746 | } else { |
1747 | Vec::new() | 1747 | Vec::new() |
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index cd9dcf6c0..4a25a49e3 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs | |||
@@ -330,7 +330,7 @@ impl HirDisplay for Ty { | |||
330 | write!(f, "{}", ty_display)?; | 330 | write!(f, "{}", ty_display)?; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | Ty::Tuple { substs, .. } => { | 333 | Ty::Tuple(_, substs) => { |
334 | if substs.len() == 1 { | 334 | if substs.len() == 1 { |
335 | write!(f, "(")?; | 335 | write!(f, "(")?; |
336 | substs[0].hir_fmt(f)?; | 336 | substs[0].hir_fmt(f)?; |
@@ -471,14 +471,9 @@ impl HirDisplay for Ty { | |||
471 | projection_ty.hir_fmt(f)?; | 471 | projection_ty.hir_fmt(f)?; |
472 | } | 472 | } |
473 | } | 473 | } |
474 | Ty::ForeignType(type_alias, parameters) => { | 474 | Ty::ForeignType(type_alias) => { |
475 | let type_alias = f.db.type_alias_data(*type_alias); | 475 | let type_alias = f.db.type_alias_data(*type_alias); |
476 | write!(f, "{}", type_alias.name)?; | 476 | write!(f, "{}", type_alias.name)?; |
477 | if parameters.len() > 0 { | ||
478 | write!(f, "<")?; | ||
479 | f.write_joined(&*parameters.0, ", ")?; | ||
480 | write!(f, ">")?; | ||
481 | } | ||
482 | } | 477 | } |
483 | Ty::OpaqueType(opaque_ty_id, parameters) => { | 478 | Ty::OpaqueType(opaque_ty_id, parameters) => { |
484 | match opaque_ty_id { | 479 | match opaque_ty_id { |
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 2369c9bef..13240f790 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -82,7 +82,7 @@ impl<'a> InferenceContext<'a> { | |||
82 | arg_tys.push(arg); | 82 | arg_tys.push(arg); |
83 | } | 83 | } |
84 | let parameters = param_builder.build(); | 84 | let parameters = param_builder.build(); |
85 | let arg_ty = Ty::Tuple { cardinality: num_args as u16, substs: parameters }; | 85 | let arg_ty = Ty::Tuple(num_args, parameters); |
86 | let substs = | 86 | let substs = |
87 | Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build(); | 87 | Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build(); |
88 | 88 | ||
@@ -424,7 +424,7 @@ impl<'a> InferenceContext<'a> { | |||
424 | }, | 424 | }, |
425 | ) | 425 | ) |
426 | .find_map(|derefed_ty| match canonicalized.decanonicalize_ty(derefed_ty.value) { | 426 | .find_map(|derefed_ty| match canonicalized.decanonicalize_ty(derefed_ty.value) { |
427 | Ty::Tuple { substs, .. } => { | 427 | Ty::Tuple(_, substs) => { |
428 | name.as_tuple_index().and_then(|idx| substs.0.get(idx).cloned()) | 428 | name.as_tuple_index().and_then(|idx| substs.0.get(idx).cloned()) |
429 | } | 429 | } |
430 | Ty::Adt(AdtId::StructId(s), parameters) => { | 430 | Ty::Adt(AdtId::StructId(s), parameters) => { |
@@ -635,7 +635,7 @@ impl<'a> InferenceContext<'a> { | |||
635 | } | 635 | } |
636 | Expr::Tuple { exprs } => { | 636 | Expr::Tuple { exprs } => { |
637 | let mut tys = match &expected.ty { | 637 | let mut tys = match &expected.ty { |
638 | Ty::Tuple { substs, .. } => substs | 638 | Ty::Tuple(_, substs) => substs |
639 | .iter() | 639 | .iter() |
640 | .cloned() | 640 | .cloned() |
641 | .chain(repeat_with(|| self.table.new_type_var())) | 641 | .chain(repeat_with(|| self.table.new_type_var())) |
@@ -648,7 +648,7 @@ impl<'a> InferenceContext<'a> { | |||
648 | self.infer_expr_coerce(*expr, &Expectation::has_type(ty.clone())); | 648 | self.infer_expr_coerce(*expr, &Expectation::has_type(ty.clone())); |
649 | } | 649 | } |
650 | 650 | ||
651 | Ty::Tuple { cardinality: tys.len() as u16, substs: Substs(tys.into()) } | 651 | Ty::Tuple(tys.len(), Substs(tys.into())) |
652 | } | 652 | } |
653 | Expr::Array(array) => { | 653 | Expr::Array(array) => { |
654 | let elem_ty = match &expected.ty { | 654 | let elem_ty = match &expected.ty { |
diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index e96e08c3c..a318e47f3 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs | |||
@@ -138,7 +138,7 @@ impl<'a> InferenceContext<'a> { | |||
138 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); | 138 | inner_tys.extend(expectations_iter.by_ref().take(n_uncovered_patterns).cloned()); |
139 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); | 139 | inner_tys.extend(post.iter().zip(expectations_iter).map(infer_pat)); |
140 | 140 | ||
141 | Ty::Tuple { cardinality: inner_tys.len() as u16, substs: Substs(inner_tys.into()) } | 141 | Ty::Tuple(inner_tys.len(), Substs(inner_tys.into())) |
142 | } | 142 | } |
143 | Pat::Or(ref pats) => { | 143 | Pat::Or(ref pats) => { |
144 | if let Some((first_pat, rest)) = pats.split_first() { | 144 | if let Some((first_pat, rest)) = pats.split_first() { |
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 117d69f01..4c0ebcfe3 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), |
@@ -169,7 +169,7 @@ pub enum Ty { | |||
169 | Closure { def: DefWithBodyId, expr: ExprId, substs: Substs }, | 169 | Closure { def: DefWithBodyId, expr: ExprId, substs: Substs }, |
170 | 170 | ||
171 | /// Represents a foreign type declared in external blocks. | 171 | /// Represents a foreign type declared in external blocks. |
172 | ForeignType(TypeAliasId, Substs), | 172 | ForeignType(TypeAliasId), |
173 | 173 | ||
174 | /// A pointer to a function. Written as `fn() -> i32`. | 174 | /// A pointer to a function. Written as `fn() -> i32`. |
175 | /// | 175 | /// |
@@ -582,7 +582,7 @@ impl TypeWalk for FnSig { | |||
582 | 582 | ||
583 | impl Ty { | 583 | impl 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,10 +752,9 @@ 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) | ||
761 | | Ty::Closure { substs, .. } => { | 758 | | Ty::Closure { substs, .. } => { |
762 | assert_eq!(substs.len(), new_substs.len()); | 759 | assert_eq!(substs.len(), new_substs.len()); |
763 | *substs = new_substs; | 760 | *substs = new_substs; |
@@ -778,10 +775,9 @@ impl Ty { | |||
778 | | Ty::Ref(_, substs) | 775 | | Ty::Ref(_, substs) |
779 | | Ty::FnDef(_, substs) | 776 | | Ty::FnDef(_, substs) |
780 | | Ty::FnPtr { substs, .. } | 777 | | Ty::FnPtr { substs, .. } |
781 | | Ty::Tuple { substs, .. } | 778 | | Ty::Tuple(_, substs) |
782 | | Ty::OpaqueType(_, substs) | 779 | | Ty::OpaqueType(_, substs) |
783 | | Ty::AssociatedType(_, substs) | 780 | | Ty::AssociatedType(_, substs) |
784 | | Ty::ForeignType(_, substs) | ||
785 | | Ty::Closure { substs, .. } => Some(substs), | 781 | | Ty::Closure { substs, .. } => Some(substs), |
786 | _ => None, | 782 | _ => None, |
787 | } | 783 | } |
@@ -796,10 +792,9 @@ impl Ty { | |||
796 | | Ty::Ref(_, substs) | 792 | | Ty::Ref(_, substs) |
797 | | Ty::FnDef(_, substs) | 793 | | Ty::FnDef(_, substs) |
798 | | Ty::FnPtr { substs, .. } | 794 | | Ty::FnPtr { substs, .. } |
799 | | Ty::Tuple { substs, .. } | 795 | | Ty::Tuple(_, substs) |
800 | | Ty::OpaqueType(_, substs) | 796 | | Ty::OpaqueType(_, substs) |
801 | | Ty::AssociatedType(_, substs) | 797 | | Ty::AssociatedType(_, substs) |
802 | | Ty::ForeignType(_, substs) | ||
803 | | Ty::Closure { substs, .. } => Some(substs), | 798 | | Ty::Closure { substs, .. } => Some(substs), |
804 | _ => None, | 799 | _ => None, |
805 | } | 800 | } |
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 6b919a09e..84734bc0b 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -148,7 +148,7 @@ impl Ty { | |||
148 | TypeRef::Never => Ty::Never, | 148 | TypeRef::Never => Ty::Never, |
149 | TypeRef::Tuple(inner) => { | 149 | TypeRef::Tuple(inner) => { |
150 | let inner_tys: Arc<[Ty]> = inner.iter().map(|tr| Ty::from_hir(ctx, tr)).collect(); | 150 | let inner_tys: Arc<[Ty]> = inner.iter().map(|tr| Ty::from_hir(ctx, tr)).collect(); |
151 | Ty::Tuple { cardinality: inner_tys.len() as u16, substs: Substs(inner_tys) } | 151 | Ty::Tuple(inner_tys.len(), Substs(inner_tys)) |
152 | } | 152 | } |
153 | TypeRef::Path(path) => { | 153 | TypeRef::Path(path) => { |
154 | let (ty, res_) = Ty::from_hir_path(ctx, path); | 154 | let (ty, res_) = Ty::from_hir_path(ctx, path); |
@@ -1100,10 +1100,10 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> { | |||
1100 | let resolver = t.resolver(db.upcast()); | 1100 | let resolver = t.resolver(db.upcast()); |
1101 | let ctx = | 1101 | let ctx = |
1102 | TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable); | 1102 | TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable); |
1103 | let substs = Substs::bound_vars(&generics, DebruijnIndex::INNERMOST); | ||
1104 | if db.type_alias_data(t).is_extern { | 1103 | if db.type_alias_data(t).is_extern { |
1105 | Binders::new(substs.len(), Ty::ForeignType(t, substs)) | 1104 | Binders::new(0, Ty::ForeignType(t)) |
1106 | } else { | 1105 | } else { |
1106 | let substs = Substs::bound_vars(&generics, DebruijnIndex::INNERMOST); | ||
1107 | let type_ref = &db.type_alias_data(t).type_ref; | 1107 | let type_ref = &db.type_alias_data(t).type_ref; |
1108 | let inner = Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)); | 1108 | let inner = Ty::from_hir(&ctx, type_ref.as_ref().unwrap_or(&TypeRef::Error)); |
1109 | Binders::new(substs.len(), inner) | 1109 | Binders::new(substs.len(), inner) |
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 087b67935..ff8ce5599 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -33,7 +33,7 @@ pub enum TyFingerprint { | |||
33 | Scalar(Scalar), | 33 | Scalar(Scalar), |
34 | Adt(AdtId), | 34 | Adt(AdtId), |
35 | Dyn(TraitId), | 35 | Dyn(TraitId), |
36 | Tuple { cardinality: u16 }, | 36 | Tuple(usize), |
37 | ForeignType(TypeAliasId), | 37 | ForeignType(TypeAliasId), |
38 | FnPtr { num_args: u16, is_varargs: bool }, | 38 | FnPtr { num_args: u16, is_varargs: bool }, |
39 | } | 39 | } |
@@ -50,7 +50,7 @@ impl TyFingerprint { | |||
50 | &Ty::Array(..) => TyFingerprint::Array, | 50 | &Ty::Array(..) => TyFingerprint::Array, |
51 | &Ty::Scalar(scalar) => TyFingerprint::Scalar(scalar), | 51 | &Ty::Scalar(scalar) => TyFingerprint::Scalar(scalar), |
52 | &Ty::Adt(adt, _) => TyFingerprint::Adt(adt), | 52 | &Ty::Adt(adt, _) => TyFingerprint::Adt(adt), |
53 | &Ty::Tuple { cardinality: u16, .. } => TyFingerprint::Tuple { cardinality: u16 }, | 53 | &Ty::Tuple(cardinality, _) => TyFingerprint::Tuple(cardinality), |
54 | &Ty::RawPtr(mutability, ..) => TyFingerprint::RawPtr(mutability), | 54 | &Ty::RawPtr(mutability, ..) => TyFingerprint::RawPtr(mutability), |
55 | &Ty::ForeignType(alias_id, ..) => TyFingerprint::ForeignType(alias_id), | 55 | &Ty::ForeignType(alias_id, ..) => TyFingerprint::ForeignType(alias_id), |
56 | &Ty::FnPtr { num_args, is_varargs, .. } => { | 56 | &Ty::FnPtr { num_args, is_varargs, .. } => { |
@@ -235,7 +235,7 @@ impl Ty { | |||
235 | Ty::Adt(def_id, _) => { | 235 | Ty::Adt(def_id, _) => { |
236 | return mod_to_crate_ids(def_id.module(db.upcast())); | 236 | return mod_to_crate_ids(def_id.module(db.upcast())); |
237 | } | 237 | } |
238 | Ty::ForeignType(type_alias_id, _) => { | 238 | Ty::ForeignType(type_alias_id) => { |
239 | return mod_to_crate_ids(type_alias_id.lookup(db.upcast()).module(db.upcast())); | 239 | return mod_to_crate_ids(type_alias_id.lookup(db.upcast()).module(db.upcast())); |
240 | } | 240 | } |
241 | Ty::Scalar(Scalar::Bool) => lang_item_crate!("bool"), | 241 | Ty::Scalar(Scalar::Bool) => lang_item_crate!("bool"), |
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 297ddeabd..c17c19638 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -55,7 +55,7 @@ impl ToChalk for Ty { | |||
55 | chalk_ir::TyKind::OpaqueType(id, substitution).intern(&Interner) | 55 | chalk_ir::TyKind::OpaqueType(id, substitution).intern(&Interner) |
56 | } | 56 | } |
57 | 57 | ||
58 | Ty::ForeignType(type_alias, _) => { | 58 | Ty::ForeignType(type_alias) => { |
59 | let foreign_type = TypeAliasAsForeignType(type_alias); | 59 | let foreign_type = TypeAliasAsForeignType(type_alias); |
60 | let foreign_type_id = foreign_type.to_chalk(db); | 60 | let foreign_type_id = foreign_type.to_chalk(db); |
61 | chalk_ir::TyKind::Foreign(foreign_type_id).intern(&Interner) | 61 | chalk_ir::TyKind::Foreign(foreign_type_id).intern(&Interner) |
@@ -63,7 +63,7 @@ impl ToChalk for Ty { | |||
63 | 63 | ||
64 | Ty::Scalar(scalar) => chalk_ir::TyKind::Scalar(scalar).intern(&Interner), | 64 | Ty::Scalar(scalar) => chalk_ir::TyKind::Scalar(scalar).intern(&Interner), |
65 | 65 | ||
66 | Ty::Tuple { cardinality, substs } => { | 66 | Ty::Tuple(cardinality, substs) => { |
67 | let substitution = substs.to_chalk(db); | 67 | let substitution = substs.to_chalk(db); |
68 | chalk_ir::TyKind::Tuple(cardinality.into(), substitution).intern(&Interner) | 68 | chalk_ir::TyKind::Tuple(cardinality.into(), substitution).intern(&Interner) |
69 | } | 69 | } |
@@ -199,7 +199,7 @@ impl ToChalk for Ty { | |||
199 | 199 | ||
200 | chalk_ir::TyKind::Scalar(scalar) => Ty::Scalar(scalar), | 200 | chalk_ir::TyKind::Scalar(scalar) => Ty::Scalar(scalar), |
201 | chalk_ir::TyKind::Tuple(cardinality, subst) => { | 201 | chalk_ir::TyKind::Tuple(cardinality, subst) => { |
202 | Ty::Tuple { cardinality: cardinality as u16, substs: from_chalk(db, subst) } | 202 | Ty::Tuple(cardinality, from_chalk(db, subst)) |
203 | } | 203 | } |
204 | chalk_ir::TyKind::Raw(mutability, ty) => { | 204 | chalk_ir::TyKind::Raw(mutability, ty) => { |
205 | Ty::RawPtr(from_chalk(db, mutability), Substs::single(from_chalk(db, ty))) | 205 | Ty::RawPtr(from_chalk(db, mutability), Substs::single(from_chalk(db, ty))) |
@@ -221,10 +221,9 @@ impl ToChalk for Ty { | |||
221 | Ty::Closure { def, expr, substs: from_chalk(db, subst) } | 221 | Ty::Closure { def, expr, substs: from_chalk(db, subst) } |
222 | } | 222 | } |
223 | 223 | ||
224 | chalk_ir::TyKind::Foreign(foreign_def_id) => Ty::ForeignType( | 224 | chalk_ir::TyKind::Foreign(foreign_def_id) => { |
225 | from_chalk::<TypeAliasAsForeignType, _>(db, foreign_def_id).0, | 225 | Ty::ForeignType(from_chalk::<TypeAliasAsForeignType, _>(db, foreign_def_id).0) |
226 | Substs::empty(), | 226 | } |
227 | ), | ||
228 | chalk_ir::TyKind::Generator(_, _) => unimplemented!(), // FIXME | 227 | chalk_ir::TyKind::Generator(_, _) => unimplemented!(), // FIXME |
229 | chalk_ir::TyKind::GeneratorWitness(_, _) => unimplemented!(), // FIXME | 228 | chalk_ir::TyKind::GeneratorWitness(_, _) => unimplemented!(), // FIXME |
230 | } | 229 | } |