mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 12:59:12 +00:00
Split out salsa_macros
Does not do much yet due to tracing pulling syn but oh well
This commit is contained in:
parent
9fa647c129
commit
996d6ed1a3
25 changed files with 63 additions and 48 deletions
|
|
@ -84,7 +84,7 @@ impl LangItemTarget {
|
|||
}
|
||||
|
||||
/// Salsa query. This will look for lang items in a specific crate.
|
||||
#[salsa::tracked(return_ref)]
|
||||
#[salsa_macros::tracked(return_ref)]
|
||||
pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangItems>> {
|
||||
let _p = tracing::info_span!("crate_lang_items_query").entered();
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ pub fn crate_lang_items(db: &dyn DefDatabase, krate: Crate) -> Option<Box<LangIt
|
|||
|
||||
/// Salsa query. Look for a lang item, starting from the specified crate and recursively
|
||||
/// traversing its dependencies.
|
||||
#[salsa::tracked]
|
||||
#[salsa_macros::tracked]
|
||||
pub fn lang_item(
|
||||
db: &dyn DefDatabase,
|
||||
start_crate: Crate,
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ pub enum ItemContainerId {
|
|||
impl_from!(ModuleId for ItemContainerId);
|
||||
|
||||
/// A Data Type
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum AdtId {
|
||||
StructId(StructId),
|
||||
UnionId(UnionId),
|
||||
|
|
@ -563,7 +563,7 @@ pub enum AdtId {
|
|||
impl_from!(StructId, UnionId, EnumId for AdtId);
|
||||
|
||||
/// A macro
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum MacroId {
|
||||
Macro2Id(Macro2Id),
|
||||
MacroRulesId(MacroRulesId),
|
||||
|
|
@ -619,7 +619,7 @@ impl_from!(
|
|||
|
||||
/// A constant, which might appears as a const item, an anonymous const block in expressions
|
||||
/// or patterns, or as a constant in types with const generics.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum GeneralConstId {
|
||||
ConstId(ConstId),
|
||||
StaticId(StaticId),
|
||||
|
|
@ -656,7 +656,7 @@ impl GeneralConstId {
|
|||
}
|
||||
|
||||
/// The defs which have a body (have root expressions for type inference).
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum DefWithBodyId {
|
||||
FunctionId(FunctionId),
|
||||
StaticId(StaticId),
|
||||
|
|
@ -701,7 +701,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::Supertype)]
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum GenericDefId {
|
||||
AdtId(AdtId),
|
||||
// consts can have type parameters from their parents (i.e. associated consts of traits)
|
||||
|
|
@ -790,7 +790,7 @@ impl From<AssocItemId> for GenericDefId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, PartialOrd, Ord, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum CallableDefId {
|
||||
FunctionId(FunctionId),
|
||||
StructId(StructId),
|
||||
|
|
@ -906,7 +906,7 @@ impl From<VariantId> for AttrDefId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Supertype)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa_macros::Supertype)]
|
||||
pub enum VariantId {
|
||||
EnumVariantId(EnumVariantId),
|
||||
StructId(StructId),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use crate::{
|
|||
src::HasSource,
|
||||
};
|
||||
|
||||
#[salsa::db]
|
||||
#[salsa_macros::db]
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct TestDB {
|
||||
storage: salsa::Storage<Self>,
|
||||
|
|
@ -44,7 +44,7 @@ impl Default for TestDB {
|
|||
}
|
||||
}
|
||||
|
||||
#[salsa::db]
|
||||
#[salsa_macros::db]
|
||||
impl salsa::Database for TestDB {
|
||||
fn salsa_event(&self, event: &dyn std::ops::Fn() -> salsa::Event) {
|
||||
let mut events = self.events.lock().unwrap();
|
||||
|
|
@ -63,7 +63,7 @@ impl fmt::Debug for TestDB {
|
|||
|
||||
impl panic::RefUnwindSafe for TestDB {}
|
||||
|
||||
#[salsa::db]
|
||||
#[salsa_macros::db]
|
||||
impl SourceDatabase for TestDB {
|
||||
fn file_text(&self, file_id: base_db::FileId) -> FileText {
|
||||
self.files.file_text(file_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue