5405: Align CallableDefId naming with other ids r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-16 11:17:53 +00:00 committed by GitHub
commit 468982e45a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 69 additions and 67 deletions

View file

@ -40,7 +40,7 @@ use stdx::impl_from;
use crate::{ use crate::{
db::{DefDatabase, HirDatabase}, db::{DefDatabase, HirDatabase},
has_source::HasSource, has_source::HasSource,
CallableDef, HirDisplay, InFile, Name, CallableDefId, HirDisplay, InFile, Name,
}; };
/// hir::Crate describes a single crate. It's the main interface with which /// hir::Crate describes a single crate. It's the main interface with which
@ -1226,7 +1226,7 @@ impl Type {
} }
// FIXME: this method is broken, as it doesn't take closures into account. // FIXME: this method is broken, as it doesn't take closures into account.
pub fn as_callable(&self) -> Option<CallableDef> { pub fn as_callable(&self) -> Option<CallableDefId> {
Some(self.ty.value.as_callable()?.0) Some(self.ty.value.as_callable()?.0)
} }

View file

@ -55,4 +55,4 @@ pub use hir_expand::{
hygiene::Hygiene, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, hygiene::Hygiene, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId,
MacroFile, Origin, MacroFile, Origin,
}; };
pub use hir_ty::{display::HirDisplay, CallableDef}; pub use hir_ty::{display::HirDisplay, CallableDefId};

View file

