Commit graph

1243 commits

Author SHA1 Message Date
XFFXFF
98d1be0650 mark the outputs as valid as we encounter them in deep_verify_memo 2022-09-24 23:59:25 +00:00
XFFXFF
c219944699 merge input/output lists into one list 2022-09-24 23:59:25 +00:00
XFFXFF
a1db7d4e84 add a test 2022-09-24 23:59:25 +00:00
XFFXFF
1ae6a7bbc5 use Assigned insread of Field and remove Field 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
bors[bot]
2ffe4a78a8
Merge #417
417: Fix Chinese book link r=XFFXFF a=armoha

cc `@zjp-CN` 

- Previous link: https://zjp-cn.github.io/salsa
- Fixed link: https://rust-chinese-translation.github.io/salsa-book/

Co-authored-by: armoha <kein0011@naver.com>
2022-09-24 06:16:13 +00:00
armoha
9fc958bb1d update compile-fail test .stderr message 2022-09-24 14:40:02 +09:00
armoha
892d555792
Fix Chinese book link 2022-09-24 01:00:36 +09:00
bors[bot]
07848c2818
Merge #416
416: Correct docs to refer to `#[salsa::cycle]` r=nikomatsakis a=ssbr

Judging by the examples, `recover` is an outdated name.

E.g. https://github.com/salsa-rs/salsa/blob/master/tests/cycles.rs

(I can't really test this on version 0.16, so I'm just going by the examples.)

Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
2022-09-17 11:13:06 +00:00
bors[bot]
0357e53ce9
Merge #414
414: better debugging for input structs by including id fields r=nikomatsakis a=OLUWAMUYIWA

Ref: #405 

Fixes #415 

Co-authored-by: OLUWAMUYIWA <onigbindemy@gmail.com>
Co-authored-by: Onigbinde Oluwamuyiwa Elijah <onigbindemy@gmail.com>
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-09-17 10:44:59 +00:00
Niko Matsakis
684ab6f4fe
Update components/salsa-2022/src/input.rs 2022-09-17 06:44:11 -04:00
OLUWAMUYIWA
4bb4262569 cargo fmt 2022-09-16 15:02:15 +01:00
OLUWAMUYIWA
0f21bf0fd8 made singleton struct panic upon duplication and added tests to immutable fields 2022-09-16 14:53:56 +01:00
Devin Jeanpierre
71c1d2e48e Correct docs to refer to #[salsa::cycle]
Judging by the examples, `recover` is an outdated name.

E.g. https://github.com/salsa-rs/salsa/blob/master/tests/cycles.rs
2022-09-16 11:10:06 +00:00
Onigbinde Oluwamuyiwa Elijah
e3661de899
Merge branch 'salsa-rs:master' into immutable_fields_in_inputs 2022-09-16 01:53:42 +01:00
bors[bot]
3eedb656e0
Merge #404
404: On-demand input r=nikomatsakis a=Skepfyr

Fixes #394 

This is not yet done, but I'd like to get some feedback on the approach.
I think these things are remaining:
- [x] Clean up some now incorrect comments in `input_field.rs`
- [x] ~Update calc-example to use on-demand inputs, and remove the lazy-input example (this is quite fun as you end up with an interactive calculator)~
- [x] Update the book

Co-authored-by: Jack Rickard <jack.rickard@outlook.com>
2022-09-15 23:25:14 +00:00
Jack Rickard
0403696c4e
Update on-demand input docs 2022-09-16 00:14:54 +01:00
Jack Rickard
28987ed733
Move calc and lazy-input examples to examples-2022 2022-09-16 00:14:44 +01:00
Jack Rickard
9f85023dee
Improve error handling in lazy-input 2022-09-15 21:25:54 +01:00
Jack Rickard
f1499a20e2
Fix unsoundness in input_field.rs 2022-09-15 21:25:54 +01:00
Jack Rickard
609acc396c
Add lazy-input (on-demand) example 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
bors[bot]
f8f6dbd349
Merge #405
405: Include only identity fields by default in `DebugWithDb::debug` and add `DebugWithDb::debug_all` r=nikomatsakis a=vemoo

This addresses a couple of items of #397 

I initially added a separate `DebugWithDb::fmt_all` method but then changed it to an extra parameter to make it easier to propagate to inner fields. Also tried introducing something like:
```rust
pub struct FormatterWithDb<'me, 'f, Db: ?Sized>{
  fmt: &'me mut std::fmt::Formatter<'f>,
  db: &'me Db,
  include_all_fields: bool
}
```
to pass to `fmt`, but I gave up because the lifetimes got a bit unwieldy.

Co-authored-by: Bernardo Uriarte <berublan@gmail.com>
2022-09-13 16:04:16 +00: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
378090acc8 add documentation back 2022-09-13 18:01:21 +02:00
Bernardo Uriarte
a288c40034 simplify paths 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
d57c3d36b8 add documentation 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
bors[bot]
f0fe691d3f
Merge #401
401: Support singleton inputs #337 r=nikomatsakis a=OLUWAMUYIWA

## What?
In #337, it  was requested `Singleton` input option be made available for Input structs with a single field. This PR addresses that

## How?
I basically followed the mentoring instructions made available.

Fixes #337

Co-authored-by: OLUWAMUYIWA <onigbindemy@gmail.com>
Co-authored-by: Onigbinde Oluwamuyiwa Elijah <onigbindemy@gmail.com>
2022-09-12 21:44:15 +00: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
bors[bot]
d3ef21925f
Merge #409
409: add Chinese book link r=nikomatsakis a=zjp-CN



Co-authored-by: zjp <jiping_zhou@foxmail.com>
2022-09-10 14:47:30 +00:00
bors[bot]
06e6109ae5
Merge #408
408: Exhaustive macros test r=nikomatsakis a=OLUWAMUYIWA

### What
Used `trybuild` to verify that incompatible options with salsa structs will not compile

Ref: #354 

### How:
I created a `.rs` file for each salsa struct. I decided not to create one for each incompatible option, as this would only greatly increase the number of files. 

Co-authored-by: OLUWAMUYIWA <onigbindemy@gmail.com>
Co-authored-by: Onigbinde Oluwamuyiwa Elijah <onigbindemy@gmail.com>
2022-09-10 11:53:09 +00:00
zjp
1cac7f87e4 add Chinese book link 2022-09-10 09:18:36 +08: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
bors[bot]
4e9161e221
Merge #393
393: Allow "constant" tracked functions r=XFFXFF a=Skepfyr

Fixes #323.

This adds support for tracked functions with only a database as input,
that is, it does not take a salsa struct.

I'm not entirely convinced by this, it feels like it works somewhat accidentally and may be fragile to changes. I'm happy if this just get closed as I was mostly playing around to see how this worked.

This change has the odd side-effect of making this code work:
```rust
#[salsa::tracked]
fn tracked_fn(db: &dyn Db, unit: ()) -> u32 {
    44
}

```

Co-authored-by: Jack Rickard <jack.rickard@outlook.com>
2022-09-06 23:49:25 +00: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