aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-26 18:25:17 +0000
committerAleksey Kladov <[email protected]>2019-11-26 18:32:39 +0000
commit936c6950e78d073f54c9ba66795f7f6f3abb351b (patch)
tree1fef7d393443373acb459f98adf6a3ba6100261f
parent882fe0a47ee6f60928395326d1f194eec521ce2e (diff)
Remove last traces of adt from Ty
-rw-r--r--crates/ra_hir/src/code_model.rs2
-rw-r--r--crates/ra_hir/src/expr.rs4
-rw-r--r--crates/ra_hir/src/ty.rs7
3 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 0edcdb177..a842dfed6 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1104,7 +1104,7 @@ impl Type {
1104 1104
1105 pub fn as_adt(&self) -> Option<Adt> { 1105 pub fn as_adt(&self) -> Option<Adt> {
1106 let (adt, _subst) = self.ty.value.as_adt()?; 1106 let (adt, _subst) = self.ty.value.as_adt()?;
1107 Some(adt) 1107 Some(adt.into())
1108 } 1108 }
1109 1109
1110 fn derived(&self, ty: Ty) -> Type { 1110 fn derived(&self, ty: Ty) -> Type {
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index adb9805ab..5c82c23d6 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -12,7 +12,7 @@ use crate::{
12 db::HirDatabase, 12 db::HirDatabase,
13 diagnostics::{MissingFields, MissingOkInTailExpr}, 13 diagnostics::{MissingFields, MissingOkInTailExpr},
14 ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, 14 ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
15 Adt, Function, Name, Path, 15 Function, Name, Path, Struct,
16}; 16};
17 17
18pub use hir_def::{ 18pub use hir_def::{
@@ -69,7 +69,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
69 } 69 }
70 70
71 let struct_def = match self.infer[id].as_adt() { 71 let struct_def = match self.infer[id].as_adt() {
72 Some((Adt::Struct(s), _)) => s, 72 Some((AdtId::StructId(s), _)) => Struct::from(s),
73 _ => return, 73 _ => return,
74 }; 74 };
75 75
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 680ddc2f9..791b6064a 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -22,13 +22,14 @@ use hir_def::{
22 expr::ExprId, generics::GenericParams, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId, 22 expr::ExprId, generics::GenericParams, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId,
23 GenericDefId, HasModule, Lookup, TraitId, TypeAliasId, 23 GenericDefId, HasModule, Lookup, TraitId, TypeAliasId,
24}; 24};
25use hir_expand::name::Name;
25use ra_db::{impl_intern_key, salsa}; 26use ra_db::{impl_intern_key, salsa};
26 27
27use crate::{ 28use crate::{
28 db::HirDatabase, 29 db::HirDatabase,
29 ty::primitive::{FloatTy, IntTy, Uncertain}, 30 ty::primitive::{FloatTy, IntTy, Uncertain},
30 util::make_mut_slice, 31 util::make_mut_slice,
31 Adt, Crate, Name, 32 Crate,
32}; 33};
33use display::{HirDisplay, HirFormatter}; 34use display::{HirDisplay, HirFormatter};
34 35
@@ -598,10 +599,10 @@ impl Ty {
598 } 599 }
599 } 600 }
600 601
601 pub fn as_adt(&self) -> Option<(Adt, &Substs)> { 602 pub fn as_adt(&self) -> Option<(AdtId, &Substs)> {
602 match self { 603 match self {
603 Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => { 604 Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => {
604 Some(((*adt_def).into(), parameters)) 605 Some((*adt_def, parameters))
605 } 606 }
606 _ => None, 607 _ => None,
607 } 608 }