mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Enum variants are not generic def ids
This commit is contained in:
parent
3432ef4414
commit
3168ab5b99
22 changed files with 188 additions and 178 deletions
|
@ -188,9 +188,10 @@ impl TyExt for Ty {
|
|||
fn as_generic_def(&self, db: &dyn HirDatabase) -> Option<GenericDefId> {
|
||||
match *self.kind(Interner) {
|
||||
TyKind::Adt(AdtId(adt), ..) => Some(adt.into()),
|
||||
TyKind::FnDef(callable, ..) => {
|
||||
Some(db.lookup_intern_callable_def(callable.into()).into())
|
||||
}
|
||||
TyKind::FnDef(callable, ..) => Some(GenericDefId::from(
|
||||
db.upcast(),
|
||||
db.lookup_intern_callable_def(callable.into()),
|
||||
)),
|
||||
TyKind::AssociatedType(type_alias, ..) => Some(from_assoc_type_id(type_alias).into()),
|
||||
TyKind::Foreign(type_alias, ..) => Some(from_foreign_def_id(type_alias).into()),
|
||||
_ => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue