Save a bit on empty item trees by deduplicating them

This commit is contained in:
Lukas Wirth 2024-06-23 16:13:01 +02:00
parent 3168ab5b99
commit 5548aecdca
8 changed files with 76 additions and 43 deletions

View file

@ -188,7 +188,7 @@ 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(GenericDefId::from(
TyKind::FnDef(callable, ..) => Some(GenericDefId::from_callable(
db.upcast(),
db.lookup_intern_callable_def(callable.into()),
)),