Commit graph

99 commits

Author SHA1 Message Date
XFFXFF
a1db7d4e84 add a test 2022-09-24 23:59:25 +00:00
XFFXFF
99cfca5799 add the fields of tracked struct to the output of queries 2022-09-24 23:59:25 +00:00
XFFXFF
4c4096e39b panic when reading fields of tracked structs from older revisions 2022-09-24 23:59:25 +00:00
armoha
9fc958bb1d update compile-fail test .stderr message 2022-09-24 14:40:02 +09:00
OLUWAMUYIWA
0f21bf0fd8 made singleton struct panic upon duplication and added tests to immutable fields 2022-09-16 14:53:56 +01:00
Onigbinde Oluwamuyiwa Elijah
e3661de899
Merge branch 'salsa-rs:master' into immutable_fields_in_inputs 2022-09-16 01:53:42 +01:00
Jack Rickard
f1499a20e2
Fix unsoundness in input_field.rs 2022-09-15 21:25:54 +01:00
Jack Rickard
5b8464c4f9
Support on-demand inputs
This adds initial support for on-demand inputs by allowing new inputs to
be created with only a shared reference to the database. This allows
creating new inputs during a revision and therefore from inside tracked
functions.
2022-09-15 21:25:53 +01:00
OLUWAMUYIWA
32f0ce0cff better debugging for input structs by including id fields 2022-09-14 14:45:59 +01:00
Bernardo Uriarte
3f74f36418 format 2022-09-13 18:01:21 +02:00
Bernardo Uriarte
84445d5120 propagate include_all_fields option 2022-09-13 18:01:21 +02:00
Bernardo Uriarte
f4c6f4126e make DebugWithDb::debug only read identiy fields
and add `DebugWithDb::debug_all` which reads all fields
2022-09-13 18:01:19 +02:00
Onigbinde Oluwamuyiwa Elijah
fac05b3c9f
Merge branch 'salsa-rs:master' into singleton 2022-09-11 09:12:17 +01:00
OLUWAMUYIWA
7f691e3907 fixed difference in .stderr files 2022-09-07 22:19:05 +01:00
Onigbinde Oluwamuyiwa Elijah
a2fbd1c09e
Merge branch 'salsa-rs:master' into exhaustive-macros-test 2022-09-07 21:39:28 +01:00
OLUWAMUYIWA
08449c61b4 eshaustive tests to check salsa macros using the trybuild tool 2022-09-07 20:09:33 +01:00
Jack Rickard
5832ad3090
Replace () with Singleton Salsa struct 2022-09-06 00:34:00 +01:00
Jack Rickard
a9e24d8b0d
Allow "constant" tracked functions
This adds support for tracked functions with only a database as input,
that is, it does not take a salsa struct.
2022-09-06 00:33:43 +01:00
bors[bot]
e0d07812fa
Merge #392
392: Allow creation of tracked methods r=nikomatsakis a=Skepfyr

Fixes #319.

This allows users to annotate impl blocks with `#[salsa::tracked]` and
then create tracked methods by marking individual functions with
`#[salsa::tracked]`.

Note this requires your code that looks like:
```rust
#[salsa::tracked(jar = Jar)]
impl MyInput {
    #[salsa::tracked]
    fn tracked_fn(self, db: &dyn Db) -> u32 {
        self.field(db) * 2
    }
}
```
You get an error if you annotate a method with `#[salsa::tracked]` but forget to mark the impl block.

