Commit graph

97 commits

Author SHA1 Message Date
CheaterCodes
13a2bd7461
Changed return_ref syntax to returns(as_ref) and returns(cloned) (#772)
* Changed `return_ref` syntax to `returns(as_ref)` and `returns(cloned)`

* Implement

* renamed module for return_mode

* Rename macro, fix docs, add tests, validate return modes

* Cargo fmt

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-05-09 07:28:54 +00:00
Lukas Wirth
cfa88e9a4d
Move salsa event system into Zalsa (#849)
* Move salsa event system into `Zalsa`

* Encode `None` into ShallowUpdate

This shrinks the return value from 16 to 8 bytes
2025-05-07 11:45:49 +00:00
Micha Reiser
f7eea9d69b
Use DatabaseKey for interned events (#813)
* Use `DatabaseKey` for interned events

* Tame clippy
2025-04-24 10:38:46 +00:00
Lukas Wirth
a89e3d2357
chore: Normalize imports style (#779)
* Default impl some ingredient functions

* chore: Normalize imports style

Effectively reformatted everything with
```toml
imports_granularity = "Module"
group_imports = "StdExternalCrate"
reorder_imports = true
```
2025-03-28 05:11:40 +00:00
Lukas Wirth
1bbf4c2be5
feat: Drop Debug requirements and flip implementation defaults (#756) 2025-03-15 15:14:34 +00:00
Lukas Wirth
1dc24388d1
chore: Use nextest for miri test runs (#758) 2025-03-15 10:30:23 +00:00
Bruce Mitchener
d2f2c6bc0b Remove dev dependency derive-new
This was only used for 4 structs in the `calc` example and the
expanded code isn't that large.
2025-02-20 13:13:12 +07:00
Lukas Wirth
8f63476f96 Replace crossbeam dependency with crossbeam-queue 2025-02-11 11:51:51 +01:00
Micha Reiser
acbee94fbe
Use Fallback trick for tracked function Update constraint, implement Update for smallvec and compact_str 2025-02-09 15:48:52 +01:00
Ibraheem Ahmed
9436f8ff6b ensure tracked struct ingredients are mapped correctly to tracked fields 2025-02-03 20:29:49 -05:00
Ibraheem Ahmed
c90c2f2e8a make tracked structs coarse-grained by default 2025-02-03 20:29:48 -05:00
Lukas Wirth
56ac73a538 Clippy 2025-01-31 12:35:21 +01:00
Lukas Wirth
cbd84b5b4b Bump expect-test to 1.5.0, annotate-snippets to 0.11.5 2024-12-13 13:48:59 +01:00
David Barsky
5f0904ae4a introduce parallel salsa 2024-11-25 11:29:24 -05:00
Niko Matsakis
703f312eae port input to use Table 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
a27befeeba run tests with UPDATE_EXPECT=1 2024-08-20 10:09:49 -04:00
David Barsky
0557605cb8 internal: add some initial input benchmarks 2024-08-13 10:38:38 -04:00
Niko Matsakis
cafbe9247b update debug output 2024-08-04 02:22:27 -04:00
Niko Matsakis
4d2ccffddc return to the database-wrapping-storage setup 2024-08-04 02:18:54 -04: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
c50cefa71e upgrade all the things 2024-07-28 10:38:30 +00:00
Niko Matsakis
3d2b2d3a65 remove RuntimeId and use ThreadId 2024-07-23 11:53:37 -04:00
Micha Reiser
6975a47690
Replace derived Debug implementation of salsa::Id 2024-07-22 17:56:16 +02:00
Niko Matsakis
634366f5fa squelch final warnings 2024-07-19 09:50:00 -04:00
Niko Matsakis
e847929536 pacify the merciless clippy 2024-07-19 09:20:41 -04:00
Niko Matsakis
9a432cab31 pacify the merciless cargo fmt 2024-07-19 09:07:47 -04:00
Niko Matsakis
8c948173b0 extend calc with annotated snippets 2024-07-19 08:46:14 -04:00
Niko Matsakis
3304acc5dd wip: accum, privacy for inputs 2024-07-19 07:08:24 -04:00
Niko Matsakis
b267f5c8b1 fixup calc example 2024-07-17 09:25:04 -04:00
Niko Matsakis
612cec6703 wip 2024-07-15 20:29:36 -04:00
Niko Matsakis
4769e32d44 wip 2024-07-15 07:51:40 -04:00
Niko Matsakis
fdc363b65f wip 2024-07-15 07:46:23 -04:00
Matthijs Brobbel
5ba40cf36c
Fix CI and examples 2024-06-18 09:52:37 +02:00
Matthijs Brobbel
c7851112a5
Rename salsa-2022 to salsa 2024-06-18 09:40:21 +02:00
Matthijs Brobbel
db75ae00a2
Remove old salsa 2024-06-18 09:25:26 +02:00
Maxwell Elliot Heiber
145202e376 Remove ': salsa::Database' bound from two examples
Two examples had a superfluous bound
': salsa::Database' that wasn't present
in the `compiler` example.

The `query_group` macro adds this bound
automatically.

This change can lead to a trailing `+` in
the bounds list. I verified this is OK by
running the examples and verifying that the production
is allowed
[per the Rust Reference](https://doc.rust-lang.org/reference/trait-bounds.html)
2021-12-30 11:02:30 +00:00
Tim Robinson
fc6806a07c CI runs Clippy 2021-06-17 15:21:51 +01:00
Niko Matsakis
a557013514 remove some unneeded lifetime parameters
Makes the compiler example read better.
2021-05-15 09:28:24 -04:00
Markus Westerlind
e2ab6c8bfa feat: Allow the dynamic db to be non-static 2020-07-23 17:08:06 +02:00
Niko Matsakis
f0c28c7e30 fix hello-world documentation 2020-07-07 10:05:02 +00:00
Niko Matsakis
fad97eeb6a remove the DB parameter
This had two unexpected consequences, one unfortunate, one "medium":

* All `salsa::Database` must be `'static`. This falls out from
`Q::DynDb` not having access to any lifetimes, but also the defaulting
rules for `dyn QueryGroup` that make it `dyn QueryGroup + 'static`. We
don't really support generic databases anyway yet so this isn't a big
deal, and we can add workarounds later (ideally via GATs).

* It is now statically impossible to invoke `snapshot` from a query,
and so we don't need to test that it panics. This is because the
signature of `snapshot` returns a `Snapshot<Self>` and that is not
accessible to a `dyn QueryGroup` type. Similarly, invoking
`Runtime::snapshot` directly is not possible becaues it is
crate-private. So I removed the test. This seems ok, but eventually I
would like to expose ways for queries to do parallel
execution (matklad and I had talked about a "speculation" primitive
for enabling that).

* This commit is 99% boilerplate I did with search-and-replace. I also
rolled in a few other changes I might have preferred to factor out,
most notably removing the `GetQueryTable` plumbing trait in favor of
free-methods, but it was awkward to factor them out and get all the
generics right (so much simpler in this version).
2020-07-04 14:17:11 +00:00
Niko Matsakis
67687376ed implement the Storage<DB> change 2020-07-04 14:17:10 +00:00
Niko Matsakis
ebb3769ad2 document the database macro 2020-06-26 22:21:54 +00:00
Niko Matsakis
550c0c3db6 document the code we generate for a query group 2020-06-24 11:13:39 +00:00
Vincent Esche
fed9ccce9e Removed unnecessary salsa::requires from compiler example 2019-11-24 11:13:46 +01:00
Vincent Esche
09d9592f14 Improved ‘compiler’ example showing parsing of an actual language and use of actual interning 2019-10-11 16:49:14 +02:00
Niko Matsakis
b9f00726da introduce Database::salsa_runtime_mut method (breaking change!) 2019-09-27 05:49:15 -04:00
Niko Matsakis
2e9b418bbb rework book a little bit
- extend some of the empty sections, add a new common pattern
- also, show how to use anchors and include so we can test the sources
  for common patterns
2019-09-24 06:13:51 -04:00