next.js
07a94a46 - turbo-tasks: fix reversed TaskInput::is_resolved documentation (#102184)

Commit
4 hours ago
turbo-tasks: fix reversed TaskInput::is_resolved documentation (#102184) ### What? Corrects the documentation of `TaskInput::is_resolved` (and the related sentence on `TaskInput::resolve_input`) in `turbo-tasks`. The docs previously described the return value backwards: they said `true` means the input contains unresolved `Vc`s and triggers a local resolution task. ### Why? The implementation uses the opposite convention. The default implementation returns `true` (correct for scalar types), and collection/wrapper impls aggregate with `all(TaskInput::is_resolved)`. At call sites `InputResolution::from_is_resolved(true)` maps to `Resolved`, and `dynamic_call` spawns the function's task directly in that case, only scheduling a `ResolveNative` local task when inputs are unresolved. The reversed docs could mislead anyone writing a manual `TaskInput` implementation into returning the wrong value. ### How? Documentation only, no behavior change: - `true` is described as fully resolved (input is cloned and the task is spawned directly), `false` as needing a local resolution task that runs `resolve_input`. - The note about internally resolved `Vc`s now warns against returning `false` unconditionally for any `Vc`. - Documents that the default `true` is correct for types that cannot contain a `Vc`. ### Verification - `rustfmt --edition 2024 --check turbopack/crates/turbo-tasks/src/task/task_input.rs` - Cross-checked against `InputResolution::from_is_resolved` / `TurboTasks::dynamic_call` in `turbopack/crates/turbo-tasks/src/manager.rs` and the existing `test_small_vec` unit test assertions (resolved scalar inputs return `true`). - Not run: `cargo test -p turbo-tasks` (doc-comment-only change; intra-doc links unchanged) <!-- NEXT_JS_LLM --> <!-- fleet d743a8b7-3e4d-4f95-8990-5c615ed1d379 --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading