Files
next.js/turbopack/crates/turbo-tasks-backend/Cargo.toml
Matt MastracciandGitHub c916c80b2f turbo-tasks: drop once_cell, const-init TRAIT_METHOD, ctor WORKER_TASKS (#93090)
## What

Clean up the Lazy-locks we re-export or use internally in the
turbo-tasks crates, migrating to `std::sync::LazyLock` /
`std::cell::LazyCell` where still needed and eliminating a couple of
them where they weren't.

## Why

One less dep, using standard Rust features, a smaller number of Lazy
items.

## Details

- **Re-exports:** drop unused `macro_helpers::OnceCell` and the
now-unused `macro_helpers::phf` (since `TraitType` no longer stores a
`phf::Map`). Replace `once_cell::sync::Lazy` with `std::sync::LazyLock`
in `macro_helpers::TRAIT_CAST_FNS` and in the two macro-generated call
sites.
- **`once_cell::sync::Lazy` → `std::sync::LazyLock`** in `scope.rs`,
`registry/mod.rs`, and `turbo-tasks-backend-fuzz`'s `graph.rs`.
- **`once_cell::unsync::Lazy` → `std::cell::LazyCell`** in
`update_cell.rs`.
- **`TRAIT_METHOD` → plain const-init static:** `TraitType::methods`
changes from `phf::Map<&'static str, TraitMethod>` to `&'static
[TraitMethod]` (parallel to `method_names`), and `TraitType::get`
becomes a `const fn` that does `index_of_name` + array indexing. The
`value_trait` macro now emits a slice literal instead of `phf_map!`, and
the `function` macro emits `static TRAIT_METHOD: &'static TraitMethod =
TRAIT.get(stringify!(..));` — evaluated at const-eval time rather than
behind a `LazyLock<&TraitMethod>`.
- **Dropped `once_cell` and `phf` Cargo deps** from `turbo-tasks`, and
`once_cell` from `turbo-tasks-backend` and its fuzz crate.
2026-04-21 21:06:32 +00:00

78 lines
2.2 KiB
TOML

[package]
name = "turbo-tasks-backend"
version = "0.1.0"
description = "TBD"
license = "MIT"
edition = "2024"
autobenches = false
[lib]
bench = false
[lints]
workspace = true
[features]
default = []
print_cache_item_size_with_compressed = ["print_cache_item_size", "dep:lzzzz"]
print_cache_item_size = []
no_fast_stale = []
aggregation_update_no_batch = []
verify_serialization = []
verify_aggregation_graph = []
verify_immutable = []
verify_determinism = ["turbo-tasks/verify_determinism"]
trace_aggregation_update_queue = []
trace_aggregation_update = ["trace_aggregation_update_queue"]
trace_leaf_distance_update = []
trace_find_and_schedule = ["trace_aggregation_update_queue"]
trace_task_completion = []
trace_task_modification = []
trace_task_dirty = ["trace_aggregation_update_queue"]
trace_task_output_dependencies = []
trace_task_details = []
trace_prepare_tasks = []
[dependencies]
anyhow = { workspace = true }
bincode = { workspace = true }
auto-hash-map = { workspace = true }
bitfield = { workspace = true }
crossbeam-utils = { workspace = true }
dashmap = { workspace = true, features = ["raw-api"]}
either = { workspace = true }
hashbrown = { workspace = true, features = ["raw"] }
indexmap = { workspace = true }
lzzzz = { workspace = true, optional = true }
parking_lot = { workspace = true }
rand = { workspace = true }
ringmap = { workspace = true, features = ["serde"] }
rustc-hash = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_path_to_error = { workspace = true }
smallvec = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
turbo-bincode = { workspace = true }
turbo-persistence = { workspace = true }
turbo-rcstr = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-hash = { workspace = true }
thread_local = { workspace = true }
[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
futures = { workspace = true }
indoc = { workspace = true }
regex = { workspace = true }
tempfile = { workspace = true }
turbo-tasks-malloc = { workspace = true }
rstest = { workspace = true }
turbo-tasks-testing = { workspace = true }
[[bench]]
name = "mod"
harness = false