Commit graph

159 commits

Author SHA1 Message Date
Jonas Schievink
197b01fa4b Implement "opinionated cancellation" 2021-05-17 18:59:28 +02:00
Aleksey Kladov
9e6adc9900 Publish v0.16.0
- #242 allow `dyn Database` to be non-'static
- #248 allow using borrowed keys for invalidation
- #250 upgrade crossbeam_utils
2020-10-14 12:33:39 +02:00
Aleksey Kladov
6b96a1e22f Leverage Cargo defaults 2020-10-14 12:29:29 +02:00
Niko Matsakis
2e2239a307
Merge pull request #242 from Marwes/lift_static_restriction
feat: Allow the dynamic db to be non-static
2020-09-09 10:52:50 -04:00
Aleksey Kladov
590c037323 Release v0.15.2
* #243, better error message from proc macro
* #240, purge method for cleaning the database completely
2020-08-05 13:55:12 +02:00
Chase Wilson
78b32d69da
Made proc-macros panic less
Replaced the panics in query_group with syn errors for better user feedback and experience
2020-07-25 14:38:13 -05:00
Markus Westerlind
3a84a77ebc Remove some unnecessary changes 2020-07-24 11:23:41 +02:00
Markus Westerlind
e2ab6c8bfa feat: Allow the dynamic db to be non-static 2020-07-23 17:08:06 +02:00
Markus Westerlind
ce6428fbbd Lift the static restriction on the traits 2020-07-23 11:34:20 +02:00
Aleksey Kladov
380c4c1dc8 Release v0.15.0
The single (but big) change is Dynamic Database RFC implementation:

https://github.com/salsa-rs/salsa/pull/231
2020-07-07 15:45:39 +02:00
Niko Matsakis
fd036a4f15 do not generate in_db_mut when it is inappropriate 2020-07-06 21:48:14 +00:00
Niko Matsakis
d2e9f64bda add shims for input queries 2020-07-06 21:48:07 +00:00
Niko Matsakis
9596c25b77 move the shims into private, hidden functions 2020-07-06 21:06:36 +00:00
Aleksey Kladov
a5626cd8a0 Force codegen in the query-defning crate 2020-07-06 21:04:07 +00:00
Niko Matsakis
b66eb81311 experiment: extract some Memo code to be independent from Q
This should enable more sharing and less monomorphization. There is
probably room for more radical restructing in this vein.
2020-07-06 00:55:01 +00:00
Niko Matsakis
8ca3ab56b5 update the mdbook documentation, introducing a diagram 2020-07-05 16:45:07 +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
d64dfa1727 make for_each_query dyn-safe 2020-07-04 14:17:11 +00:00
Niko Matsakis
0e5366df5d move to QueryType.in_db(&db) instead of db.query(QueryType)
This will be more compatible once we move to having queries have an
associated `DynDb` type. It also reads nicely.
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
b3ffaec3b0 remove salsa::requires feature 2020-07-04 14:16:50 +00:00
Niko Matsakis
64f3eb96a1 remove GroupKey associated type 2020-07-04 14:16:50 +00:00
Niko Matsakis
1a07944efe remove DatabaseKey associated type 2020-07-04 14:16:50 +00:00
Niko Matsakis
799ddce157 remove unused GroupData associated type 2020-07-04 14:16:50 +00:00
Niko Matsakis
1b778760ae track and report cycles using DatabaseKeyIndex 2020-07-04 14:16:50 +00:00
Niko Matsakis
7b5ac6e717 implement ability to get readable debug output for DatabaseKeyIndex 2020-07-04 14:16:50 +00:00
Niko Matsakis
5a1bf10ba6 add a query_name associated constant 2020-07-04 14:16:50 +00:00
Niko Matsakis
07623fb962 remove the DatabaseData and associated unsafe code 2020-07-04 14:16:50 +00:00
Niko Matsakis
f7a14f2309 use DatabaseKeyIndex instead of Dependency 2020-07-04 14:16:49 +00:00
Niko Matsakis
206c086bac thread group index to storage initializers 2020-07-04 14:16:14 +00:00
Niko Matsakis
9bd9f8b202 use new with index to create group storage 2020-07-04 14:16:14 +00:00
Niko Matsakis
ebb3769ad2 document the database macro 2020-06-26 22:21:54 +00:00
Edwin Cheng
38e708b68b Fix typo 2020-05-08 14:35:48 +02:00
Veetaha
2c44b6e3a3 Fix typo
Fix typo
2020-02-24 12:50:39 +01:00
Aleksey Kladov
37a3650aef Publish 0.14.1
0.14.0 is broken, as it didn't bump salsa-macros crate.
2019-11-26 11:24:23 +03:00
Niko Matsakis
c789219bc5 move query-storage into an Arc
This way, we can hold a reference to it without borrowing the database.
2019-09-27 05:34:33 -04:00
Niko Matsakis
a9860bf37f
Merge pull request #147 from Marwes/cycles
feat: Allow queries to avoid panics on cycles
2019-09-19 05:56:39 -04:00
Aleksey Kladov
04ecedd6ec ⬆️ syn, quote, proc_macro2 2019-08-22 16:21:46 +03:00
Markus Westerlind
897ee5f3d2 cargo fmt 2019-08-21 10:13:08 +02:00
Markus Westerlind
0e01067d55 feat: Allow queries to avoid panics on cycles
Quickest POC I could create to get some potentially cyclic queries to
not panic and instead return a result I could act on. (gluon's module
importing need to error on cycles).

