Commit graph

542 commits

Author SHA1 Message Date
Lukas Wirth
f428a94a9f Split Lookup into two traits 2025-01-04 11:03:11 +01:00
Lukas Wirth
0a5993fe34 Implement self-referential interning 2025-01-04 11:03:11 +01:00
Shoyu Vanilla
2cae1ef5bb Modify struct ingredient lookups 2024-11-15 01:40:45 +09:00
Shoyu Vanilla
fac6053761 Assign memo ingredients per salsa-struct-ingredient 2024-11-14 00:01:05 +09:00
David Barsky
b0fafce5a5
Update components/salsa-macro-rules/src/setup_tracked_fn.rs 2024-11-07 10:36:02 -05:00
Lukas Wirth
842abe5c27 Emit struct in #[tracked] fn last for better IDE support 2024-11-02 18:01:59 +01:00
Niko Matsakis
5eed7e9078
Merge pull request #604 from jhgg/proc-macro-friendliness-for-ra
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
salsa-macros: handle invalid inputs in a way friendlier to rust-analyzer
2024-10-25 11:59:24 +00:00
Lukas Wirth
56b7a23f18 Improve the span used for salsa struct constructors 2024-10-25 12:59:55 +02:00
Jake
10d14f0131
fix cargo fmt 2024-10-24 16:47:44 -07:00
Jake
e0febd904a
salsa-macros: handle invalid inputs in a way friendlier to rust-analyzer 2024-10-24 16:37:28 -07:00
David Barsky
c3de24ce12 chore: ensure salsa-macros have a licence 2024-10-17 17:37:56 -04:00
Shoyu Vanilla
57f38aa84b fix: Inconsistent behaviour with lifetime elision on tracked fn 2024-10-17 01:02:32 +09:00
David Barsky
c6c51a0ea0
Merge pull request #593 from ShoyuVanilla/issue-577
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
fix: Replace `SelfTy` with actual type in tracked methods
2024-10-15 14:33:54 +00:00
gvozdvmozgu
b074f882d9 fix new nightly lint: clippy::unit_arg 2024-10-14 18:22:52 -07:00
Shoyu Vanilla
7e3426e7df Satisfy nightly clippy 2024-10-15 00:49:12 +09:00
Shoyu Vanilla
ad1f84d80f fix: Replace SelfTy with actual type in tracked methods 2024-10-14 02:00:28 +09:00
puuuuh
de95f497ce
fix fmt
Fix clippy warnings
2024-10-10 18:33:50 +03:00
puuuuh
dcdf4d774d
Update components/salsa-macro-rules/src/setup_interned_struct.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2024-10-10 03:43:46 +03:00
puuuuh
1e18334672
Add way to intern structs from references 2024-10-10 03:43:40 +03:00
Micha Reiser
bd8227494d
Satisfy nighty clippy 2024-10-09 18:56:25 +02:00
Andrey Nikolaev
bd2c0036dc
fix error message to correctly reference #[default] instead of #[id] 2024-09-26 15:57:31 -07:00
Micha Reiser
3f93415313
Fix const query with custom database trait 2024-08-20 21:49:30 +02:00
Niko Matsakis
d7af1a85fb simplify Id traits, make new crate-private
`Id` values are used in a very tailored way now, no reason
to let people construct arbitrary ones.
2024-08-20 10:09:49 -04:00
Niko Matsakis
6401563755 store memoized fn results attached to the salsa struct 2024-08-20 10:09:49 -04:00
Niko Matsakis
8833a7168b remove "constant" functions
The goal here is that ALL `Id` values come from a `Table`
2024-08-20 10:09:49 -04:00
Niko Matsakis
703f312eae port input to use Table 2024-08-20 10:09:49 -04:00
Niko Matsakis
403755548b give each function ingredient a memo ingredient index 2024-08-20 10:09:49 -04:00
Niko Matsakis
188f759555 use table for tracked structs and their fields
This also retools a tiny bit how deletion works.
We will reuse ids faster than before, actually.
2024-08-20 10:09:49 -04:00
Niko Matsakis
01d4ef86b2 introduce Table and use for interned values 2024-08-20 10:09:49 -04:00
Niko Matsakis
4657ac3a0d Revert "introduce Table and use for interned values"
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
This reverts commit 9a3111ce27.
2024-08-11 08:04:47 +03:00
Niko Matsakis
9a3111ce27 introduce Table and use for interned values
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
2024-08-08 18:25:06 +03:00
Micha Reiser
fbc7b8c544
Move Builder::new impl out of Configuration::builder method 2024-08-06 08:53:03 +02:00
Micha Reiser
0848b78d90
Add #[must_use] attribute 2024-08-06 08:47:59 +02:00
Micha Reiser
17a2f6b2ca
Add support for [#default] and setting field-level durability 2024-08-06 08:47:57 +02:00
Micha Reiser
632faff5a6
Implement inputs builder 2024-08-06 08:44:12 +02:00
Micha Reiser
d6df21fba1
Merge pull request #557 from MichaReiser/high-durability-write
Some checks are pending
Book / Book (push) Waiting to run
Book / Deploy (push) Blocked by required conditions
Test / Test (false, beta) (push) Waiting to run
Test / Test (false, stable) (push) Waiting to run
Test / Test (true, nightly) (push) Waiting to run
Test / Miri (push) Waiting to run
Test / Benchmarks (push) Waiting to run
Fix query invalidation when high durability input changes
2024-08-05 16:36:21 +00:00
Niko Matsakis
c830be20f2
Merge pull request #549 from obsgolem/fix_warning
Fixed non_local_definitions warning
2024-08-05 16:36:16 +00:00
Micha Reiser
a263dd04ba
Fix query invalidation when high durability input changes 2024-08-05 16:24:39 +02:00
Niko Matsakis
6ff1975e17 Update components/salsa-macro-rules/src/setup_input_struct.rs
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-04 03:05:32 -04:00
Niko Matsakis
4d2ccffddc return to the database-wrapping-storage setup 2024-08-04 02:18:54 -04:00
Josiah Bills
49657a4989 Fixed non_local_definitions warning. 2024-08-01 20:09:13 -04:00
Niko Matsakis
a675810edf move local-state into DatabaseImpl
Each clone gets an independent local state.
2024-07-28 12:47:50 +00:00
Niko Matsakis
138ca4b1f3 merge handle into the database
Separate handles are no longer needed.
2024-07-28 12:47:50 +00:00
Niko Matsakis
daaa78056a switch to new database design
Under this design, *all* databases are a
`DatabaseImpl<U>`, where the `U` implements
`UserData` (you can use `()` if there is none).

Code would default to `&dyn salsa::Database` but
if you want to give access to the userdata, you
can define a custom database trait
`MyDatabase: salsa::Databse` so long as you

* annotate `MyDatabase` trait definition of
  impls of `MyDatabase` with `#[salsa::db]`
* implement `MyDatabase` for `DatabaseImpl<U>`
  where `U` is your userdata (this could be a
  blanket impl, if you don't know the precise
  userdata type).

The `tests/common/mod.rs` shows the pattern.
2024-07-28 12:47:50 +00:00
Niko Matsakis
1842b1dfbb (almost) encansulate Runtime into Zalsa
The distinction is dumb and should go away.
But we still need it for a bit.
2024-07-28 12:35:33 +00:00
Niko Matsakis
596461c213 hide internal methods behind a Zalsa trait
The traits are now quite simple:

* Database is the external trait
* ZalsaDatabase is the internal one, implemented
  by `#[salsa::db]`. It adds two methods,
  `zalsa` and `zalsa_mut`. Those give access
  to our internal methods.

For now I've hidden the methods behind
`&dyn Zalsa`. This is nice and clean but it may
be worth later refactoring to a `struct Zalsa`.
2024-07-28 12:35:33 +00:00
Niko Matsakis
bc72bdf524 as_salsa_database => as_dyn_database
Also, move to a blanket impl'd trait.
Overall cleaner approach.
2024-07-28 12:35:33 +00:00
Niko Matsakis
9e8635c7db remove upcast_mut
We only ever need to upcast to shared references.

This change isn't necessary, just dead code
cleanup.
2024-07-28 12:35:33 +00:00
Niko Matsakis
21af3a2009 move local state into thread local 2024-07-23 21:45:31 -04:00
Niko Matsakis
74ef66dbb4 make tracked structs take db, not runtime 2024-07-23 11:54:55 -04:00