mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Hide data from public API
This commit is contained in:
parent
d4f4ae0dd8
commit
fe119fef27
@ -10,7 +10,7 @@ use hir_def::{
|
||||
adt::VariantData,
|
||||
body::scope::ExprScopes,
|
||||
builtin_type::BuiltinType,
|
||||
data::{ConstData, TraitData},
|
||||
data::TraitData,
|
||||
nameres::per_ns::PerNs,
|
||||
resolver::{HasResolver, TypeNs},
|
||||
type_ref::TypeRef,
|
||||
@ -644,12 +644,8 @@ impl Const {
|
||||
Some(self.module(db).krate())
|
||||
}
|
||||
|
||||
pub fn data(self, db: &impl HirDatabase) -> Arc<ConstData> {
|
||||
db.const_data(self.id)
|
||||
}
|
||||
|
||||
pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
|
||||
self.data(db).name.clone()
|
||||
db.const_data(self.id).name.clone()
|
||||
}
|
||||
|
||||
pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
|
||||
@ -695,10 +691,6 @@ impl Static {
|
||||
Some(self.module(db).krate())
|
||||
}
|
||||
|
||||
pub fn data(self, db: &impl HirDatabase) -> Arc<ConstData> {
|
||||
db.static_data(self.id)
|
||||
}
|
||||
|
||||
pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
|
||||
db.infer(self.into())
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResu
|
||||
let resolver = DefWithBodyId::from(def).resolver(db);
|
||||
let mut ctx = InferenceContext::new(db, def, resolver);
|
||||
|
||||
match def {
|
||||
DefWithBody::Const(ref c) => ctx.collect_const(&c.data(db)),
|
||||
DefWithBody::Function(ref f) => ctx.collect_fn(&db.function_data(f.id)),
|
||||
DefWithBody::Static(ref s) => ctx.collect_const(&s.data(db)),
|
||||
match &def {
|
||||
DefWithBody::Const(c) => ctx.collect_const(&db.const_data(c.id)),
|
||||
DefWithBody::Function(f) => ctx.collect_fn(&db.function_data(f.id)),
|
||||
DefWithBody::Static(s) => ctx.collect_const(&db.static_data(s.id)),
|
||||
}
|
||||
|
||||
ctx.infer_body();
|
||||
|
@ -639,7 +639,7 @@ fn type_for_fn(db: &impl HirDatabase, def: Function) -> Ty {
|
||||
|
||||
/// Build the declared type of a const.
|
||||
fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty {
|
||||
let data = def.data(db);
|
||||
let data = db.const_data(def.id);
|
||||
let resolver = def.id.resolver(db);
|
||||
|
||||
Ty::from_hir(db, &resolver, &data.type_ref)
|
||||
@ -647,7 +647,7 @@ fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty {
|
||||
|
||||
/// Build the declared type of a static.
|
||||
fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty {
|
||||
let data = def.data(db);
|
||||
let data = db.static_data(def.id);
|
||||
let resolver = def.id.resolver(db);
|
||||
|
||||
Ty::from_hir(db, &resolver, &data.type_ref)
|
||||
|
Loading…
Reference in New Issue
Block a user