Skip to content

Commit

Permalink
Merge pull request #501 from mbrobbel/remove-old-salsa
Browse files Browse the repository at this point in the history
Remove the old Salsa, rename `salsa-2022` crate to `salsa`
  • Loading branch information
nikomatsakis authored Jun 19, 2024
2 parents 2c7cda5 + d65914b commit 38a44ee
Show file tree
Hide file tree
Showing 269 changed files with 2,240 additions and 11,398 deletions.
97 changes: 50 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Test
on:
push:
branches:
- master
- staging
- trying
- master
- staging
- trying
pull_request:
paths:
- '**.rs'
- '**/Cargo.*'
- '.github/workflows/**.yml'
- 'salsa-2022-tests/tests/compile-fail/**.stderr'
- "**.rs"
- "**/Cargo.*"
- ".github/workflows/**.yml"
- "tests/compile-fail/**.stderr"
merge_group:

jobs:
Expand All @@ -20,52 +20,52 @@ jobs:
strategy:
matrix:
rust:
- stable
- beta
- stable
- beta
experimental:
- false
- false
include:
- rust: nightly
experimental: true
- rust: nightly
experimental: true
continue-on-error: ${{ matrix.experimental }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
default: true
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets --all
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all-targets --all
- name: Test docs
uses: actions-rs/cargo@v1
with:
command: test
args: --doc
- name: Check (without default features)
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
default: true
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets --workspace
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all-targets --workspace
- name: Test docs
uses: actions-rs/cargo@v1
with:
command: test
args: --doc
- name: Check (without default features)
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features

miri:
name: "Miri"
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -75,4 +75,7 @@ jobs:
rustup override set nightly
cargo miri setup
- name: Test with Miri
run: cargo miri test --no-fail-fast -p salsa-2022 -p salsa-2022-tests -p calc -p lazy-input
run: cargo miri test --no-fail-fast
- name: Run examples with Miri
run: |
cargo miri run --example calc
37 changes: 16 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
[package]
name = "salsa"
version = "0.17.0-pre.2" # CHECK salsa-macros version
version = "0.18.0"
authors = ["Salsa developers"]
edition = "2018"
edition = "2021"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/salsa-rs/salsa"
description = "A generic framework for on-demand, incrementalized computation (experimental)"

[dependencies]
arc-swap = "1.4.0"
arc-swap = "1.6.0"
crossbeam = "0.8.1"
crossbeam-utils = { version = "0.8", default-features = false }
dashmap = "5.3.4"
hashlink = "0.8.0"
indexmap = "2"
lock_api = "0.4.7"
log = "0.4.5"
parking_lot = "0.12.1"
rustc-hash = "1.0"
rustc-hash = "1.1.0"
salsa-macros = { path = "components/salsa-macros" }
smallvec = "1.0.0"
oorandom = "11"
salsa-macros = { version = "0.17.0-pre.2", path = "components/salsa-macros" }

[dev-dependencies]
diff = "0.1.0"
env_logger = "0.9"
linked-hash-map = "0.5.2"
rand = "0.8"
rand_distr = "0.4.3"
derive-new = "0.5.9"
env_logger = "*"
expect-test = "1.4.0"
eyre = "0.6.8"
notify-debouncer-mini = "0.2.1"
ordered-float = "3.0"
parking_lot = "0.12.1"
rustversion = "1.0"
test-log = "0.2.11"
insta = "1.8.0"
trybuild = "1.0"

[workspace]
members = [
"components/salsa-macros",
"components/salsa-2022",
"components/salsa-2022-macros",
"examples-2022/calc",
"examples-2022/lazy-input",
"salsa-2022-tests",
]
members = ["components/salsa-macros"]
2 changes: 0 additions & 2 deletions book/_redirects

This file was deleted.

33 changes: 3 additions & 30 deletions book/netlify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,6 @@ curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$
unzip mdbook-linkcheck.v$MDBOOK_LINKCHECK_VERSION.x86_64-unknown-linux-gnu.zip -d ~/.cargo/bin
chmod +x ~/.cargo/bin/mdbook-linkcheck

# ======================================================================
# The following script automates the deployment of both the latest and a
# specified older version of the 'salsa' documentation using mdbook

# Store the current branch or commit
original_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$original_branch" == "HEAD" ]; then
original_branch=$(git rev-parse HEAD)
fi

mkdir -p versions # Create a root directory for all versions

# Declare an associative array to map commits to custom version directory names
declare -A commit_to_version=( ["$original_branch"]="salsa2022" ["754eea8b5f8a31b1100ba313d59e41260b494225"]="salsa" )

# Loop over the keys (commit hashes or branch names) in the associative array
for commit in "${!commit_to_version[@]}"; do
git checkout $commit
mdbook build
version_dir="versions/${commit_to_version[$commit]}"
mkdir -p $version_dir
mv book/html/* $version_dir
rm -rf book
done

# Return to the original branch or commit
git checkout $original_branch

# Copy _redirects to the root directory
cp _redirects versions
mdbook build
mkdir versions
mv book/html/* versions
1 change: 0 additions & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- [Durability](./reference/durability.md)
- [Algorithm](./reference/algorithm.md)
- [Common patterns](./common_patterns.md)
- [Selection](./common_patterns/selection.md)
- [On-demand (Lazy) inputs](./common_patterns/on_demand_inputs.md)
- [Tuning](./tuning.md)
- [Cycle handling](./cycles.md)
Expand Down
5 changes: 0 additions & 5 deletions book/src/caveat.md

This file was deleted.

8 changes: 3 additions & 5 deletions book/src/common_patterns/on_demand_inputs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# On-Demand (Lazy) Inputs

{{#include ../caveat.md}}

Salsa inputs work best if you can easily provide all of the inputs upfront.
However sometimes the set of inputs is not known beforehand.

Expand All @@ -15,12 +13,12 @@ That is, when a query requests the text of a file for the first time:

This is possible to achieve in salsa, by caching the inputs in your database structs and adding a method to the database trait to retrieve them out of this cache.

A complete, runnable file-watching example can be found in [the lazy-input example](https://github.com/salsa-rs/salsa/tree/master/examples-2022/lazy-input).
A complete, runnable file-watching example can be found in [the lazy-input example](https://github.com/salsa-rs/salsa/tree/master/examples/lazy-input).

The setup looks roughly like this:

```rust,ignore
{{#include ../../../examples-2022/lazy-input/src/main.rs:db}}
{{#include ../../../examples/lazy-input/main.rs:db}}
```

- We declare a method on the `Db` trait that gives us a `File` input on-demand (it only requires a `&dyn Db` not a `&mut dyn Db`).
Expand All @@ -33,5 +31,5 @@ Here we implement a simple driving loop, that recompiles the code whenever a fil
You can use the logs to check that only the queries that could have changed are re-evaluated.

```rust,ignore
{{#include ../../../examples-2022/lazy-input/src/main.rs:main}}
{{#include ../../../examples/lazy-input/main.rs:main}}
```
78 changes: 0 additions & 78 deletions book/src/common_patterns/selection.md

This file was deleted.

4 changes: 1 addition & 3 deletions book/src/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Salsa overview

{{#include caveat.md}}

This page contains a brief overview of the pieces of a Salsa program.
For a more detailed look, check out the [tutorial](./tutorial.md), which walks through the creation of an entire project end-to-end.

Expand Down Expand Up @@ -154,7 +152,7 @@ Tracked functions can return any clone-able type. A clone is required since, whe
**Tracked structs** are intermediate structs created during your computation.
Like inputs, their fields are stored inside the database, and the struct itself just wraps an id.
Unlike inputs, they can only be created inside a tracked function, and their fields can never change once they are created (until the next revision, at least).
Getter methods are provided to read the fields, but there are no setter methods.
Getter methods are provided to read the fields, but there are no setter methods.
Example:

```rust
Expand Down
18 changes: 8 additions & 10 deletions book/src/plumbing.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Plumbing

{{#include caveat.md}}

This chapter documents the code that salsa generates and its "inner workings".
We refer to this as the "plumbing".

## Overview

The plumbing section is broken up into chapters:

* The [jars and ingredients](./plumbing/jars_and_ingredients.md) covers how each salsa item (like a tracked function) specifies what data it needs and runtime, and how links between items work.
* The [database and runtime](./plumbing/database_and_runtime.md) covers the data structures that are used at runtime to coordinate workers, trigger cancellation, track which functions are active and what dependencies they have accrued, and so forth.
* The [query operations](./plumbing/query_ops.md) chapter describes how the major operations on function ingredients work. This text was written for an older version of salsa but the logic is the same:
* The [maybe changed after](./plumbing/maybe_changed_after.md) operation determines when a memoized value for a tracked function is out of date.
* The [fetch](./plumbing/fetch.md) operation computes the most recent value.
* The [derived queries flowchart](./plumbing/derived_flowchart.md) depicts the logic in flowchart form.
* The [cycle handling](./plumbing/cycles.md) handling chapter describes what happens when cycles occur.
* The [terminology](./plumbing/terminology.md) section describes various words that appear throughout.
- The [jars and ingredients](./plumbing/jars_and_ingredients.md) covers how each salsa item (like a tracked function) specifies what data it needs and runtime, and how links between items work.
- The [database and runtime](./plumbing/database_and_runtime.md) covers the data structures that are used at runtime to coordinate workers, trigger cancellation, track which functions are active and what dependencies they have accrued, and so forth.
- The [query operations](./plumbing/query_ops.md) chapter describes how the major operations on function ingredients work. This text was written for an older version of salsa but the logic is the same:
- The [maybe changed after](./plumbing/maybe_changed_after.md) operation determines when a memoized value for a tracked function is out of date.
- The [fetch](./plumbing/fetch.md) operation computes the most recent value.
- The [derived queries flowchart](./plumbing/derived_flowchart.md) depicts the logic in flowchart form.
- The [cycle handling](./plumbing/cycles.md) handling chapter describes what happens when cycles occur.
- The [terminology](./plumbing/terminology.md) section describes various words that appear throughout.
Loading

0 comments on commit 38a44ee

Please sign in to comment.