diff options
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 2a45479a8..676519594 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -38,7 +38,6 @@ use itertools::Itertools; | |||
38 | use crate::{ | 38 | use crate::{ |
39 | db::HirDatabase, | 39 | db::HirDatabase, |
40 | display::HirDisplay, | 40 | display::HirDisplay, |
41 | primitive::{FloatTy, IntTy, UintTy}, | ||
42 | utils::{generics, make_mut_slice, Generics}, | 41 | utils::{generics, make_mut_slice, Generics}, |
43 | }; | 42 | }; |
44 | 43 | ||
@@ -50,7 +49,7 @@ pub use lower::{ | |||
50 | }; | 49 | }; |
51 | pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; | 50 | pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; |
52 | 51 | ||
53 | pub use chalk_ir::{BoundVar, DebruijnIndex}; | 52 | pub use chalk_ir::{BoundVar, DebruijnIndex, Scalar}; |
54 | 53 | ||
55 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] | 54 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] |
56 | pub enum Lifetime { | 55 | pub enum Lifetime { |
@@ -58,17 +57,6 @@ pub enum Lifetime { | |||
58 | Static, | 57 | Static, |
59 | } | 58 | } |
60 | 59 | ||
61 | /// Types of scalar values. | ||
62 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
63 | #[allow(missing_docs)] | ||
64 | pub enum Scalar { | ||
65 | Bool, | ||
66 | Char, | ||
67 | Int(IntTy), | ||
68 | Uint(UintTy), | ||
69 | Float(FloatTy), | ||
70 | } | ||
71 | |||
72 | /// A type constructor or type name: this might be something like the primitive | 60 | /// A type constructor or type name: this might be something like the primitive |
73 | /// type `bool`, a struct like `Vec`, or things like function pointers or | 61 | /// type `bool`, a struct like `Vec`, or things like function pointers or |
74 | /// tuples. | 62 | /// tuples. |
@@ -736,9 +724,13 @@ impl Ty { | |||
736 | BuiltinType::Char => TypeCtor::Scalar(Scalar::Char), | 724 | BuiltinType::Char => TypeCtor::Scalar(Scalar::Char), |
737 | BuiltinType::Bool => TypeCtor::Scalar(Scalar::Bool), | 725 | BuiltinType::Bool => TypeCtor::Scalar(Scalar::Bool), |
738 | BuiltinType::Str => TypeCtor::Str, | 726 | BuiltinType::Str => TypeCtor::Str, |
739 | BuiltinType::Int(t) => TypeCtor::Scalar(Scalar::Int(t.into())), | 727 | BuiltinType::Int(t) => TypeCtor::Scalar(Scalar::Int(primitive::int_ty_from_builtin(t))), |
740 | BuiltinType::Uint(t) => TypeCtor::Scalar(Scalar::Uint(t.into())), | 728 | BuiltinType::Uint(t) => { |
741 | BuiltinType::Float(t) => TypeCtor::Scalar(Scalar::Float(t.into())), | 729 | TypeCtor::Scalar(Scalar::Uint(primitive::uint_ty_from_builtin(t))) |
730 | } | ||
731 | BuiltinType::Float(t) => { | ||
732 | TypeCtor::Scalar(Scalar::Float(primitive::float_ty_from_builtin(t))) | ||
733 | } | ||
742 | }) | 734 | }) |
743 | } | 735 | } |
744 | 736 | ||