mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-11 16:34:12 +00:00
Add GenericDefId::StaticId
This commit is contained in:
parent
55d1d5dd8b
commit
3bb0ff3480
13 changed files with 46 additions and 24 deletions
|
|
@ -2471,14 +2471,14 @@ pub enum ValueTyDefId {
|
|||
impl_from!(FunctionId, StructId, UnionId, EnumVariantId, ConstId, StaticId for ValueTyDefId);
|
||||
|
||||
impl ValueTyDefId {
|
||||
pub(crate) fn to_generic_def_id(self, db: &dyn HirDatabase) -> Option<GenericDefId> {
|
||||
pub(crate) fn to_generic_def_id(self, db: &dyn HirDatabase) -> GenericDefId {
|
||||
match self {
|
||||
Self::FunctionId(id) => Some(id.into()),
|
||||
Self::StructId(id) => Some(id.into()),
|
||||
Self::UnionId(id) => Some(id.into()),
|
||||
Self::EnumVariantId(var) => Some(var.lookup(db.upcast()).parent.into()),
|
||||
Self::ConstId(id) => Some(id.into()),
|
||||
Self::StaticId(_) => None,
|
||||
Self::FunctionId(id) => id.into(),
|
||||
Self::StructId(id) => id.into(),
|
||||
Self::UnionId(id) => id.into(),
|
||||
Self::EnumVariantId(var) => var.lookup(db.upcast()).parent.into(),
|
||||
Self::ConstId(id) => id.into(),
|
||||
Self::StaticId(id) => id.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue