Files
next.js/turbopack/crates/turbo-tasks/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

66 lines
1.9 KiB
TOML

[package]
name = "turbo-tasks"
version = "0.1.0"
description = "TBD"
license = "MIT"
edition = "2024"
[lib]
bench = false
[features]
default = []
tokio_tracing = ["tokio/tracing"]
hanging_detection = []
task_id_details = []
verify_determinism = []
# TODO(bgw): This feature is here to unblock turning on local tasks by default. It's only turned on
# in unit tests. This will be removed very soon.
non_operation_vc_strongly_consistent = []
[lints]
workspace = true
[dependencies]
anyhow = { workspace = true }
async-trait = { workspace = true }
auto-hash-map = { workspace = true }
bincode = { workspace = true }
concurrent-queue = { workspace = true }
dashmap = { workspace = true }
either = { workspace = true }
erased-serde = { workspace = true }
event-listener = "5.4.0"
futures = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
inventory = { workspace = true }
parking_lot = { workspace = true, features = ["serde"]}
pin-project-lite = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["rc", "derive"] }
serde_json = { workspace = true }
shrink-to-fit = { workspace = true, features = ["indexmap", "serde_json", "smallvec", "nightly"] }
smallvec = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-util = { workspace = true }
tracing = { workspace = true }
triomphe = { workspace = true, features = ["unsize", "unstable"] }
turbo-bincode = { workspace = true }
turbo-dyn-eq-hash = { workspace = true }
turbo-frozenmap = { workspace = true }
turbo-rcstr = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbo-tasks-macros = { workspace = true }
turbo-tasks-malloc = { workspace = true }
unsize = { workspace = true }
[dev-dependencies]
criterion = { workspace = true, features = ["async_tokio"] }
[[bench]]
name = "mod"
harness = false