It got messier than I was hoping but I think it turned out alright, this would look really pretty if we had [inherent associated types](https://github.com/rust-lang/rust/issues/8995), but we don't. Annoyingly even if that landed I think we'd still need the attribute on the impl block just so that it was possible to create the associated struct somewhere as you can't put types inside an impl block (and they aren't accessible if placed inside a function).

Co-authored-by: Jack Rickard <jack.rickard@outlook.com>
2022-09-05 10:44:51 +00:00
Jack Rickard
bac4c668cf
Add more tests for tracked methods 2022-09-03 15:44:56 +01:00
Onigbinde Oluwamuyiwa Elijah
aa25761bd4
Merge branch 'salsa-rs:master' into singleton 2022-09-03 14:37:27 +01:00
OLUWAMUYIWA
25809151dd removed AllowedMode trait and added compile-fail tests 2022-09-02 13:09:28 +01:00
OLUWAMUYIWA
3ca70e6b04 cargo fmt 2022-09-02 03:02:51 +01:00
OLUWAMUYIWA
565c53d4dd Support singleton inputs 2022-09-02 02:54:21 +01:00
Mihail Mihov
0a3b74da57 Add compile-fail test for getter and setter visibility 2022-09-02 03:19:21 +03:00
Jack Rickard
2df88d2c33
Use #[salsa::tracked] for tracked methods
This changes tracked methods from being annotated with `#[tracked]` to
`#[salsa::tracked]`. This improves consistency and allows outputting a
nicer error message if someone forgets to put the attribute on the impl
block.
2022-08-31 23:30:49 +01:00
bors[bot]
1cabfdb077
Merge #390
390: Add some doc on `specify` r=nikomatsakis a=XFFXFF

Add some documentation to explain why `specify` only works if the key is a tracked struct created in the current query, as per [this](https://salsa.zulipchat.com/#narrow/stream/146365-good-first-issue/topic/questions.20about.20.60specify.60/near/295416521) zulip thread.  
I also added some tests to test that "specify" shouldn't work in some cases.

Co-authored-by: XFFXFF <1247714429@qq.com>
2022-08-30 10:17:28 +00:00
Jack Rickard
dbc4154419
Allow creation of tracked methods
This allows users to annotate impl blocks with `#[salsa::tracked]` and
then create tracked methods by marking individual functions with
`#[tracked]`.
2022-08-28 23:28:30 +01:00
XFFXFF
cece3d840a run compile_fail test only on stable 2022-08-27 16:01:04 +08:00
XFFXFF
f7519acb13 add a test for specify
`specify` does not work if the key is a `salsa::interned`
2022-08-27 07:51:35 +08:00
XFFXFF
82a6251ebc add a test for specify
`specify` does not work if the key is a `salsa::input`
2022-08-27 07:05:35 +08:00
XFFXFF
8e53905b87 add a test for specify
`specify` only works if the key is created in the current query.
2022-08-27 06:44:36 +08:00
Bernardo Uriarte
b14d12ada9 avoid warnings in generated code 2022-08-26 18:51:51 +02:00
bors[bot]
63fb4ad24c
Merge #376 #379
376: add `synthetic_write` r=nikomatsakis a=XFFXFF

fixes #364 

add `synthetic_write` and use it in test `lru_keeps_dependency_info`, the test will now be broken. We can use `lru_keeps_dependency_info` as a test for https://github.com/salsa-rs/salsa/issues/365, which already has a pr https://github.com/salsa-rs/salsa/pull/371.

379: Update test.yml r=nikomatsakis a=agluszak

- Add names to steps
- No need to run clippy AND check (https://stackoverflow.com/questions/57449356/is-cargo-clippy-a-superset-of-cargo-check)
- Run clippy on all targets with all features
- Fix issues reported by clippy

Co-authored-by: XFFXFF <1247714429@qq.com>
Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
Co-authored-by: andrzej.gluszak <andrzej.gluszak@mpi-sp.org>
2022-08-25 10:30:34 +00:00
XFFXFF
8e754ec0d7 add report_untracked_read to salsa::Database 2022-08-25 06:30:27 +08:00
XFFXFF
e86252d051 add synthetic_write to salsa::Database 2022-08-25 06:13:12 +08:00
XFFXFF
2dc5a6c796 remove salsa_runtime 2022-08-25 06:01:23 +08:00
andrzej.gluszak
73102b1e8e Fix clippy issues 2022-08-24 18:45:53 +02:00
XFFXFF
0e0626abfa writes with jars_mut 2022-08-24 20:17:13 +08:00
XFFXFF
6776919f39 give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
XFFXFF
f5b0ff59d3 add runtime_mut and synthetic_write to HasJarsDyn 2022-08-24 20:01:00 +08:00
XFFXFF
ea0df0fc03 impl runtime_mut for test in debug.rs 2022-08-24 19:04:35 +08:00
XFFXFF
2912e60938 impl salsa_runtime_mut for all the tests 2022-08-24 19:00:21 +08:00
XFFXFF
340e2d521d add synthetic write 2022-08-24 19:00:21 +08:00
bors[bot]
38c9b612dd
Merge #378
378: Derive DebugWithDb r=nikomatsakis a=agluszak

Closes #317 

Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
2022-08-24 10:37:09 +00:00
Andrzej Głuszak
0c3084d009 Test cleanup 2022-08-24 00:01:44 +02:00
Andrzej Głuszak
fbb219a527 Add a test 2022-08-23 23:54:18 +02:00
bors[bot]
9677935c9c
Merge #374
374: Add test for durability r=nikomatsakis a=crlf0710

Fixes #339 .

Co-authored-by: Charles Lew <crlf0710@gmail.com>
2022-08-23 19:23:51 +00:00
Charles Lew
8d956a8229 Add test for durability 2022-08-22 21:50:58 +08:00
bors[bot]
d3f0077d21
Merge #369
369: Try to fix issue#340 r=XFFXFF a=zjp-CN

(WIP) 

Follow the instructions from https://github.com/salsa-rs/salsa/issues/340#issuecomment-1210153085.

Still not sure what to do with `fmt_index`...

Fix #340

Co-authored-by: zjp <jiping_zhou@foxmail.com>
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-08-22 13:42:18 +00:00