```
// Causes `db.query()` to actually return `Result<V, CycleError>`
fn query(&self, key: K, key2: K2) -> V;
```

A proper implementation of this would likely return
`Result<V, CycleError<(K, K2)>>` or maybe larger changes are needed.

cc #6
2019-08-16 20:37:54 +02:00
Niko Matsakis
a0a6bac5af modify public API to set_foo_with_durability 2019-07-02 07:49:01 -04:00
Niko Matsakis
e7d704dd8b convert DatabaseSlot to unsafe trait
The unsafe impl now asserts that the `DatabaseSlot` implementor type
is indeed `Send+Sync` if `DB::DatabaseData` is `Send+Sync`. Since our
query keys/values are a part of database-data, this means that `Slot`
must be `Send+Sync` if the key/value are `Send+Sync`. We test this
with a function that will cause compliation to fail if we accidentally
introduce an `Rc<T>` etc.
2019-07-02 06:49:24 -04:00
Niko Matsakis
579e093213 generate a DatabaseData tuple that collects all the key, values 2019-07-02 06:49:24 -04:00
Niko Matsakis
9d550a9343 track dependencies via direct links to slots 2019-07-02 06:49:24 -04:00
Aleksey Kladov
6d60798eb8 Replace volatile query type with report_untracked_read fn 2019-06-26 13:10:44 +03:00
Niko Matsakis
3534d18c64
Merge pull request #178 from matklad/authors
Change authors to Salsa developers
2019-06-26 06:07:35 -04:00
Aleksey Kladov
10500c8a24 Change authors to Salsa developers
Salsa is a team effort, and builds on a mountain of pre-existing
knowledge!
2019-06-25 13:49:20 +03:00
Aleksey Kladov
149b5faf8a Actually document salsa::requires 2019-06-19 20:12:02 +03:00
Niko Matsakis
e9c787e2b6
Merge pull request #165 from matklad/requires
allow private requirements in query groups
2019-05-30 11:49:41 +02:00
Aleksey Kladov
df92fb794e publish v0.12.1
- Introduce `salsa::transparent` query type(#163)
- Improve salsa proc macro (#160, #162)
- Update parking lot to 0.8.0 (#166)
2019-05-30 11:45:56 +03:00
Aleksey Kladov
6ea5413ef5 switch requires syntax to an attribute 2019-05-21 18:49:18 +03:00
Aleksey Kladov
c816df7208 extract attribute filtering 2019-05-21 18:30:19 +03:00
Aleksey Kladov
940eed92a6 allow private requirements in query groups 2019-05-21 18:04:01 +03:00
Niko Matsakis
8aa01bcccb
Merge pull request #163 from matklad/transparent
Add transparent query type
2019-05-07 11:51:30 -04:00
Aleksey Kladov
fe295c1b6e Add transparent query type
Transparent queries are not really queries: they are just plain
uncached functions without any backing storage.

Making a query transparent can be useful to figure out if caching it
at all is a win
2019-04-30 23:42:17 +03:00
Taryn
9913b0300e
Remove mention of unsupported '&mut self' for in a query group panic 2019-04-12 16:27:24 -05:00
Roberto Vidal
01c03b85b1 Improve doc comments 2019-04-06 14:23:02 +02:00
Niko Matsakis
30b95dcc24 publish v0.12.0
- Introduce `InternId` as the basis for interned keys, replacing
  `u32` (#157, #158)
- Support keys/values that are not `Send/Sync` (#153)
2019-04-03 16:03:41 -03:00
Niko Matsakis
4b976166fd release 0.11.1
- Includes a fix so that interned keys can be send (#155)
2019-03-27 09:24:55 -04:00
Niko Matsakis
31235aaa96 release 0.11.0
Changes:

- Add interned keys to salsa (#150) -- see salsa-rs/salsa-rfcs#2
  for more details.
- Fix bugs re: GC and volatile queries
- Optimization for GC (#144), though I think this later got undone
  as part of the bug fixes =)
2019-03-27 05:37:26 -04:00
Niko Matsakis
f0d2b964e2 bump syn to 0.15.29
(older versions didn't have the `syn::Result` type, it seems?)
2019-03-22 18:40:35 -04:00
Niko Matsakis
f9fe9e4f07 add missing HasQueryGroup 2019-03-13 05:34:56 -04:00
Niko Matsakis
f48515747c create a true inverse key for the lookup path 2019-03-12 08:55:37 -04:00
Niko Matsakis
e3f5eb6ee8 implement #[salsa::interned] query storage 2019-02-03 20:45:52 +01:00
Niko Matsakis
1736115d9f release 0.10.0
- GC API now more orthogonal + flexible (#138)
- Removed `set_unchecked` testing mechanism (#141)
- Generated enums now squelch `non_camel_case_types` lint (#135)
- Tests now using `set_foo` (#139)
- `Query::group_storage` now called `Query::query_storage` (#142)

Contributors to this release:

- @matklad
- @memoryruins
- @nikomatsakis
2019-01-28 05:06:54 -05:00
Niko Matsakis
58ba8ac425 rename Query::group_storage method to Query::query_storage 2019-01-28 05:01:53 -05:00
Niko Matsakis
1b9aaf2599
Merge pull request #135 from nikomatsakis/non-camel-case-types
apply `non_camel_case_types` to the enum variant
2019-01-26 08:01:35 -05:00
Niko Matsakis
0f2e03d120 apply non_camel_case_types to the enum variant 2019-01-25 19:17:32 -05:00
Niko Matsakis
682c29e777 publish v0.10.0-alpha5
- Make `dyn Trait` implementations work

Contributors to this release:

- @nikomatsakis
2019-01-25 19:09:10 -05:00
Niko Matsakis
6f15a440ca make dyn Trait query implementations work 2019-01-25 18:36:23 -05:00
Niko Matsakis
77c3a72cea Release salsa-0.10.0-alpha4
- Introduce requirement for group storage structs (#130)
- Manually implement Default (#131)

Contributors to this release:

- @cormacrelf
- @nikomatsakis
2019-01-25 11:01:15 -05:00
Niko Matsakis
1b04ac19ff
Merge pull request #131 from cormacrelf/bad-derive-default
Manually implement Default for *GroupStorage
2019-01-25 11:01:01 -05:00
Cormac Relf
868904874a manually implement Default for *GroupStorage
All the example code uses Default to create the db structs, but it turns
out the *GroupStorage's `#[derive(Default)]` adds a trait bound of
(e.g.) `DB__ + Default + HelloWorldDatabase` even though it never
actually needs to call HelloWorldDatabase::default(). So if you didn't
implement Default, then you couldn't be a salsa database struct.
2019-01-26 02:45:07 +11:00
Niko Matsakis
1382495d9f drive-by change: use salsa:: in place of ::salsa::
This is less precise, but it permits people to "re-export" salsa without
forcing a Cargo.toml dependency.
2019-01-25 10:37:59 -05:00
Niko Matsakis
9b5c7eeb5e change #[salsa::query_group] attribute to take a struct name 2019-01-25 10:26:39 -05:00
Niko Matsakis
690a118472 consolidate into one HasQueryGroup trait 2019-01-25 09:21:11 -05:00
Aleksey Kladov
4f3b730572 fix alpha 2019-01-25 14:30:03 +03:00
Niko Matsakis
a468292984 generate set_X and set_constant_X methods for each input
Convert some of the tests to use them
2019-01-25 05:18:26 -05:00
Niko Matsakis
a8d9fb2d6b adopt salsa::database attribute macro 2019-01-24 19:02:56 -05:00
Niko Matsakis
1528746267 adopt key, group key, and database key terminology 2019-01-24 06:33:02 -05:00
Niko Matsakis
6451c820b7 rename fns to group_foo 2019-01-24 05:50:13 -05:00
Niko Matsakis
c0978fede8 remove the need to list individual queries in database_storage 2019-01-24 05:35:57 -05:00
Niko Matsakis
8ad5051a74 make the QueryTable impl totally generic 2019-01-24 05:29:04 -05:00
Niko Matsakis
2924e98f40 add GroupStorage, GroupDescriptor to Query trait 2019-01-24 05:22:31 -05:00
Niko Matsakis
1c415b0c9d rename FromQueryGroupDescriptor and add comments 2019-01-24 05:18:43 -05:00
Niko Matsakis
860a1ab1bf add new trait bounds 2019-01-24 05:06:03 -05:00
Niko Matsakis
87dd14293e remove extra bounds from trait 2019-01-24 05:04:56 -05:00
Niko Matsakis
19d64fd281 add FromQueryGroupDescriptor trait and implement/use it 2019-01-23 11:57:03 -05:00
Niko Matsakis
f3483d1a22 defer for-each-query to the query-group 2019-01-23 10:56:01 -05:00
Niko Matsakis
c18914ae1e introduce query group descriptor enum and use in database_storage 2019-01-23 10:31:28 -05:00
Niko Matsakis
6cfaf021b0 introduce the GetQueryGroupStorage trait and use it 2019-01-23 08:52:31 -05:00
Niko Matsakis
af358ecdab replace the storage tuple with a struct
Tuples only implement Default up to arity 12.
2019-01-23 08:31:08 -05:00
Niko Matsakis
238be96432 introduce group storage structs to use from database_storage macro
This also detected a bunch of crate visibility mismatches in the
tests.
2019-01-23 05:35:07 -05:00
Niko Matsakis
e284706363 remove doctest 2019-01-21 10:59:48 -05:00
Niko Matsakis
5f9309f108 remove database_storage macro-rules macro 2019-01-21 10:59:47 -05:00
Niko Matsakis
b8311f2a28 silence dead code warning 2019-01-21 10:59:12 -05:00
Cormac Relf
857181dd17 add attributes and visibility, fix ::salsa, hide some docs 2019-01-21 10:59:12 -05:00
Cormac Relf
3b15a09b8e replace $crate with salsa in proc macro and make hello_world run 2019-01-21 10:59:12 -05:00
Cormac Relf
1526206e4b recreate the rest of the impls as proc macro 2019-01-21 10:59:12 -05:00
Niko Matsakis
3db31cdbc0 create more impls 2019-01-21 10:59:11 -05:00