aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/lower.rs16
-rw-r--r--crates/ra_hir/src/ty/primitive.rs22
2 files changed, 12 insertions, 26 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index 0f49a0e54..dd7cd979f 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -9,6 +9,7 @@ use std::iter;
9use std::sync::Arc; 9use std::sync::Arc;
10 10
11use hir_def::{ 11use hir_def::{
12 builtin_type::BuiltinType,
12 path::{GenericArg, PathSegment}, 13 path::{GenericArg, PathSegment},
13 type_ref::{TypeBound, TypeRef}, 14 type_ref::{TypeBound, TypeRef},
14}; 15};
@@ -24,10 +25,13 @@ use crate::{
24 generics::{GenericDef, WherePredicate}, 25 generics::{GenericDef, WherePredicate},
25 nameres::Namespace, 26 nameres::Namespace,
26 resolve::{Resolver, TypeNs}, 27 resolve::{Resolver, TypeNs},
27 ty::Adt, 28 ty::{
29 primitive::{FloatTy, IntTy},
30 Adt,
31 },
28 util::make_mut_slice, 32 util::make_mut_slice,
29 BuiltinType, Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, 33 Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, Trait,
30 Trait, TypeAlias, Union, 34 TypeAlias, Union,
31}; 35};
32 36
33impl Ty { 37impl Ty {
@@ -643,8 +647,10 @@ fn type_for_builtin(def: BuiltinType) -> Ty {
643 BuiltinType::Char => TypeCtor::Char, 647 BuiltinType::Char => TypeCtor::Char,
644 BuiltinType::Bool => TypeCtor::Bool, 648 BuiltinType::Bool => TypeCtor::Bool,
645 BuiltinType::Str => TypeCtor::Str, 649 BuiltinType::Str => TypeCtor::Str,
646 BuiltinType::Int(ty) => TypeCtor::Int(ty.into()), 650 BuiltinType::Int { signedness, bitness } => {
647 BuiltinType::Float(ty) => TypeCtor::Float(ty.into()), 651 TypeCtor::Int(IntTy { signedness, bitness }.into())
652 }
653 BuiltinType::Float { bitness } => TypeCtor::Float(FloatTy { bitness }.into()),
648 }) 654 })
649} 655}
650 656
diff --git a/crates/ra_hir/src/ty/primitive.rs b/crates/ra_hir/src/ty/primitive.rs
index 8966f9d1d..1749752f1 100644
--- a/crates/ra_hir/src/ty/primitive.rs
+++ b/crates/ra_hir/src/ty/primitive.rs
@@ -2,27 +2,7 @@
2 2
3use std::fmt; 3use std::fmt;
4 4
5#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] 5pub use hir_def::builtin_type::{FloatBitness, IntBitness, Signedness};
6pub enum Signedness {
7 Signed,
8 Unsigned,
9}
10
11#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
12pub enum IntBitness {
13 Xsize,
14 X8,
15 X16,
16 X32,
17 X64,
18 X128,
19}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
22pub enum FloatBitness {
23 X32,
24 X64,
25}
26 6
27#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] 7#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
28pub enum UncertainIntTy { 8pub enum UncertainIntTy {