salsa/salsa-2022-tests/tests
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
..
compile-fail Merge #392 2022-09-05 10:44:51 +00:00
parallel give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
warnings avoid warnings in generated code 2022-08-26 18:51:51 +02:00
accumulate-from-tracked-fn.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
accumulate-reuse-workaround.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
accumulate-reuse.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
accumulate.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
compile_fail.rs run compile_fail test only on stable 2022-08-27 16:01:04 +08:00
cycles.rs add report_untracked_read to salsa::Database 2022-08-25 06:30:27 +08:00
debug.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
deletion-cascade.rs Merge #376 #379 2022-08-25 10:30:34 +00:00
deletion.rs Merge #376 #379 2022-08-25 10:30:34 +00:00
expect_reuse_field_x_of_a_tracked_struct_changes_but_fn_depends_on_field_y.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
expect_reuse_field_x_of_an_input_changes_but_fn_depends_on_field_y.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
hello_world.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
lru.rs add report_untracked_read to salsa::Database 2022-08-25 06:30:27 +08:00
mutate_in_place.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
override_new_get_set.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
specify-only-works-if-the-key-is-created-in-the-current-query.rs add a test for specify 2022-08-27 07:51:35 +08:00
specify_tracked_fn_in_rev_1_but_not_2.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
tracked_fn_on_input.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
tracked_fn_on_tracked.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
tracked_fn_on_tracked_specify.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
tracked_fn_read_own_entity.rs give salsa_runtime a default implementation 2022-08-24 20:11:48 +08:00
tracked_method.rs Add more tests for tracked methods 2022-09-03 15:44:56 +01:00