Merge pull request #18074 from ChayimFriedman2/typeref-source-map

internal: Build source map for `hir_def::TypeRef`s
This commit is contained in:
Lukas Wirth 2024-10-28 11:01:12 +00:00 committed by GitHub
commit 80e9d014be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 2511 additions and 929 deletions

View file

@ -2424,8 +2424,8 @@ impl SelfParam {
func_data
.params
.first()
.map(|param| match &**param {
TypeRef::Reference(.., mutability) => match mutability {
.map(|&param| match &func_data.types_map[param] {
TypeRef::Reference(ref_) => match ref_.mutability {
hir_def::type_ref::Mutability::Shared => Access::Shared,
hir_def::type_ref::Mutability::Mut => Access::Exclusive,
},
@ -2751,10 +2751,6 @@ impl TypeAlias {
Module { id: self.id.module(db.upcast()) }
}
pub fn type_ref(self, db: &dyn HirDatabase) -> Option<TypeRef> {
db.type_alias_data(self.id).type_ref.as_deref().cloned()
}
pub fn ty(self, db: &dyn HirDatabase) -> Type {
Type::from_def(db, self.id)
}