Commit graph

586 commits

Author SHA1 Message Date
Micha Reiser
12e0741252
Implement DerefMut 2024-07-29 10:25:26 +02:00
Niko Matsakis
502716d368 pacify the merciless cargo fmt 2024-07-28 21:33:05 +00:00
Niko Matsakis
ab112b7126 rename local_state to zalsa_local 2024-07-28 13:12:58 +00:00
Niko Matsakis
3254f46ca8 rename LocalState to ZalsaLocal 2024-07-28 13:12:31 +00:00
Niko Matsakis
9054377546 rename storage mod to zalsa 2024-07-28 13:11:57 +00:00
Niko Matsakis
d141cd8500 encapsulate Runtime within Zalsa
The aim is to eventually eliminate Runtime.
2024-07-28 13:10:29 +00:00
Niko Matsakis
703e12def8 remove the Zalsa trait and make it a struct 2024-07-28 13:06:30 +00:00
Niko Matsakis
34e109d390 remove type parameter from ZalsaImpl 2024-07-28 13:01:09 +00:00
Niko Matsakis
85628247e5 pacify the merciless clippy 2024-07-28 12:47:50 +00:00
Niko Matsakis
f8b1620ca7 pacify the merciless cargo fmt 2024-07-28 12:47:50 +00: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
8e9ebbafd3 improve comments 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
62f158742c rename Storage to ZalsaImpl, privatize 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
64556e9d28 make event generation lazy
Creating events if nobody is listening has
always bugged me.
2024-07-28 12:35:33 +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
b0ee16211e
Merge pull request #532 from salsa-rs/fix-guard-assertion
Fix assertion for same DB in `DbGuard`
2024-07-28 09:56:42 +00:00
Micha Reiser
354dc0eff1
Update src/local_state.rs
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2024-07-27 17:24:08 +01:00
Niko Matsakis
8788180155
Merge pull request #531 from salsa-rs/handle-into-inner
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
Add Handle::into_inner method
2024-07-27 09:39:28 +00:00
Micha Reiser
b98434a5e2
Bump revision in db.synthetic_write 2024-07-26 15:56:51 +02:00
Micha Reiser
18faece05e
Fix assertion for same DB in DbGuard 2024-07-26 11:26:19 +02:00
Micha Reiser
c66f600c06
Add Handle::into_inner method 2024-07-26 10:23:56 +02:00
Niko Matsakis
bf636d27ea add a doc comment 2024-07-25 09:33:54 +00:00
Niko Matsakis
246dcab977 fix race condition around dropping arc handle
Sigh, I always make this mistake.
2024-07-25 09:31:06 +00:00
Niko Matsakis
8a3cc6e404 add a test for handle cancellation
I realized there weren't any!
2024-07-24 10:36:07 +00:00
Niko Matsakis
a5395665ce order cycles by debug_name first
We used to sort just by the ingredient index,
but since those are now added dynamically,
that can be fairly unstable in some of the tests.
We now sort by the "debug name" of the ingredient
first, which is more reliably stable.
2024-07-24 10:10:37 +00:00
Niko Matsakis
03a62c8ce5 add debug_name method to ingredient
We can use this to more reliably sort.
2024-07-24 10:06:57 +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
Niko Matsakis
782896772f make interner take database, not runtime 2024-07-23 11:54:55 -04:00
Niko Matsakis
53ccfa3fc3 make input::fields take Database not Runtime 2024-07-23 11:54:55 -04:00
Niko Matsakis
f466228da5 make accumulate take database instead of Runtime
We are going to want to take databases at
public entry points.
2024-07-23 11:54:55 -04:00
Niko Matsakis
3d2b2d3a65 remove RuntimeId and use ThreadId 2024-07-23 11:53:37 -04:00
Niko Matsakis
7c2bbe811e add comments 2024-07-23 11:52:05 -04:00
Niko Matsakis
d0d05ec89c remove some visibility 2024-07-23 11:52:05 -04:00
Niko Matsakis
59dbfc2826 flatten module hierarchy 2024-07-23 11:52:05 -04:00
Niko Matsakis
61b1671b69 remove "debug_probe"
We are using "peek fields" methods instead;
I like that approach better.
2024-07-23 11:52:05 -04:00
Niko Matsakis
4e015483fe remove shared field and inline fields 2024-07-23 11:52:05 -04:00
David Barsky
86f06d8485 chore: use tracing instead of log 2024-07-22 18:02:40 -04:00
Niko Matsakis
f5f21cf55e
Merge pull request #508 from MichaReiser/id-manual-debug-impl
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
Manual `Debug` impl for `salsa::Id`
2024-07-22 19:57:21 +00:00
Niko Matsakis
b8bbf96056
Merge pull request #514 from MichaReiser/update-deps
Update `dashmap`, `hashlink`, and `rustc-hash`
2024-07-22 19:56:32 +00:00
Niko Matsakis
c8234e4fbf
Merge pull request #524 from PhoebeSzmucer/ps/accumulate-chain
Fix accumulator only accumulating direct children
2024-07-22 19:55:58 +00:00
Micha Reiser
6975a47690
Replace derived Debug implementation of salsa::Id 2024-07-22 17:56:16 +02:00
Micha Reiser
151c48b402
Update dashmap, hashlink, and rustc-hash 2024-07-22 15:18:40 +02:00
Niko Matsakis
49a147a627
Update src/function/accumulated.rs 2024-07-22 06:59:39 -04:00
Phoebe Szmucer
02008d51a7 Add a test, fix a bug, refactor 2024-07-22 11:52:55 +01:00