@ -13,7 +13,7 @@ use ra_prof::profile;
use crate::{ use crate::{
method_resolution::{InherentImpls, TraitImpls}, method_resolution::{InherentImpls, TraitImpls},
traits::chalk, traits::chalk,
Binders, CallableDef, GenericPredicate, InferenceResult, OpaqueTyId, PolyFnSig, Binders, CallableDefId, GenericPredicate, InferenceResult, OpaqueTyId, PolyFnSig,
ReturnTypeImplTraits, TraitRef, Ty, TyDefId, ValueTyDefId, ReturnTypeImplTraits, TraitRef, Ty, TyDefId, ValueTyDefId,
}; };
use hir_expand::name::Name; use hir_expand::name::Name;
@ -45,7 +45,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>; fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>;
#[salsa::invoke(crate::callable_item_sig)] #[salsa::invoke(crate::callable_item_sig)]
fn callable_item_signature(&self, def: CallableDef) -> PolyFnSig; fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig;
#[salsa::invoke(crate::lower::return_type_impl_traits)] #[salsa::invoke(crate::lower::return_type_impl_traits)]
fn return_type_impl_traits( fn return_type_impl_traits(
@ -77,7 +77,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
// Interned IDs for Chalk integration // Interned IDs for Chalk integration
#[salsa::interned] #[salsa::interned]
fn intern_callable_def(&self, callable_def: CallableDef) -> crate::CallableDefId; fn intern_callable_def(&self, callable_def: CallableDefId) -> InternedCallableDefId;
#[salsa::interned] #[salsa::interned]
fn intern_type_param_id(&self, param_id: TypeParamId) -> GlobalTypeParamId; fn intern_type_param_id(&self, param_id: TypeParamId) -> GlobalTypeParamId;
#[salsa::interned] #[salsa::interned]
@ -151,3 +151,9 @@ impl_intern_key!(InternedOpaqueTyId);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ClosureId(salsa::InternId); pub struct ClosureId(salsa::InternId);
impl_intern_key!(ClosureId); 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

@ -11,7 +11,7 @@ use hir_def::{
use hir_expand::diagnostics::DiagnosticSink; use hir_expand::diagnostics::DiagnosticSink;
use crate::{ use crate::{
db::HirDatabase, diagnostics::MissingUnsafe, lower::CallableDef, ApplicationTy, db::HirDatabase, diagnostics::MissingUnsafe, lower::CallableDefId, ApplicationTy,
InferenceResult, Ty, TypeCtor, InferenceResult, Ty, TypeCtor,
}; };
@ -88,7 +88,7 @@ fn walk_unsafe(
Expr::Call { callee, .. } => { Expr::Call { callee, .. } => {
let ty = &infer[*callee]; let ty = &infer[*callee];
if let &Ty::Apply(ApplicationTy { if let &Ty::Apply(ApplicationTy {
ctor: TypeCtor::FnDef(CallableDef::FunctionId(func)), ctor: TypeCtor::FnDef(CallableDefId::FunctionId(func)),
.. ..
}) = ty }) = ty
{ {

View file

@ -3,7 +3,7 @@
use std::fmt; use std::fmt;
use crate::{ use crate::{
db::HirDatabase, utils::generics, ApplicationTy, CallableDef, FnSig, GenericPredicate, db::HirDatabase, utils::generics, ApplicationTy, CallableDefId, FnSig, GenericPredicate,
Obligation, OpaqueTyId, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, Obligation, OpaqueTyId, ProjectionTy, Substs, TraitRef, Ty, TypeCtor,
}; };
use hir_def::{ use hir_def::{
@ -263,9 +263,11 @@ impl HirDisplay for ApplicationTy {
TypeCtor::FnDef(def) => { TypeCtor::FnDef(def) => {
let sig = f.db.callable_item_signature(def).subst(&self.parameters); let sig = f.db.callable_item_signature(def).subst(&self.parameters);
match def { match def {
CallableDef::FunctionId(ff) => write!(f, "fn {}", f.db.function_data(ff).name)?, CallableDefId::FunctionId(ff) => {
CallableDef::StructId(s) => write!(f, "{}", f.db.struct_data(s).name)?, write!(f, "fn {}", f.db.function_data(ff).name)?
CallableDef::EnumVariantId(e) => { }
CallableDefId::StructId(s) => write!(f, "{}", f.db.struct_data(s).name)?,
CallableDefId::EnumVariantId(e) => {
write!(f, "{}", f.db.enum_data(e.parent).variants[e.local_id].name)? write!(f, "{}", f.db.enum_data(e.parent).variants[e.local_id].name)?
} }
}; };

View file

@ -17,7 +17,7 @@ use crate::{
autoderef, method_resolution, op, autoderef, method_resolution, op,
traits::{FnTrait, InEnvironment}, traits::{FnTrait, InEnvironment},
utils::{generics, variant_data, Generics}, utils::{generics, variant_data, Generics},
ApplicationTy, Binders, CallableDef, InferTy, IntTy, Mutability, Obligation, Rawness, Substs, ApplicationTy, Binders, CallableDefId, InferTy, IntTy, Mutability, Obligation, Rawness, Substs,
TraitRef, Ty, TypeCtor, TraitRef, Ty, TypeCtor,
}; };
@ -854,7 +854,7 @@ impl<'a> InferenceContext<'a> {
} }
// add obligation for trait implementation, if this is a trait method // add obligation for trait implementation, if this is a trait method
match def { match def {
CallableDef::FunctionId(f) => { CallableDefId::FunctionId(f) => {
if let AssocContainerId::TraitId(trait_) = if let AssocContainerId::TraitId(trait_) =
f.lookup(self.db.upcast()).container f.lookup(self.db.upcast()).container
{ {
@ -865,7 +865,7 @@ impl<'a> InferenceContext<'a> {
self.obligations.push(Obligation::Trait(TraitRef { trait_, substs })); self.obligations.push(Obligation::Trait(TraitRef { trait_, substs }));
} }
} }
CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => {} CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_) => {}
} }
} }
} }

View file

@ -33,7 +33,7 @@ use hir_def::{
TypeParamId, TypeParamId,
}; };
use itertools::Itertools; use itertools::Itertools;
use ra_db::{impl_intern_key, salsa, CrateId}; use ra_db::{salsa, CrateId};
use crate::{ use crate::{
db::HirDatabase, db::HirDatabase,
@ -44,7 +44,7 @@ use crate::{
pub use autoderef::autoderef; pub use autoderef::autoderef;
pub use infer::{InferTy, InferenceResult}; pub use infer::{InferTy, InferenceResult};
pub use lower::CallableDef; pub use lower::CallableDefId;
pub use lower::{ pub use lower::{
associated_type_shorthand_candidates, callable_item_sig, ImplTraitLoweringMode, TyDefId, associated_type_shorthand_candidates, callable_item_sig, ImplTraitLoweringMode, TyDefId,
TyLoweringContext, ValueTyDefId, TyLoweringContext, ValueTyDefId,
@ -102,7 +102,7 @@ pub enum TypeCtor {
/// fn foo() -> i32 { 1 } /// fn foo() -> i32 { 1 }
/// let bar = foo; // bar: fn() -> i32 {foo} /// let bar = foo; // bar: fn() -> i32 {foo}
/// ``` /// ```
FnDef(CallableDef), FnDef(CallableDefId),
/// A pointer to a function. Written as `fn() -> i32`. /// A pointer to a function. Written as `fn() -> i32`.
/// ///
@ -140,12 +140,6 @@ pub enum TypeCtor {
Closure { def: DefWithBodyId, expr: ExprId }, 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 { impl TypeCtor {
pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize { pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize {
match self { match self {
@ -773,7 +767,7 @@ impl Ty {
} }
} }
pub fn as_callable(&self) -> Option<(CallableDef, &Substs)> { pub fn as_callable(&self) -> Option<(CallableDefId, &Substs)> {
match self { match self {
Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(callable_def), parameters }) => { Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(callable_def), parameters }) => {
Some((*callable_def, parameters)) Some((*callable_def, parameters))

View file

@ -768,11 +768,11 @@ fn count_impl_traits(type_ref: &TypeRef) -> usize {
} }
/// Build the signature of a callable item (function, struct or enum variant). /// Build the signature of a callable item (function, struct or enum variant).
pub fn callable_item_sig(db: &dyn HirDatabase, def: CallableDef) -> PolyFnSig { pub fn callable_item_sig(db: &dyn HirDatabase, def: CallableDefId) -> PolyFnSig {
match def { match def {
CallableDef::FunctionId(f) => fn_sig_for_fn(db, f), CallableDefId::FunctionId(f) => fn_sig_for_fn(db, f),
CallableDef::StructId(s) => fn_sig_for_struct_constructor(db, s), CallableDefId::StructId(s) => fn_sig_for_struct_constructor(db, s),
CallableDef::EnumVariantId(e) => fn_sig_for_enum_variant_constructor(db, e), CallableDefId::EnumVariantId(e) => fn_sig_for_enum_variant_constructor(db, e),
} }
} }
@ -1107,31 +1107,31 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> {
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum CallableDef { pub enum CallableDefId {
FunctionId(FunctionId), FunctionId(FunctionId),
StructId(StructId), StructId(StructId),
EnumVariantId(EnumVariantId), EnumVariantId(EnumVariantId),
} }
impl_from!(FunctionId, StructId, EnumVariantId for CallableDef); impl_from!(FunctionId, StructId, EnumVariantId for CallableDefId);
impl CallableDef { impl CallableDefId {
pub fn krate(self, db: &dyn HirDatabase) -> CrateId { pub fn krate(self, db: &dyn HirDatabase) -> CrateId {
let db = db.upcast(); let db = db.upcast();
match self { match self {
CallableDef::FunctionId(f) => f.lookup(db).module(db), CallableDefId::FunctionId(f) => f.lookup(db).module(db),
CallableDef::StructId(s) => s.lookup(db).container.module(db), CallableDefId::StructId(s) => s.lookup(db).container.module(db),
CallableDef::EnumVariantId(e) => e.parent.lookup(db).container.module(db), CallableDefId::EnumVariantId(e) => e.parent.lookup(db).container.module(db),
} }
.krate .krate
} }
} }
impl From<CallableDef> for GenericDefId { impl From<CallableDefId> for GenericDefId {
fn from(def: CallableDef) -> GenericDefId { fn from(def: CallableDefId) -> GenericDefId {
match def { match def {
CallableDef::FunctionId(f) => f.into(), CallableDefId::FunctionId(f) => f.into(),
CallableDef::StructId(s) => s.into(), CallableDefId::StructId(s) => s.into(),
CallableDef::EnumVariantId(e) => e.into(), CallableDefId::EnumVariantId(e) => e.into(),
} }
} }
} }

View file

@ -18,7 +18,7 @@ use crate::{
display::HirDisplay, display::HirDisplay,
method_resolution::{TyFingerprint, ALL_FLOAT_FPS, ALL_INT_FPS}, method_resolution::{TyFingerprint, ALL_FLOAT_FPS, ALL_INT_FPS},
utils::generics, utils::generics,
CallableDef, DebruijnIndex, FnSig, GenericPredicate, Substs, Ty, TypeCtor, CallableDefId, DebruijnIndex, FnSig, GenericPredicate, Substs, Ty, TypeCtor,
}; };
use mapping::{ use mapping::{
convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsValue, convert_where_clauses, generic_predicate_to_inline_bound, make_binders, TypeAliasAsValue,
@ -525,7 +525,7 @@ pub(crate) fn fn_def_datum_query(
_krate: CrateId, _krate: CrateId,
fn_def_id: FnDefId, fn_def_id: FnDefId,
) -> Arc<FnDefDatum> { ) -> Arc<FnDefDatum> {
let callable_def: CallableDef = from_chalk(db, fn_def_id); let callable_def: CallableDefId = from_chalk(db, fn_def_id);
let generic_params = generics(db.upcast(), callable_def.into()); let generic_params = generics(db.upcast(), callable_def.into());
let sig = db.callable_item_signature(callable_def); let sig = db.callable_item_signature(callable_def);
let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST);
@ -552,14 +552,14 @@ pub(crate) fn fn_def_datum_query(
Arc::new(datum) Arc::new(datum)
} }
impl From<FnDefId> for crate::CallableDefId { impl From<FnDefId> for crate::db::InternedCallableDefId {
fn from(fn_def_id: FnDefId) -> Self { fn from(fn_def_id: FnDefId) -> Self {
InternKey::from_intern_id(fn_def_id.0) InternKey::from_intern_id(fn_def_id.0)
} }
} }
impl From<crate::CallableDefId> for FnDefId { impl From<crate::db::InternedCallableDefId> for FnDefId {
fn from(callable_def_id: crate::CallableDefId) -> Self { fn from(callable_def_id: crate::db::InternedCallableDefId) -> Self {
chalk_ir::FnDefId(callable_def_id.as_intern_id()) chalk_ir::FnDefId(callable_def_id.as_intern_id())
} }
} }

View file

@ -16,7 +16,7 @@ use crate::{
db::HirDatabase, db::HirDatabase,
primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness}, primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness},
traits::{Canonical, Obligation}, traits::{Canonical, Obligation},
ApplicationTy, CallableDef, GenericPredicate, InEnvironment, OpaqueTy, OpaqueTyId, ApplicationTy, CallableDefId, GenericPredicate, InEnvironment, OpaqueTy, OpaqueTyId,
ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeCtor, ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeCtor,
}; };
@ -454,14 +454,14 @@ impl ToChalk for hir_def::ImplId {
} }
} }
impl ToChalk for CallableDef { impl ToChalk for CallableDefId {
type Chalk = FnDefId; type Chalk = FnDefId;
fn to_chalk(self, db: &dyn HirDatabase) -> FnDefId { fn to_chalk(self, db: &dyn HirDatabase) -> FnDefId {
db.intern_callable_def(self).into() db.intern_callable_def(self).into()
} }
fn from_chalk(db: &dyn HirDatabase, fn_def_id: FnDefId) -> CallableDef { fn from_chalk(db: &dyn HirDatabase, fn_def_id: FnDefId) -> CallableDefId {
db.lookup_intern_callable_def(fn_def_id.into()) db.lookup_intern_callable_def(fn_def_id.into())
} }
} }

View file

@ -5,7 +5,7 @@ use chalk_ir::{AliasTy, GenericArg, Goal, Goals, Lifetime, ProgramClauseImplicat
use itertools::Itertools; use itertools::Itertools;
use super::{from_chalk, Interner}; use super::{from_chalk, Interner};
use crate::{db::HirDatabase, CallableDef, TypeCtor}; use crate::{db::HirDatabase, CallableDefId, TypeCtor};
use hir_def::{AdtId, AssocContainerId, DefWithBodyId, Lookup, TypeAliasId}; use hir_def::{AdtId, AssocContainerId, DefWithBodyId, Lookup, TypeAliasId};
pub use unsafe_tls::{set_current_program, with_current_program}; pub use unsafe_tls::{set_current_program, with_current_program};
@ -38,16 +38,16 @@ impl DebugContext<'_> {
} }
TypeCtor::FnDef(def) => { TypeCtor::FnDef(def) => {
let name = match def { let name = match def {
CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(), CallableDefId::FunctionId(ff) => self.0.function_data(ff).name.clone(),
CallableDef::StructId(s) => self.0.struct_data(s).name.clone(), CallableDefId::StructId(s) => self.0.struct_data(s).name.clone(),
CallableDef::EnumVariantId(e) => { CallableDefId::EnumVariantId(e) => {
let enum_data = self.0.enum_data(e.parent); let enum_data = self.0.enum_data(e.parent);
enum_data.variants[e.local_id].name.clone() enum_data.variants[e.local_id].name.clone()
} }
}; };
match def { match def {
CallableDef::FunctionId(_) => write!(f, "{{fn {}}}", name)?, CallableDefId::FunctionId(_) => write!(f, "{{fn {}}}", name)?,
CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => { CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_) => {
write!(f, "{{ctor {}}}", name)? write!(f, "{{ctor {}}}", name)?
} }
} }
@ -255,18 +255,18 @@ impl DebugContext<'_> {
fn_def_id: chalk_ir::FnDefId<Interner>, fn_def_id: chalk_ir::FnDefId<Interner>,
fmt: &mut fmt::Formatter<'_>, fmt: &mut fmt::Formatter<'_>,
) -> Result<(), fmt::Error> { ) -> Result<(), fmt::Error> {
let def: CallableDef = from_chalk(self.0, fn_def_id); let def: CallableDefId = from_chalk(self.0, fn_def_id);
let name = match def { let name = match def {
CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(), CallableDefId::FunctionId(ff) => self.0.function_data(ff).name.clone(),
CallableDef::StructId(s) => self.0.struct_data(s).name.clone(), CallableDefId::StructId(s) => self.0.struct_data(s).name.clone(),
CallableDef::EnumVariantId(e) => { CallableDefId::EnumVariantId(e) => {
let enum_data = self.0.enum_data(e.parent); let enum_data = self.0.enum_data(e.parent);
enum_data.variants[e.local_id].name.clone() enum_data.variants[e.local_id].name.clone()
} }
}; };
match def { match def {
CallableDef::FunctionId(_) => write!(fmt, "{{fn {}}}", name), CallableDefId::FunctionId(_) => write!(fmt, "{{fn {}}}", name),
CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => { CallableDefId::StructId(_) | CallableDefId::EnumVariantId(_) => {
write!(fmt, "{{ctor {}}}", name) write!(fmt, "{{ctor {}}}", name)
} }
} }

View file

@ -97,7 +97,7 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
//FIXME: Type::as_callable is broken //FIXME: Type::as_callable is broken
let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?; let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?;
match callable_def { match callable_def {
hir::CallableDef::FunctionId(it) => { hir::CallableDefId::FunctionId(it) => {
let fn_def: hir::Function = it.into(); let fn_def: hir::Function = it.into();
let nav = fn_def.to_nav(db); let nav = fn_def.to_nav(db);
Some(nav) Some(nav)

View file

@ -53,14 +53,14 @@ fn call_info_for_token(sema: &Semantics<RootDatabase>, token: SyntaxToken) -> Op
//FIXME: Type::as_callable is broken //FIXME: Type::as_callable is broken
let callable_def = sema.type_of_expr(&call.expr()?)?.as_callable()?; let callable_def = sema.type_of_expr(&call.expr()?)?.as_callable()?;
match callable_def { match callable_def {
hir::CallableDef::FunctionId(it) => { hir::CallableDefId::FunctionId(it) => {
let fn_def = it.into(); let fn_def = it.into();
FunctionSignature::from_hir(sema.db, fn_def) FunctionSignature::from_hir(sema.db, fn_def)
} }
hir::CallableDef::StructId(it) => { hir::CallableDefId::StructId(it) => {
FunctionSignature::from_struct(sema.db, it.into())? FunctionSignature::from_struct(sema.db, it.into())?
} }
hir::CallableDef::EnumVariantId(it) => { hir::CallableDefId::EnumVariantId(it) => {
FunctionSignature::from_enum_variant(sema.db, it.into())? FunctionSignature::from_enum_variant(sema.db, it.into())?
} }
} }

View file

@ -324,13 +324,13 @@ fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option<
// FIXME: Type::as_callable is broken for closures // FIXME: Type::as_callable is broken for closures
let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?; let callable_def = sema.type_of_expr(&expr.expr()?)?.as_callable()?;
match callable_def { match callable_def {
hir::CallableDef::FunctionId(it) => { hir::CallableDefId::FunctionId(it) => {
Some(FunctionSignature::from_hir(sema.db, it.into())) Some(FunctionSignature::from_hir(sema.db, it.into()))
} }
hir::CallableDef::StructId(it) => { hir::CallableDefId::StructId(it) => {
FunctionSignature::from_struct(sema.db, it.into()) FunctionSignature::from_struct(sema.db, it.into())
} }
hir::CallableDef::EnumVariantId(it) => { hir::CallableDefId::EnumVariantId(it) => {
FunctionSignature::from_enum_variant(sema.db, it.into()) FunctionSignature::from_enum_variant(sema.db, it.into())
} }
} }