diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-31 07:55:15 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-31 07:55:15 +0000 |
commit | 7973c91281837bbb5c5a0bf3b1c71a5b52654b20 (patch) | |
tree | 8459ba446606dd0920a87de23276a8c5f80fd58a /crates/ra_hir/src/ty | |
parent | 51092ee72aa87787a65645ccdf82d3cb5a015915 (diff) | |
parent | b20d37cb49536e19f6af57b00258f86eb8f19325 (diff) |
Merge #2140
2140: move builtin types to hir_def r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 16 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/primitive.rs | 22 |
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; | |||
9 | use std::sync::Arc; | 9 | use std::sync::Arc; |
10 | 10 | ||
11 | use hir_def::{ | 11 | use 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 | ||
33 | impl Ty { | 37 | impl 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 | ||
3 | use std::fmt; | 3 | use std::fmt; |
4 | 4 | ||
5 | #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] | 5 | pub use hir_def::builtin_type::{FloatBitness, IntBitness, Signedness}; |
6 | pub enum Signedness { | ||
7 | Signed, | ||
8 | Unsigned, | ||
9 | } | ||
10 | |||
11 | #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] | ||
12 | pub enum IntBitness { | ||
13 | Xsize, | ||
14 | X8, | ||
15 | X16, | ||
16 | X32, | ||
17 | X64, | ||
18 | X128, | ||
19 | } | ||
20 | |||
21 | #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] | ||
22 | pub 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)] |
28 | pub enum UncertainIntTy { | 8 | pub enum UncertainIntTy { |