next.js
e0987559 - refactor(turbopack): Add `NonLocalValue` derives to types deriving TraceRawVcs (#73714)

Commit
1 year ago
refactor(turbopack): Add `NonLocalValue` derives to types deriving TraceRawVcs (#73714) Types that implement `TraceRawVcs` do so because they aren't a `VcValueType`, but they are used inside of a `VcValueType`. We have a similar issue for the `NonLocalValue` (formerly `ResolvedValue`) marker trait. We need it to be implemented for all things included inside of `VcValueType`s, so that we can know that `VcValueType`s do not recursively contain potentially-local `Vc`s. I started this PR by adding `NonLocalValue` to all things that explicitly derive `TraceRawVcs`: ``` sg run --lang rust --pattern '#[derive($$$BEFORE TraceRawVcs $$$AFTER)]' --rewrite '#[derive($$$BEFORE TraceRawVcs $$$AFTER, NonLocalValue)]' --update-all fastmod ',, NonLocalValue' ', NonLocalValue' # fix up some double comments caused by the astgrep transform above ``` And then I went through doing the following: - Adding imports of `NonLocalValue`. - Removing the `NonLocalValue` in cases where it's not easy for the struct to implement it yet. - Adding `non_local` options to `#[turbo_task::value]` macros in places where it would help us derive `NonLocalValue` somewhere else. - In a few cases removed some `#[turbo_tasks(trace_ignore)]`s in favor of adding a proper `TraceRawVcs` and `NonLocalValue` implementations. Included with this are a few improvements to the `turbo-tasks` and `turbo-tasks-macros` crates: - Fixed an issue where `rust-analyzer` (but not `cargo check`) would report a warning about `non_snake_case` inside the derive macro. - Remove some type bounds from the `AdjacencyMap` struct (see #72823 for an explaination) and implement `NonLocalValue` on it. - Implement `NonLocalValue` (and `TraceRawVcs`) on a few more primitive types.
Author
bgw bgw
Parents
Loading