aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/lower.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-31 07:55:15 +0000
committerGitHub <[email protected]>2019-10-31 07:55:15 +0000
commit7973c91281837bbb5c5a0bf3b1c71a5b52654b20 (patch)
tree8459ba446606dd0920a87de23276a8c5f80fd58a /crates/ra_hir/src/ty/lower.rs
parent51092ee72aa87787a65645ccdf82d3cb5a015915 (diff)
parentb20d37cb49536e19f6af57b00258f86eb8f19325 (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/lower.rs')
-rw-r--r--crates/ra_hir/src/ty/lower.rs16
1 files changed, 11 insertions, 5 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