Skip to content

Commit 2d2ddd3

Browse files
committed
Auto merge of #16503 - Veykril:salsa, r=Veykril
Move salsa fork in-tree No one else is supposed to rely on it anyways, this makes it easier to edit.
2 parents 1974e74 + 3688064 commit 2d2ddd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+9083
-38
lines changed

Cargo.lock

Lines changed: 115 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ proc-macro-srv = { path = "./crates/proc-macro-srv", version = "0.0.0" }
7070
proc-macro-srv-cli = { path = "./crates/proc-macro-srv-cli", version = "0.0.0" }
7171
profile = { path = "./crates/profile", version = "0.0.0" }
7272
project-model = { path = "./crates/project-model", version = "0.0.0" }
73+
salsa = { path = "./crates/salsa", version = "0.0.0" }
7374
span = { path = "./crates/span", version = "0.0.0" }
7475
stdx = { path = "./crates/stdx", version = "0.0.0" }
7576
syntax = { path = "./crates/syntax", version = "0.0.0" }
@@ -106,22 +107,21 @@ dissimilar = "1.0.7"
106107
either = "1.9.0"
107108
expect-test = "1.4.0"
108109
hashbrown = { version = "0.14", features = [
109-
"inline-more",
110+
"inline-more",
110111
], default-features = false }
111112
indexmap = "2.1.0"
112113
itertools = "0.12.0"
113114
libc = "0.2.150"
114115
nohash-hasher = "0.2.0"
115116
rayon = "1.8.0"
116-
rust-analyzer-salsa = "0.17.0-pre.6"
117117
rustc-hash = "1.1.0"
118118
semver = "1.0.14"
119119
serde = { version = "1.0.192", features = ["derive"] }
120120
serde_json = "1.0.108"
121121
smallvec = { version = "1.10.0", features = [
122-
"const_new",
123-
"union",
124-
"const_generics",
122+
"const_new",
123+
"union",
124+
"const_generics",
125125
] }
126126
smol_str = "0.2.1"
127127
text-size = "1.1.1"

crates/base-db/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ doctest = false
1313

1414
[dependencies]
1515
la-arena.workspace = true
16-
rust-analyzer-salsa.workspace = true
16+
salsa.workspace = true
1717
rustc-hash.workspace = true
1818
triomphe.workspace = true
1919
semver.workspace = true

crates/salsa/Cargo.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "salsa"
3+
version = "0.0.0"
4+
authors = ["Salsa developers"]
5+
edition = "2021"
6+
license = "Apache-2.0 OR MIT"
7+
repository = "https://github.com/salsa-rs/salsa"
8+
description = "A generic framework for on-demand, incrementalized computation (experimental)"
9+
10+
rust-version.workspace = true
11+
12+
[lib]
13+
name = "salsa"
14+
15+
[dependencies]
16+
indexmap = "2.1.0"
17+
lock_api = "0.4"
18+
tracing = "0.1"
19+
parking_lot = "0.12.1"
20+
rustc-hash = "1.0"
21+
smallvec = "1.0.0"
22+
oorandom = "11"
23+
triomphe = "0.1.11"
24+
25+
salsa-macros = { version = "0.0.0", path = "salsa-macros" }
26+
27+
[dev-dependencies]
28+
linked-hash-map = "0.5.6"
29+
rand = "0.8.5"
30+
test-log = "0.2.14"
31+
expect-test = "1.4.0"
32+
dissimilar = "1.0.7"
33+
34+
[lints]
35+
workspace = true

crates/salsa/FAQ.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Frequently asked questions
2+
3+
## Why is it called salsa?
4+
5+
I like salsa! Don't you?! Well, ok, there's a bit more to it. The
6+
underlying algorithm for figuring out which bits of code need to be
7+
re-executed after any given change is based on the algorithm used in
8+
rustc. Michael Woerister and I first described the rustc algorithm in
9+
terms of two colors, red and green, and hence we called it the
10+
"red-green algorithm". This made me think of the New Mexico State
11+
Question --- ["Red or green?"][nm] --- which refers to chile
12+
(salsa). Although this version no longer uses colors (we borrowed
13+
revision counters from Glimmer, instead), I still like the name.
14+
15+
[nm]: https://www.sos.state.nm.us/about-new-mexico/state-question/
16+
17+
## What is the relationship between salsa and an Entity-Component System (ECS)?
18+
19+
You may have noticed that Salsa "feels" a lot like an ECS in some
20+
ways. That's true -- Salsa's queries are a bit like *components* (and
21+
the keys to the queries are a bit like *entities*). But there is one
22+
big difference: **ECS is -- at its heart -- a mutable system**. You
23+
can get or set a component of some entity whenever you like. In
24+
contrast, salsa's queries **define "derived values" via pure
25+
computations**.
26+
27+
Partly as a consequence, ECS doesn't handle incremental updates for
28+
you. When you update some component of some entity, you have to ensure
29+
that other entities' components are updated appropriately.
30+
31+
Finally, ECS offers interesting metadata and "aspect-like" facilities,
32+
such as iterating over all entities that share certain components.
33+
Salsa has no analogue to that.
34+

0 commit comments

Comments
 (0)