Commit graph

110 commits

Author SHA1 Message Date
Niko Matsakis
f1d318a279
Merge pull request #450 from DropDemBits/placement-new-jars
Initialize jars in-place
2023-11-09 10:25:26 +00:00
Yoshitomo Nakanishi
b295f5aef7 Remove unnecessary mut from make_fn_return_ref 2023-10-08 20:41:55 +02:00
DropDemBits
f1a141a6c0
Update "Jars and Ingredients" to reflect the in-place init changes 2023-06-18 00:13:54 -04:00
DropDemBits
5b8412656c
Initialize jars in-place
Requires unsafe, since Rust currently doesn't have built-in
support for guaranteed in-place initialization. Unfortunately,
this unsafety propagates to making `Jar` unsafe to implement
in order to guarantee that the jar is initialized, but since
the preferred way to implement it is via `salsa::jar`, this
won't impact most users.
2023-06-14 01:09:58 -04:00
DropDemBits
7c8647e572
Allow clippy::needless_lifetimes on tracked method getters
Previously, this would necessitate having to manually add an allow for this
clippy lint, since an extra `'db` lifetime was added to the signature.
2023-03-15 09:56:00 -04:00
Jake Heinz
dd10b16964 salsa 2022: fix input macro set_* being off by one if id field present 2022-11-04 23:39:35 +00:00
XFFXFF
1ae6a7bbc5 use Assigned insread of Field and remove Field 2022-09-24 23:59:25 +00: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
bed692e50e simplify and avoid duplication 2022-09-13 18:01:21 +02: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
OLUWAMUYIWA
42a996dd8d added singleton to tecked_fn AllowedOptions impl 2022-09-11 09:22:09 +01:00
Onigbinde Oluwamuyiwa Elijah
fac05b3c9f
Merge branch 'salsa-rs:master' into singleton 2022-09-11 09:12:17 +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]
bd7f27d72b
Merge #406
406: no need to generate a config struct for each field of `salsa::input` r=nikomatsakis a=XFFXFF

https://github.com/salsa-rs/salsa/pull/342 added `InputFieldIngredient` which replaces the `FunctionIngredient` for `salsa::input`, so we don't need to generate a config struct and `salsa::function::Configuration` impl for each field, beacuse they are only needed when we use `FunctionIngredient`

Co-authored-by: XFFXFF <1247714429@qq.com>
2022-09-05 10:49:33 +00: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
XFFXFF
b55caff4ec no need to generate a config struct and corresponding impls for each field of salsa::input 2022-09-05 14:10:46 +08: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
975fc9d4ab ran cargo fmt 2022-09-03 14:32:42 +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
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
Mihail Mihov
55f20344d1 Use visibility of field in SalsaField in #[salsa::interned] getters 2022-08-31 23:49:09 +03:00
Mihail Mihov
3df74dc0ac Use visibility of field in SalsaField in #[salsa::tracked] struct getters and setters 2022-08-31 23:48:53 +03:00
Mihail Mihov
784828ec42 Use visibility of field in SalsaField in #[salsa::input] getters and setters 2022-08-31 22:59:37 +03:00
Mihail Mihov
3542f2a1e7 Add methods in SalsaField and SalsaStruct to get visibility of field 2022-08-31 22:58:56 +03:00
Bernardo Uriarte
fd71561981 reduce amount of generated code for DebugWithDb
by moving part of it to `salsa-2022`
2022-08-30 18:03:18 +02: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
Bernardo Uriarte
b14d12ada9 avoid warnings in generated code 2022-08-26 18:51:51 +02:00
bors[bot]
6ee0889948
Merge #383
383: Have users of `SalsaStruct` specify allowed options r=XFFXFF a=DropDemBits

This allows adding new options exclusively to `tracked`, `input`, `interned`, or any combination of them, without having to add support code to `SalsaStruct`.

The motivating example is #337, where `input` needs to accept a new `singleton` option, but `tracked` and `interned` should reject it.

Co-authored-by: DropDemBits <r3usrlnd@gmail.com>
2022-08-25 23:39:01 +00:00
DropDemBits
62f0ceb665 Run cargo fmt 2022-08-25 13:19:57 -04:00
bors[bot]
5c63715a95
Merge #381
381: fix typos r=nikomatsakis a=Aadamandersson



Co-authored-by: Adam Andersson <adam.m.andersson@gmail.com>
2022-08-25 10:34:44 +00: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
DropDemBits
5927ae23a3 Have users of SalsaStruct specify allowed options 2022-08-25 01:48:34 -04:00
XFFXFF
e86252d051 add synthetic_write to salsa::Database 2022-08-25 06:13:12 +08:00
Adam Andersson
18507f2ff7 fix some typos 2022-08-24 21:12:58 +02:00
andrzej.gluszak
73102b1e8e Fix clippy issues 2022-08-24 18:45:53 +02:00
XFFXFF
f5b0ff59d3 add runtime_mut and synthetic_write to HasJarsDyn 2022-08-24 20:01:00 +08:00
Andrzej Głuszak
8e27ecd098 Fix formatting 2022-08-24 00:10:07 +02:00
Andrzej Głuszak
fdc8018234 Cleanup 2022-08-23 23:38:19 +02:00
Andrzej Głuszak
43cd95fe47 Derive DebugWithDb 2022-08-23 23:26:07 +02: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