aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-03 19:22:59 +0100
committerFlorian Diebold <[email protected]>2021-04-04 12:16:38 +0100
commitb0fe3d929f6f8764f371970b9f9ca9e7c415dafd (patch)
tree384bd17e3428b591f1c82d1b061ceecee529c044 /crates/hir_ty/src/lib.rs
parentb15152c430237d6850ec709ac75aab269c4b7dee (diff)
Add TyBuilder::unit() and TyExt::is_unit()
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r--crates/hir_ty/src/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index a8ddb43f5..b6173d87c 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -23,6 +23,7 @@ pub mod diagnostics;
23mod tests; 23mod tests;
24#[cfg(test)] 24#[cfg(test)]
25mod test_db; 25mod test_db;
26mod chalk_ext;
26 27
27use std::{iter, mem, sync::Arc}; 28use std::{iter, mem, sync::Arc};
28 29
@@ -42,6 +43,7 @@ use crate::{
42}; 43};
43 44
44pub use autoderef::autoderef; 45pub use autoderef::autoderef;
46pub use chalk_ext::TyExt;
45pub use infer::{could_unify, InferenceResult, InferenceVar}; 47pub use infer::{could_unify, InferenceResult, InferenceVar};
46pub use lower::{ 48pub use lower::{
47 associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode, 49 associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode,
@@ -813,14 +815,12 @@ impl TypeWalk for CallableSig {
813struct TyBuilder {} 815struct TyBuilder {}
814 816
815impl TyBuilder { 817impl TyBuilder {
816 818 pub fn unit() -> Ty {
817}
818
819impl Ty {
820 pub fn unit() -> Self {
821 TyKind::Tuple(0, Substitution::empty(&Interner)).intern(&Interner) 819 TyKind::Tuple(0, Substitution::empty(&Interner)).intern(&Interner)
822 } 820 }
821}
823 822
823impl Ty {
824 pub fn adt_ty(adt: hir_def::AdtId, substs: Substitution) -> Ty { 824 pub fn adt_ty(adt: hir_def::AdtId, substs: Substitution) -> Ty {
825 TyKind::Adt(AdtId(adt), substs).intern(&Interner) 825 TyKind::Adt(AdtId(adt), substs).intern(&Interner)
826 } 826 }