Rename CallableDefId -> InternedCallabelDefid

This commit is contained in:
Aleksey Kladov 2020-07-16 13:13:17 +02:00
parent 8a880230a5
commit b598ab8be4
3 changed files with 11 additions and 11 deletions

View File

@ -77,7 +77,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
// Interned IDs for Chalk integration
#[salsa::interned]
fn intern_callable_def(&self, callable_def: CallableDef) -> crate::CallableDefId;
fn intern_callable_def(&self, callable_def: CallableDef) -> InternedCallableDefId;
#[salsa::interned]
fn intern_type_param_id(&self, param_id: TypeParamId) -> GlobalTypeParamId;
#[salsa::interned]
@ -151,3 +151,9 @@ impl_intern_key!(InternedOpaqueTyId);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ClosureId(salsa::InternId);
impl_intern_key!(ClosureId);
/// This exists just for Chalk, because Chalk just has a single `FnDefId` where
/// we have different IDs for struct and enum variant constructors.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
pub struct InternedCallableDefId(salsa::InternId);
impl_intern_key!(InternedCallableDefId);

View File

@ -33,7 +33,7 @@ use hir_def::{
TypeParamId,
};
use itertools::Itertools;
use ra_db::{impl_intern_key, salsa, CrateId};
use ra_db::{salsa, CrateId};
use crate::{
db::HirDatabase,
@ -140,12 +140,6 @@ pub enum TypeCtor {
Closure { def: DefWithBodyId, expr: ExprId },
}
/// This exists just for Chalk, because Chalk just has a single `FnDefId` where
/// we have different IDs for struct and enum variant constructors.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
pub struct CallableDefId(salsa::InternId);
impl_intern_key!(CallableDefId);
impl TypeCtor {
pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize {
match self {

View File

@ -552,14 +552,14 @@ pub(crate) fn fn_def_datum_query(
Arc::new(datum)
}
impl From<FnDefId> for crate::CallableDefId {
impl From<FnDefId> for crate::db::InternedCallableDefId {
fn from(fn_def_id: FnDefId) -> Self {
InternKey::from_intern_id(fn_def_id.0)
}
}
impl From<crate::CallableDefId> for FnDefId {
fn from(callable_def_id: crate::CallableDefId) -> Self {
impl From<crate::db::InternedCallableDefId> for FnDefId {
fn from(callable_def_id: crate::db::InternedCallableDefId) -> Self {
chalk_ir::FnDefId(callable_def_id.as_intern_id())
}
}