aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-03 19:27:57 +0100
committerFlorian Diebold <[email protected]>2021-04-04 12:16:38 +0100
commite6f007d9a8e676c4af5731001b211ca7a52bce16 (patch)
tree1c4d7aa82dfc58a6a7c2b3af1228d538e57d0dc5 /crates/hir_ty/src/lib.rs
parentb0fe3d929f6f8764f371970b9f9ca9e7c415dafd (diff)
Move Ty::fn_ptr to TyBuilder
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index b6173d87c..fd44efa07 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -818,14 +818,8 @@ impl TyBuilder {
818 pub fn unit() -> Ty { 818 pub fn unit() -> Ty {
819 TyKind::Tuple(0, Substitution::empty(&Interner)).intern(&Interner) 819 TyKind::Tuple(0, Substitution::empty(&Interner)).intern(&Interner)
820 } 820 }
821}
822
823impl Ty {
824 pub fn adt_ty(adt: hir_def::AdtId, substs: Substitution) -> Ty {
825 TyKind::Adt(AdtId(adt), substs).intern(&Interner)
826 }
827 821
828 pub fn fn_ptr(sig: CallableSig) -> Self { 822 pub fn fn_ptr(sig: CallableSig) -> Ty {
829 TyKind::Function(FnPointer { 823 TyKind::Function(FnPointer {
830 num_args: sig.params().len(), 824 num_args: sig.params().len(),
831 sig: FnSig { abi: (), safety: Safety::Safe, variadic: sig.is_varargs }, 825 sig: FnSig { abi: (), safety: Safety::Safe, variadic: sig.is_varargs },
@@ -833,6 +827,12 @@ impl Ty {
833 }) 827 })
834 .intern(&Interner) 828 .intern(&Interner)
835 } 829 }
830}
831
832impl Ty {
833 pub fn adt_ty(adt: hir_def::AdtId, substs: Substitution) -> Ty {
834 TyKind::Adt(AdtId(adt), substs).intern(&Interner)
835 }
836 836
837 pub fn builtin(builtin: BuiltinType) -> Self { 837 pub fn builtin(builtin: BuiltinType) -> Self {
838 match builtin { 838 match builtin {