salsa/salsa-2022-tests/tests/compile-fail
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
..
get-set-on-private-field.rs Add compile-fail test for getter and setter visibility 2022-09-02 03:19:21 +03:00
get-set-on-private-field.stderr Add compile-fail test for getter and setter visibility 2022-09-02 03:19:21 +03:00
lru_can_not_be_used_with_specify.rs test for compile failure: lru can not be used with specify 2022-08-19 07:13:03 +08:00
lru_can_not_be_used_with_specify.stderr test for compile failure: lru can not be used with specify 2022-08-19 07:13:03 +08:00
specify-does-not-work-if-the-key-is-a-salsa-input.rs add a test for specify 2022-08-27 07:51:35 +08:00
specify-does-not-work-if-the-key-is-a-salsa-input.stderr add a test for specify 2022-08-27 07:05:35 +08:00
specify-does-not-work-if-the-key-is-a-salsa-interned.rs add a test for specify 2022-08-27 07:51:35 +08:00
specify-does-not-work-if-the-key-is-a-salsa-interned.stderr add a test for specify 2022-08-27 07:51:35 +08:00
tracked_method_on_untracked_impl.rs Add more tests for tracked methods 2022-09-03 15:44:56 +01:00
tracked_method_on_untracked_impl.stderr Add more tests for tracked methods 2022-09-03 15:44:56 +01:00