aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-22 15:52:25 +0000
committerGitHub <[email protected]>2019-11-22 15:52:25 +0000
commit6d42db2e51e223c9be7b6ea234521ca6f93ee95a (patch)
tree895e5bb04a4a632b4069bf66f8c7770cfa80a90d /crates/ra_hir/src/ty
parentb841c53a0c93cdca3f08b1c917c9fa8a63d31604 (diff)
parentfe119fef2746bade402fb73dcba8cde49779654d (diff)
Merge #2358
2358: Hide data from public API 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/infer.rs16
-rw-r--r--crates/ra_hir/src/ty/lower.rs8
2 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 6e07ab86e..471bdc387 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -22,7 +22,7 @@ use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue};
22use rustc_hash::FxHashMap; 22use rustc_hash::FxHashMap;
23 23
24use hir_def::{ 24use hir_def::{
25 data::FunctionData, 25 data::{ConstData, FunctionData},
26 path::known, 26 path::known,
27 resolver::{HasResolver, Resolver, TypeNs}, 27 resolver::{HasResolver, Resolver, TypeNs},
28 type_ref::{Mutability, TypeRef}, 28 type_ref::{Mutability, TypeRef},
@@ -44,8 +44,8 @@ use crate::{
44 db::HirDatabase, 44 db::HirDatabase,
45 expr::{BindingAnnotation, Body, ExprId, PatId}, 45 expr::{BindingAnnotation, Body, ExprId, PatId},
46 ty::infer::diagnostics::InferenceDiagnostic, 46 ty::infer::diagnostics::InferenceDiagnostic,
47 Adt, AssocItem, ConstData, DefWithBody, FloatTy, Function, HasBody, IntTy, Path, StructField, 47 Adt, AssocItem, DefWithBody, FloatTy, Function, HasBody, IntTy, Path, StructField, Trait,
48 Trait, VariantDef, 48 VariantDef,
49}; 49};
50 50
51macro_rules! ty_app { 51macro_rules! ty_app {
@@ -69,10 +69,10 @@ pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResu
69 let resolver = DefWithBodyId::from(def).resolver(db); 69 let resolver = DefWithBodyId::from(def).resolver(db);
70 let mut ctx = InferenceContext::new(db, def, resolver); 70 let mut ctx = InferenceContext::new(db, def, resolver);
71 71
72 match def { 72 match &def {
73 DefWithBody::Const(ref c) => ctx.collect_const(&c.data(db)), 73 DefWithBody::Const(c) => ctx.collect_const(&db.const_data(c.id)),
74 DefWithBody::Function(ref f) => ctx.collect_fn(&db.function_data(f.id)), 74 DefWithBody::Function(f) => ctx.collect_fn(&db.function_data(f.id)),
75 DefWithBody::Static(ref s) => ctx.collect_const(&s.data(db)), 75 DefWithBody::Static(s) => ctx.collect_const(&db.static_data(s.id)),
76 } 76 }
77 77
78 ctx.infer_body(); 78 ctx.infer_body();
@@ -560,7 +560,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
560 } 560 }
561 561
562 fn collect_const(&mut self, data: &ConstData) { 562 fn collect_const(&mut self, data: &ConstData) {
563 self.return_ty = self.make_ty(data.type_ref()); 563 self.return_ty = self.make_ty(&data.type_ref);
564 } 564 }
565 565
566 fn collect_fn(&mut self, data: &FunctionData) { 566 fn collect_fn(&mut self, data: &FunctionData) {
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index 42daa9cb9..2272510e8 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -639,18 +639,18 @@ fn type_for_fn(db: &impl HirDatabase, def: Function) -> Ty {
639 639
640/// Build the declared type of a const. 640/// Build the declared type of a const.
641fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty { 641fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty {
642 let data = def.data(db); 642 let data = db.const_data(def.id);
643 let resolver = def.id.resolver(db); 643 let resolver = def.id.resolver(db);
644 644
645 Ty::from_hir(db, &resolver, data.type_ref()) 645 Ty::from_hir(db, &resolver, &data.type_ref)
646} 646}
647 647
648/// Build the declared type of a static. 648/// Build the declared type of a static.
649fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty { 649fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty {
650 let data = def.data(db); 650 let data = db.static_data(def.id);
651 let resolver = def.id.resolver(db); 651 let resolver = def.id.resolver(db);
652 652
653 Ty::from_hir(db, &resolver, data.type_ref()) 653 Ty::from_hir(db, &resolver, &data.type_ref)
654} 654}
655 655
656/// Build the declared type of a static. 656/// Build the declared type of a static.