Niko Matsakis
5095d79d13
return a pointer from interning, not just id
2024-05-24 07:16:50 -04:00
Niko Matsakis
d92f2aa0a5
factor out useful helper fn
2024-05-24 07:16:50 -04:00
Niko Matsakis
af94b253be
debug dump for interned struct tokens
2024-05-24 07:16:50 -04:00
Niko Matsakis
d6d522662c
have tracked struct intern its own keys
...
Previously tracked structs relied on an
interned ingredient to intern their keys.
But really it has more complex logic than we
need. Simpler to just remove it and duplicate
the basic concept.
2024-05-24 07:16:50 -04:00
Niko Matsakis
4822013523
permit interned data to take 'db lifetime
2024-05-24 07:16:50 -04:00
Niko Matsakis
d190bebcac
introduce helper functions
...
We'll need these for use with tracked functions
2024-05-24 07:16:50 -04:00
Niko Matsakis
97fc6a0920
rework interning to have a Configuration
...
This will permit GATs so that interned values
can carry lifetimes.
2024-05-24 07:16:50 -04:00
Niko Matsakis
54c9586b45
move interned-specific fns out of salsa struct
...
Salsa struct is already a grab-bag, best to keep
it to shared functionality.
2024-05-24 07:16:50 -04:00
Niko Matsakis
8ba6e606c0
generate configuration struct in salsa_struct
...
It will be shared between tracked structs and
interned structs.
2024-05-24 07:16:50 -04:00
Niko Matsakis
4f74037f41
pipe debug output through rustfmt
...
is there a nicer way to do this?!
2024-05-24 07:16:50 -04:00
Niko Matsakis
04e041b4a2
rework debugging to be more permanent
2024-05-24 07:16:50 -04:00
Niko Matsakis
fe4ff9816a
support db lifetimes in fields
2024-05-24 07:16:50 -04:00
Niko Matsakis
a84777d5a7
permit <'db>
on tracked struct
...
tracked structs with `'db` carry a pointer
and not an id.
2024-05-24 07:16:50 -04:00
Niko Matsakis
e95c8b21fb
give fields a lifetime
2024-05-24 07:16:50 -04:00
Niko Matsakis
44a8a2f41c
make fn input/value a GAT
2024-05-24 07:16:50 -04:00
Niko Matsakis
b050bd874a
remove Key from Fn configuration
...
Just use salsa::Id for the most part.
2024-05-24 07:16:50 -04:00
Niko Matsakis
6e2647fa50
just take salsa::Id instead of id structs
2024-05-24 07:16:50 -04:00
Niko Matsakis
cb1a2bb75b
Revert "WIP permit 'db on tracked struct definitions (opt)"
...
This reverts commit 43b1b8ef3f98213279b9d0768847603299162f1f.
2024-05-24 07:16:50 -04:00
Niko Matsakis
b6311d8102
WIP permit 'db on tracked struct definitions (opt)
2024-05-24 07:16:50 -04:00
Niko Matsakis
5ce5e3c374
track and assert struct ingredient indices
...
We need a cheap way to compute field indices.
2024-05-24 07:16:50 -04:00
Niko Matsakis
79d24e0ad7
allow (but don't test) lifetime parameters
2024-05-24 07:16:50 -04:00
Niko Matsakis
ea1d452143
create a struct_map
that encapsulates access
...
The internal API is now based around providing
references to the `TrackedStructValue`.
Documenting the invariants led to one interesting
case, which is that we sometimes verify a tracked
struct as not having changed (and even create
`&`-ref to it!) but then re-execute the function
around it.
We now guarantee that, in this case, the data
does not change, even if it has leaked values.
This is required to ensure soundness.
Add a test case about it.
2024-05-24 07:16:47 -04:00
Niko Matsakis
20cb307301
give trait more info about lifetime relationships
...
In particular, the ingredient and the database
have the same lifetime.
This will be useful later for safety conditions.
2024-05-24 07:15:40 -04:00
Niko Matsakis
a32078153b
separate marking the outputs as verified
...
There are 3 call-sites to this function:
* One of them has already marked the outputs
* One of them has no outputs
* The third does need to mark the outputs
2024-05-24 07:15:40 -04:00
Niko Matsakis
e24ace24eb
return &TrackedStructValue<C>
from new_struct
...
This is a step towards the goal of keep a pointer
in the structs themselves.
2024-05-24 07:15:40 -04:00
Niko Matsakis
4533cd9e4b
adopt the Salsa 3.0 Update
` trait
...
Right now, this doesn't change much except the
behavior in the event that `Eq` is not properly
implemented. In the future, it will enable
the use of references and slices and things.
2024-05-24 07:15:40 -04:00
Niko Matsakis
90597b18ab
remove stray eprintln
2024-04-12 04:57:41 -04:00
Niko Matsakis
82b672df3b
allow various clippy lint groups
2024-04-05 05:48:11 -04:00
Niko Matsakis
f4a8ed650f
update tracked struct created_at
when validated
...
Fixes #484
2024-04-05 05:15:59 -04:00
Niko Matsakis
5d6f883b18
improve spans for inputs
2024-04-04 06:24:07 -04:00
Niko Matsakis
1acbf2b0d4
improve spans for getters, constructors
...
This helps the IDE support.
2024-04-04 06:14:31 -04:00
Niko Matsakis
ce2f78290a
add FIXME
2024-04-03 06:33:17 -04:00
Niko Matsakis
9dfa84b693
improve doc comments
2024-04-03 06:30:31 -04:00
Niko Matsakis
fd15c3a600
support customizing the DebugWithDb impl
2024-04-03 06:23:43 -04:00
Niko Matsakis
389aa66bcf
print all fields in debug()
but ignore deps
...
In a previous PR we added the `include_all_fields`
parameter to `DebugWithDb` to allow it to
not create spurious dependencies.
This PR takes a different approach: we simply
ignore the dependencies created during debug
operations. This is risky as it can create
incorrect dependencies, but it is way more
convenient and seems like what users probably
want.
It also means that `DebugWithDb` has a simpler
signature that matches the `Debug` trait again,
which seems good to me.
2024-04-03 05:59:11 -04:00
Niko Matsakis
b5aa4294bd
Merge pull request #481 from nikomatsakis/struct-field-ingredients
...
Struct field ingredients
2024-04-02 22:06:51 +00:00
Niko Matsakis
8772961573
clippy, you are truly righteous and exacting
2024-04-02 07:05:17 -04:00
Niko Matsakis
6eb9cb0d1b
complete comment
2024-04-02 06:52:38 -04:00
Niko Matsakis
e81b22315b
driveby: fix use of indexmap remove
...
We do care about the order of things in this
set, in general, so use `shift_remove`.
2024-04-02 06:30:53 -04:00
Niko Matsakis
39321ed920
fix clippy warnings
2024-04-02 06:29:44 -04:00
Niko Matsakis
9deaf3e149
Update components/salsa-2022/src/storage.rs
2024-04-02 06:15:43 -04:00
Niko Matsakis
54b33c335a
create tracked field-ingredients
2024-04-02 06:08:55 -04:00
Niko Matsakis
796dc004f2
remove "id" fields from interned table
...
First step towards the new tracked struct design.
SUBTLE: This is actually broken if the `#[id]`
fields have a broken hash. We'll fix that in the
next commit and add a test.
2024-04-02 06:08:33 -04:00
Mona Lisa
998bcf606a
chore: fmt
2024-03-15 23:01:30 +08:00
Mona Lisa
864344addb
fix: wrong condvar usage
2024-03-15 22:44:09 +08:00
Niko Matsakis
0543972429
extract transmute_lifetime
into plumbing module
2024-03-14 05:44:15 -04:00
Niko Matsakis
4142ebca97
remove unnecessary Option
2024-03-13 05:37:53 -04:00
Niko Matsakis
e909ca5c97
add a comment clarifying
2024-03-12 06:30:54 -04:00
Niko Matsakis
4151b09d3c
Merge pull request #443 from Veykril/self-span
...
Preserve span of receiver for query trait functions
2024-03-11 09:58:15 +00:00
DropDemBits
407d6bcaa7
Bump arc-swap
to 1.6.0
...
1.6.0 fixes some UB in previous versions of `arc-swap`.
2023-11-11 00:42:47 -05:00
Niko Matsakis
f1d318a279
Merge pull request #450 from DropDemBits/placement-new-jars
...
Initialize jars in-place
2023-11-09 10:25:26 +00:00
Niko Matsakis
703794b1c7
Merge pull request #461 from Y-Nak/provide-access-to-ingredient-index
...
Provide a public API to obtain `IngredientIndex`
2023-11-09 10:21:37 +00:00
Niko Matsakis
6ac3724e0a
Merge pull request #449 from DropDemBits/assert-on-tracked-struct-outside-of-tracked-fn
...
Improve assert message when creating a tracked struct outside of a tracked function
2023-10-28 06:58:14 -04:00
Yoshitomo Nakanishi
b295f5aef7
Remove unnecessary mut
from make_fn_return_ref
2023-10-08 20:41:55 +02:00
Yoshitomo Nakanishi
59f094f512
Provide public API to get IngredientIndex
2023-10-08 20:40:52 +02:00
Josh Stone
db3ef9a2ba
Upgrade to indexmap 2
2023-09-29 17:11:34 -07: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
22646a8fb4
Improve assert message when creating a tracked struct outside of a tracked function
2023-06-13 16:35:28 -04:00
Lukas Wirth
0038ae2f5e
Presere span of receiver for query trait functions
2023-05-02 09:46:39 +02:00
Yoshitomo Nakanishi
5718229882
Change the constructor of salsa::Id
to const fn
2023-04-12 13:36:17 +02: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
Niko Matsakis
ce4b041048
Update components/salsa-2022/src/storage.rs
2022-12-29 11:37:06 -05:00
manapointer
f1a775c355
update docs to be accurate to the change
2022-12-25 18:18:11 -08:00
manapointer
57b848da3e
impl drop for storage
2022-12-25 18:10:42 -08:00
manapointer
2fc0a3c08f
fix cvar not being notified when Arc<Shared<DB>> is dropped
2022-12-22 15:46:28 -08: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
bors[bot]
30b5e9760a
Merge #412
...
412: Fix race condition in interned data r=nikomatsakis a=Skepfyr
In some scenarios the `InternedIngredient` could return two different ids for the same data if called in parallel.
Co-authored-by: Jack Rickard <jack.rickard@outlook.com>
2022-09-27 22:48:54 +00:00
XFFXFF
f48ca09a65
add empty dependencies back
2022-09-26 10:58:21 +00:00
XFFXFF
589bbeb65e
Revert "remove unused variables and functions"
...
This reverts commit a2be847e1a
.
2022-09-26 10:51:23 +00:00
XFFXFF
8f85d4ee27
cargo fmt
2022-09-26 09:15:10 +00:00
XFFXFF
409ed367c2
using flat-map trick
2022-09-26 09:14:30 +00:00
zhou fan
6239fc217a
add a comment
...
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2022-09-26 17:09:19 +08:00
Jack Rickard
c58ff26d87
Simplify interning by restricting deletes
2022-09-25 22:33:37 +01:00
XFFXFF
cc6ab647fa
refactor outputs method of LocalState
2022-09-25 01:21:39 +00:00
XFFXFF
e7c7f386fe
fix accumulator: clear the outdated accumulated values
2022-09-25 00:24:16 +00:00
XFFXFF
1214610451
remove inputs method of QueryEdges
2022-09-24 23:59:25 +00:00
XFFXFF
a2be847e1a
remove unused variables and functions
2022-09-24 23:59:25 +00:00
XFFXFF
d71892c047
update diff output
2022-09-24 23:59:25 +00:00
XFFXFF
961c4ce154
update some tests and run cargo fmt
2022-09-24 23:59:25 +00:00
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
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
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
Onigbinde Oluwamuyiwa Elijah
e3661de899
Merge branch 'salsa-rs:master' into immutable_fields_in_inputs
2022-09-16 01:53:42 +01:00
Jack Rickard
79823c7f65
Fix deadlock in InternedIngredient::intern
2022-09-16 00:10:33 +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
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