Skip to content

Commit

Permalink
update rust-analyzer to new interned struct
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbarsky committed Jan 24, 2025
1 parent 1965cf0 commit c762e4e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
30 changes: 19 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ process-wrap = { version = "8.0.2", features = ["std"] }
pulldown-cmark-to-cmark = "10.0.4"
pulldown-cmark = { version = "0.9.0", default-features = false }
rayon = "1.8.0"
salsa = { git = "https://github.com/davidbarsky/salsa.git", branch = "chayim-david-lukas/salsa-perf-improvements" }
salsa = { git = "https://github.com/davidbarsky/salsa.git", branch = "chayim-david-lukas/salsa-changes-for-ra" }
db-ext-macro = { git = "https://github.com/davidbarsky/db-ext-macro.git", rev = "c88f2f058ac4e6a8a09e87e41d7b30b147235514" }
rustc-hash = "2.0.0"
semver = "1.0.14"
Expand Down
4 changes: 2 additions & 2 deletions crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use vfs::{AbsPathBuf, FileId};
#[macro_export]
macro_rules! impl_intern_key {
($id:ident, $loc:ident) => {
#[salsa::interned_sans_lifetime(no_debug)]
#[salsa::interned(no_debug, no_lifetime)]
pub struct $id {
pub loc: $loc,
}
Expand Down Expand Up @@ -167,7 +167,7 @@ impl Files {
}
}

#[salsa::interned_sans_lifetime]
#[salsa::interned(no_lifetime)]
pub struct EditionedFileId {
pub file_id: FileText,
pub editioned_file_id: span::EditionedFileId,
Expand Down
12 changes: 6 additions & 6 deletions crates/hir-def/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ pub enum ItemContainerId {
impl_from!(ModuleId for ItemContainerId);

/// A Data Type
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum AdtId {
StructId(StructId),
UnionId(UnionId),
Expand All @@ -566,7 +566,7 @@ pub enum AdtId {
impl_from!(StructId, UnionId, EnumId for AdtId);

/// A macro
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum MacroId {
Macro2Id(Macro2Id),
MacroRulesId(MacroRulesId),
Expand Down Expand Up @@ -820,7 +820,7 @@ impl GeneralConstId {
}

/// The defs which have a body.
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum DefWithBodyId {
FunctionId(FunctionId),
StaticId(StaticId),
Expand Down Expand Up @@ -863,7 +863,7 @@ pub enum AssocItemId {
// casting them, and somehow making the constructors private, which would be annoying.
impl_from!(FunctionId, ConstId, TypeAliasId for AssocItemId);

#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum GenericDefId {
FunctionId(FunctionId),
AdtId(AdtId),
Expand Down Expand Up @@ -946,7 +946,7 @@ impl From<AssocItemId> for GenericDefId {
}
}

#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum CallableDefId {
FunctionId(FunctionId),
StructId(StructId),
Expand Down Expand Up @@ -1062,7 +1062,7 @@ impl From<VariantId> for AttrDefId {
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum VariantId {
EnumVariantId(EnumVariantId),
StructId(StructId),
Expand Down
4 changes: 2 additions & 2 deletions crates/hir-expand/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub trait ExpandDatabase: RootQueryDb {
fn syntax_context(&self, file: HirFileId, edition: Edition) -> SyntaxContextId;
}

#[salsa::interned_sans_lifetime(id = span::MacroCallId)]
#[salsa::interned(no_lifetime, id = span::MacroCallId)]
pub struct MacroCallWrapper {
pub loc: MacroCallLoc,
}
Expand All @@ -168,7 +168,7 @@ fn lookup_intern_macro_call(db: &dyn ExpandDatabase, macro_call: MacroCallId) ->
.clone()
}

#[salsa::interned_sans_lifetime(id = span::SyntaxContextId)]
#[salsa::interned(no_lifetime, id = span::SyntaxContextId)]
pub struct SyntaxContextWrapper {
pub data: SyntaxContextId,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ pub enum TyDefId {
}
impl_from!(BuiltinType, AdtId(StructId, EnumId, UnionId), TypeAliasId for TyDefId);

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Enum)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::supertype)]
pub enum ValueTyDefId {
FunctionId(FunctionId),
StructId(StructId),
Expand Down

0 comments on commit c762e4e

Please sign in to comment.