- 04 Mar, 2026 24 commits
-
-
nextjs-bot authored
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Jiwon Choi authored
Stacked on https://github.com/vercel/next.js/pull/90721 Verified deployment tests pass on CI: https://github.com/vercel/next.js/actions/runs/22541051404
-
Aurora Scharff authored
### What? Add `aurorascharff` to the devex team labeler configuration. ### Why? New team member onboarding. ### How? Added username to the relevant pattern entries in the labeler config. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Hendrik Liebau authored
When navigating to a page with `unstable_instant: { prefetch: 'runtime' }` and no prior prefetch (e.g. `prefetch={false}` or clicking before prefetch completes), the server now embeds a runtime prefetch stream in the dynamic RSC navigation payload. On the client, this stream is decoded and written into the segment cache so that subsequent navigations to the same page can serve runtime-prefetchable content (cookies, headers, searchParams) instantly, without needing a separate prefetch request. On the server, `generateStagedDynamicFlightRenderResult` detects routes with runtime prefetching enabled and attaches a `CacheSignal` and `PrerenderResumeDataCache` to the `RequestStore`. The dynamic render fills these caches as a side effect. Once `cacheSignal.cacheReady()` resolves, a final runtime prerender (the same 5-stage pipeline used for regular runtime prefetches) runs and its output is piped into a `TransformStream` whose readable side is included in the RSC payload as the `p` field on the `NavigationFlightResponse`. This avoids a separate prospective prerender because the dynamic render has already warmed the caches. On the client, `processRuntimePrefetchStream` strips the isPartial byte, decodes the inner Flight stream, and the result is written into the segment cache via `writeDynamicRenderResponseIntoCache` with `FetchStrategy.PPRRuntime`. Both the `navigateToUnknownRoute` and `fetchMissingDynamicData` code paths handle the new stream. This is gated on the explicit `unstable_instant` opt-in because it adds extra server processing (a full runtime prerender per navigation request) and increases payload size. It also requires that the runtime prefetch output has been validated first. Known limitation: the runtime prefetch cache write currently evicts the static cache entry (which may have a longer stale time) because `upsertSegmentEntry` treats the fallback match as a replacement target. This means that after the runtime cache expires, the static cache is no longer available as a fallback. A follow-up may address this with a layered cache approach where entries with different fetch strategies and stale times coexist independently. Extracting runtime data from initial HTML loads (the PPR resume path) is also deferred to a follow-up. -
Niklas Mischkulnig authored
Unify the list of Node/Edge iexternals. Turns out `readline/promises` and `stream/consumers` was missing in some places. Closes https://github.com/vercel/next.js/issues/90765
-
Niklas Mischkulnig authored
A regression from https://github.com/vercel/next.js/issues/86576 Closes https://github.com/vercel/next.js/issues/87898 Closes PACK-6421
-
Jiwon Choi authored
Stacked on https://github.com/vercel/next.js/pull/90726 Migrate legacy PPR tests to Cache Components
-
Jiwon Choi authored
Stacked on https://github.com/vercel/next.js/pull/90713 This PR removes `prerender-ppr` case handling in the codebase. Verified deployment tests pass on CI: https://github.com/vercel/next.js/actions/runs/22539297668
-
Hendrik Liebau authored
When a partially static page is loaded via initial HTML (PPR resume), the RSC payload now includes the `l` (static stage byte length) field, enabling the client router to extract and cache the static stage during hydration. Subsequent navigations to the same page serve the cached static content instantly while streaming in dynamic content. On the server, the resume path in `renderToStream` now uses staged rendering (mirroring `generateStagedDynamicFlightRenderResult`) when Cache Components is enabled. A `StagedRenderingController` separates the static and dynamic stages, and `countStaticStageBytes` resolves the byte length promise that Flight serializes into the stream as `l`. `getRSCPayload` accepts `staleTimeIterable` and `staticStageByteLengthPromise` options to wire `s` and `l` into the `InitialRSCPayload`. On the client, `app-index.tsx` tees the inlined Flight stream when Cache Components is enabled. One copy goes to React for decoding, the other is passed to `createInitialRouterState`. When `l` is present (partially static), the clone is truncated at the byte boundary via `decodeStaticStage` and written into the segment cache via `writeStaticStageResponseIntoCache` with `isResponsePartial: true`. When `l` is absent but `s` is present (fully static), the same function is used with `isResponsePartial: false`. `createInitialRouterState` now accepts a single `initialRSCPayload: InitialRSCPayload` prop instead of individual destructured fields.
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Matt Mastracci authored
# What Add an ast-grep rule to use `bail!` rather than `Err(anyhow!(` in a return position. # Why This is slightly more compact, and allows us to port more code over to turbofmt/turbobail. Note: _this PR was previously merged into another branch due to a GH bug_
-
Jiwon Choi authored
Stacked on https://github.com/vercel/next.js/pull/90704 This PR replaces `experimental.isRoutePPREnabled` render options with `cacheComponents` and removes unused code. Verified deployment tests pass on CI: https://github.com/vercel/next.js/actions/runs/22536405880
-
Hendrik Liebau authored
When a fully static page is loaded (via initial HTML or client-side navigation), the segments are now written into the segment cache so subsequent navigations can be served entirely from cache without server requests. Initial HTML: The RSC payload inlined in the HTML is written during hydration via `getStaleAt` + `writeStaticStageResponseIntoCache` with `isResponsePartial: false`, using `FetchStrategy.Full` since all segments are present. A `StaleTimeIterable` (`s` field) is included in the `InitialRSCPayload` during the Cache Components prerender path to provide the stale time. Navigation: The `isResponsePartial` flag from the prepended byte (stripped by `processFetch`) is now also used to determine how segments from `writeStaticStageResponseIntoCache` are cached. For fully static routes (`isResponsePartial: false`), segments are written as non-partial so no dynamic follow-up is needed. The route tree used for cache writes is now always derived from the Flight data itself (via `convertServerPatchToFullTree`), rather than from a pre-existing route cache entry. This guarantees the tree stays in sync with the response and avoids key mismatches between the static stage tree and the per-segment prefetch tree for parallel route slots. When writing the head into the cache, `isHeadPartial` from the server is overridden to `false` for non-partial responses, but only when Cache Components is enabled. This corrects the server's conservative `isPossiblyPartialHead` marking during static generation. Without Cache Components, the server already sends the correct value. Responses without a recognized marker byte (e.g. regular navigations that don't go through the prerender path) are conservatively treated as partial. Partially static pages (where the static stage needs to be extracted via byte-level truncation of the initial HTML Flight stream) will be handled in a follow-up. --------- Co-authored-by:Andrew Clark <git@andrewclark.io>
-
Matt Mastracci authored
# What Add turbofmt! and turbobail! proc macros for async string formatting with Vc<T> and ResolvedVc<T> values. A new, agent-friendly `FORMATTING.md` file is added to help agents figure out how these macros work. # Why Formatting strings that include turbo-tasks values currently requires manually .await?ing each Vc, then calling format!, then converting to RcStr via .into(). By using macros, we can reduce a lot of boilerplate and potentially offer some opportunities for optimizations by reducing intermediate, throwaway tasks. # How We make use of the "auto-deref" pattern in Rust to choose the "best" formatting option: ValueToString or Display. - Zero-alloc FormatIter: A shared iterator parser over format strings (RawString, EscapedBrace, VarRef, VarRefFormat) that both macros and the derive use, replacing duplicated manual parsing. - Borrow-based capture: turbofmt! uses async { .. } (not async move), so non-Copy types like FileSystemPath can be used in multiple turbofmt! calls without cloning. - Debug on StringifyType: Enables {:?} format specs in turbofmt!. - Converted ~30 call sites across next-core, turbo-tasks-fs, turbopack-core, turbopack-ecmascript, and others. # What's Left - Constants cannot be formatted with turbofmt! yet because of arcane Rust hygiene rules (similar issue to https://github.com/rust-lang/rust/issues/131446) - rust-analyzer doesn't show these format strings as "real" format strings yet because of limitations of the analyzer, but this should be possible to make work. - Automatic derive for ValueToStringRef to avoid intermediate tasks in a few places where formatting is trivial - turbowrite!/turbowriteln! could clean up a bit more code -
Jiwon Choi authored
This PR replaces the legacy PPR configs in the codebase with the `cacheComponents` config. Confirmed deployment test passes https://github.com/vercel/next.js/actions/runs/22533307017 --------- Co-authored-by:
Hendrik Liebau <mail@hendrik-liebau.de>
-
Matt Mastracci authored
# What Make turbotask function registration const -- all function registration blocks are true &'static items, compiled directly into the binary. Removes a few thousand allocations of type names and boxed impls of TaskFn. # Why We have approx 2k functions, so the cost of Lazy construction + temporary allocations adds up (even with compiler optimization). This also unlocks the opportunity for further startup optimizations (in later PRs). # How The `#[turbo_tasks::function]` macro now generates static items initialized directly with const fn constructors instead of `Lazy::new(|| ...)`, using `const { &into_task_fn(f) as &dyn TaskFn }` blocks to produce `&'static dyn TaskFn` trait objects at compile time from zero-sized function items. Global names that previously required runtime format!() + Box::leak() are now computed at compile time via `const_type_name()` (a const wrapper around `std::any::type_name`) and a `const_concat!` macro that concatenates string slices into a fixed-size byte array. The NativeFunction struct, ArgMeta, and the into_task_fn/into_task_fn_with_this wrappers are all const fn-constructible, with input types inferred through a TaskFnInputs trait that maps wrapper types to their argument tuples (we use a non-allocated and non-compiled temporary "duplicate" `TaskFn` instance that is only useful for type inference in a const context). # Next Steps I believe we can remove the const `type_name` in favour of the const `type_id` and instead pull function names only when needed for display purposes. This will show up in a future PR. We can also remove non-const registration for things that aren't functions as well, though I believe this is less important. -
nextjs-bot authored
-
Hendrik Liebau authored
Stacked on #90613 When `@playwright/test` is available, the `instant()` helper now wraps its cookie-based lock acquire and release in `test.step()` calls. This surfaces "Acquire Instant Lock" and "Release Instant Lock" as distinct, labeled entries in the Playwright UI action list instead of anonymous `browserContext.addCookies` calls. `@playwright/test` is added as an optional peer dependency of `@next/playwright`. When it is not installed, the helper behaves exactly as before. Before: <img width="251" alt="before" src="https://github.com/user-attachments/assets/6c68b1d2-012d-4ff9-aa72-9f931dfe55ed" /> After: <img width="251" alt="after" src="https://github.com/user-attachments/assets/0156245d-b52f-4542-b22c-7d538aea5810" /> --------- Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Mitul Shah authored
Redesign the https://github.com/vercel/next.js/pull/87988 error pages to be more aligned with Next.js aesthetic, along with copy to be sharper. | Client | Server | |--------|--------| | <img width="4992" height="2830" alt="CleanShot 2026-03-03 at 17 26 07@2x" src="https://github.com/user-attachments/assets/f42bee3e-2ce8-44dc-9e26-79b81cf965d8" /> | <img width="4992" height="2830" alt="CleanShot 2026-03-03 at 17 23 38@2x" src="https://github.com/user-attachments/assets/19a596c6-6da7-4a42-9b53-16e3c2e6f867" /> | | <img width="4992" height="2830" alt="CleanShot 2026-03-03 at 17 25 22@2x" src="https://github.com/user-attachments/assets/a3075d79-c76a-4fbf-af6e-d4a44f1434eb" /> | <img width="4992" height="2830" alt="CleanShot 2026-03-03 at 17 24 17@2x" src="https://github.com/user-attachments/assets/5811cc98-f8e4-4451-bf9c-501548292245" /> | --------- Co-authored-by:
Jimmy Lai <laijimmy0@gmail.com> Co-authored-by:
Tim Neutkens <tim@timneutkens.nl>
-
Hichem authored
### What? Updated all proxy code examples in the API reference to use the `NextProxy` typed arrow function pattern, consistent with the convention used in `src/proxy.ts`. ### Why? The proxy function is typed as `NextProxy` so parameters are inferred from the type, removing the need for explicit `NextRequest` imports. ### How? Updated all proxy code examples in the API reference to use the `NextProxy` typed arrow function pattern, consistent with the convention used in `src/proxy.ts`. --------- Co-authored-by:
Joseph <sephxd1234@gmail.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Luke Sandberg authored
We only store hashes for TaskTypes in the TaskCache keyspace, so this introduces an allocation free path to compute it. For writing out the TaskCache this wont make much of a difference since we were reusing a scratch buffer, but this should eliminate a source of allocations from the read path. This does of course cause a small binary size regression `157M (160,952K) -> 158M (161,800K) = +1M (+848K)`
-
nextjs-bot authored
-
- 03 Mar, 2026 16 commits
-
-
Jiachi Liu authored
-
nextjs-bot authored
-
Andrew Clark authored
Remove the `parallelRoutesKeys.length === 0` condition from `renderComponentsOnThisLevel` in walk-tree-with-flight-router-state. This check was added to support the behavior where clicking the same link twice forces all page segments to re-render on the server. This should no longer be necessary because the client already adds a refetch marker on those segments, so there's no need to special-case leaf segments on the server side.
-
Luke Sandberg authored
Save space in the persisent store by only recording TaskType one time instead of twice. ## What? Instead of using an encoded TaskType struct as a key in persistent storage just use a 64 bit hash. Now when looking up we actually need to do a cascading read * read task ids that match the hash * restore all the tasks until we find one that matches our CachedTaskType Full cache misses perform the same and so do cache hits since we always end up reading the TaskData anyway (in the `connect_child` operation that immediately follows). This just slightly changes _when_ that second read happens, as such we shouldn't really expect it to slow down. In the case of a hash collisions we do end up doing strictly more work (reading and restoring TaskData entries for the wrong task), but this work is cached and this should be _extremely_ rare assuming a good hash function.. From measuring vercel-site this saves ~231M of data in the persistent cache. (The cache goes from from 3846M -> 3615 or -231M or about -6%). Finally this also addresses a narrow race condition where two racing calls to `get_persistent_task_id` for the same task could result in two entries being pusshed to the `persistent_task_log`, that is now addressed as well. ## Why? Currently we encode 2 copies of every `CachedTaskType` in the database. 1. as the key of the `TaskType`->`TaskId` map (aka `TaskCache` keyspace) 2. as a part of the `TaskStorage` struct stored in the `TaskData` keyspace This redundancy is wasteful. Instead we can make the `TaskCache` map much smaller and add a bit of complexity to lookups. ## Future Work ### Better hash functions Right now to compute the hashes we are just running `encode` and then hashing the bytes. This is not optimal, but we do not have a hash function that is suitable for this usecase. So we should create a new `PersistentHash` trait that TaskInputs implement in order to support this without encoding. Or perhaps a custom _encoder_ that accumulates encoding data to a hasher. This will be addressed in https://github.com/vercel/next.js/pull/89059 ### New SST ffile heuristics now that the TaskcCache keyspace is smaller our heuristics on 'maxiumum number of keys in a file' need to be rethought since we are now producing lots of 7Mb files for the taskcache. this will be addressed in https://github.com/vercel/next.js/pull/89058 ### New compaction semantics Right now we tolerate duplicates in the database but compaction will delete them. This is not too harmful for us since it means if there is a hash coliision we will tend to lose one of the results over time. A better option would be to change compaction semantics for this KeySpace to either tolerate duplicates, leverage values for comparison, or something wilder where we simply 'recompute' the TaskCache instead of compacting it. This will be addressed in https://github.com/vercel/next.js/pull/89075
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
nextjs-bot authored
-
Jiachi Liu authored
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:
Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by:
Cursor Agent <cursoragent@cursor.com>
-
nextjs-bot authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
Turbopack: add anyhow::Context to turbo-persistence mmap, file open, and decompress operations (#90769) ### What? Adds `anyhow::Context` (`.context()` / `.with_context()`) to error-prone operations in the `turbo-persistence` crate: file opens, memory mapping (`mmap`), and LZ4 decompression. ### Why? `get` / `batch_get` sometimes fail with a bare "Cannot allocate memory" error, but the anyhow error chain has no context about *which* file, block, or operation caused it. This makes debugging difficult since the raw OS error propagates through bare `?` operators without any identifying information. ### How? Split double-`?` expressions (e.g. `Mmap::map(&File::open(&path)?)?`) into separate statements so each operation gets its own context. Added `.with_context()` to: - **`compression.rs`** — `decompress()` call in `decompress_into_arc()`, reporting compressed and uncompressed sizes - **`db.rs`** — `File::open`, `Mmap::map`, and `read_u32` in `read_blob()`, reporting the blob file path and size - **`static_sorted_file.rs`** — `File::open` and `Mmap::map` in `open_internal()`, `get_raw_block_slice` and `decompress_into_arc` in `read_block()`, and block offset reads in `get_raw_block_slice()`, reporting SST filename and block index - **`meta_file.rs`** — `options.map()` in `open_internal()`, reporting the meta file path An ENOMEM error will now produce a chain like: ``` Unable to open static sorted file 00000042.sst Caused by: Failed to mmap SST file /path/to/00000042.sst (1234567 bytes) Caused by: Cannot allocate memory (os error 12) ``` -
Delba de Oliveira authored
This PRs unifies the caching story across the docs, making Cache Components the happy path, while still providing guidance to users in the old model. However, instead of explaining the old model and its caching layers, we've created a new guide focusing on what APIs to use and when. This follow-up PR aligns terminology across the docs: https://github.com/vercel/next.js/pull/90589 ## IA updates Getting Started section: - Improves Getting Started progression: - **Before:** CC → Fetching Data → Updating Data → Caching and Revalidating (old and new model mixed) - **After:** Fetching Data (Dynamic) → Mutating Data (Dynamic) → Caching with CC (Prerendering) → Revalidating with CC. - New: `caching.mdx` (CC-first) - Structure: - Enabling Cache Components - Data vs UI-level caching - Working with request time APIs - Passing request values to cached functions - Working with non-deterministic operations - Working with synchronous operations - How rendering works (PPR and static shell story) - New: `revalidating.mdx` (CC-first) - Explains how to use `cacheLife` and `cacheTag` Guides Section: - New: `caching-and-revalidating.mdx` (Previous Model) - For users who are not using CC, includes `fetch` options and route segment config - Moves route segment config options that don't apply to CC from API reference to this guide (for easy archiving in the future). - New: `migrating-to-cache-components.mdx` (WIP) - Del: `caching.mdx`
😌 ## Terminology We should remove caching layers from the docs. Users only needed to be exposed to them when they were configured independently, but the new CC APIs work across layers. To make it easier to review this PR, I'm consolidating terminology and fixing broken links in a new PR: https://github.com/vercel/next.js/pull/90589 --------- Co-authored-by:Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Luke Sandberg authored
## What Replaces the `@babel/code-frame` dependency with a new Rust-based implementation (`next-code-[frame](https://github.com/arthurprs/qfilter/pull/20#issuecomment-3986882055)` crate) for rendering code frames in error messages. ### Why - **Crash fix**: `@babel/code-frame` uses the `js-tokens` library for syntax highlighting, which has [known issues](https://github.com/lydell/js-tokens?tab=readme-ov-file#known-failures) with large string literals and long lines. This can cause Next.js to throw RangeErrors when rendering errors, hiding the original issue! - **Long line support**: The old implementation had no concept of terminal width, dumping entire lines into the output. The new implementation uses "horizontal scrolling" — truncating lines and centering the error location in the visible window. - **Performance**: The Rust implementation only processes the visible line range (typically ~6 lines), not the entire file. Syntax highlighting uses a skip-scan heuristic to start tokenizing near the visible window rather than from byte 0. - **Dependency reduction**: Drops the semi-unmaintained `@babel/code-frame` bundled dependency in favor of code we control. ### Benchmarks In-process benchmarks comparing `render_code_frame()` (Rust, via criterion) against `codeFrameColumns()` (Babel, via hrtime with DCE prevention). Both have syntax highlighting and color output enabled. No process startup or file I/O is included in the measurement. | Scenario | `next-code-frame` (Rust) | `@babel/code-frame` | Speedup | |---|---|---|---| | Small file (~490 lines TSX) | **5.4 µs** | 507 µs | **~94x** | | Large file (~39k lines JS) | **143 µs** | 82.9 ms | **~580x** | | Large file minified | **51 µs** | - | **-** | The gap widens with file size because Babel's `highlight()` runs a regex tokenizer over the **entire source** before slicing to the visible window, while the Rust implementation uses a windowed line index and skip-scan heuristic — only processing the visible window regardless of file size. However, for minified files we do end up tokenizing the whole thing so we end up being only 8x faster ### How - New `crates/next-code-frame/` Rust crate with: - Frame rendering with terminal-width-aware horizontal scrolling - Regex-based syntax highlighting (matching Babel's color scheme) - Skip-scan heuristic for O(1)-ish highlighting regardless of file size - Windowed line index that only scans/stores offsets for the visible region - Comprehensive test suite (800+ lines) - Exposed via both NAPI (native) and WASM bindings - JS wrappers in `packages/next/src/shared/lib/errors/`: - `code-frame.ts` — primary wrapper using native bindings - `optional-code-frame.ts` — graceful fallback returning `undefined` if bindings are unavailable - All existing callsites (`diagnosticFormatter`, `parseScss`, dev overlay, turbopack utils) updated - for `patch-error-inspect.ts` i adopted an `injection` style approach to avoid coupling to the native dependency ### Concerns / review focus areas - **Reliability**: The regex-based tokenizer is best-effort and language-agnostic — it should never crash on invalid syntax, but highlighting accuracy may differ from Babel's `js-tokens` in edge cases. - **Native dependency**: This moves code frame rendering into the native binary. Performance should be better, but worth verifying there are no regressions in environments where native bindings behave differently (e.g. WASM fallback path). - **Regressions**: The output format and color scheme closely match Babel's, but there may be subtle differences. The horizontal scrolling behavior is new. Fixes #85357 Closes PACK-5754
-
Tobias Koppers authored
## Summary Refactors `extractExportedConstValue` and the internal `extractValue` function to use return values instead of exception-based control flow, improving performance during build analysis. ### Commit 1: Refactor `extractExportedConstValue` - Returns `{ value: any } | null` instead of throwing `NoSuchDeclarationError` - `null` when the exported const declaration is not found, `{ value }` when found - Removes `NoSuchDeclarationError` class ### Commit 2: Refactor `extractValue` - Returns `ExtractValueResult` (`{ value: any } | { unsupported: string; path?: string }`) instead of throwing `UnsupportedValueError` - Extracts path-formatting logic from `UnsupportedValueError` constructor into a standalone `formatCodePath` helper - All 6 throw sites become return statements; 3 recursive call sites propagate unsupported results - Removes `UnsupportedValueError` class entirely - Removes all try/catch blocks from the 4 callsites in `get-page-static-info.ts` - Updates `warnAboutUnsupportedValue` to accept the result type directly ## Motivation Both `extractExportedConstValue` and `extractValue` used throw/catch for expected control flow — a missing declaration and unsupported AST node types are normal cases during build analysis, not exceptional errors. Every page/route processed during build hits these functions multiple times. Constructing `Error` objects (which capture stack traces) and unwinding the stack is expensive in V8. Returning discriminated result types avoids this overhead entirely. ## Test Plan - Existing unit tests pass (`test/unit/parse-page-static-info.test.ts` — 5/5) - No behavioral change: callsites produce identical warnings/errors for unsupported values and silently skip missing declarations, same as before -
Tobias Koppers authored
### What? Fix a compilation error in `turbo-persistence` test code where the `StaticSortedFile::lookup` call was missing the required `FIND_ALL` const generic parameter. ### Why? After the `FIND_ALL: bool` const generic was added to `StaticSortedFile::lookup` in #90754, a call site in the test helper `assert_corruption_detected` was not updated, causing `cargo check --all-targets` to fail with: ``` error[E0284]: type annotations needed --> turbopack/crates/turbo-persistence/src/static_sorted_file_builder.rs:1661:19 | 1661 | match sst.lookup(entries[0].hash, &entries[0].key, &kc, &vc) { | ^^^^^^ cannot infer the value of the const parameter `FIND_ALL` ``` ### How? Added explicit turbofish `::<_, false>` to the `lookup` call in the test helper. `false` is the appropriate value since the test only needs to look up a single entry to verify corruption detection. -
Tobias Koppers authored
### What? Adds a lint script (`scripts/check-unused-turbo-tasks.mjs`) that detects unused `#[turbo_tasks::function]`, `#[turbo_tasks::value]`, and `#[turbo_tasks::value_trait]` definitions across the Rust codebase, and removes all currently unused items. ### Why? Dead turbo-tasks definitions add compilation overhead (each generates trait impls, registrations, etc.) and make the codebase harder to navigate. A lint check prevents regressions. ### How? **New script** (`scripts/check-unused-turbo-tasks.mjs`): 1. Discovers all `.rs` files in `turbopack/crates/` and `crates/` (excluding `turbo-tasks-macros-tests`) 2. Parses three kinds of turbo-tasks annotations: - `#[turbo_tasks::function]` → extracts `fn` name + context (free, inherent impl, trait impl, trait default) - `#[turbo_tasks::value]` → extracts `struct`/`enum` name - `#[turbo_tasks::value_trait]` → extracts `trait` name 3. Scans all files for identifier references, excluding definition sites 4. Reports any name that has no external references The script is added to the `pnpm lint` command (runs in parallel with other checks). **Removed 23 unused items** across 18 files: | Kind | Count | Examples | |------|-------|---------| | `value` (struct/enum) | 9 | `OutputAssetsWithAvailability`, `ModuleNameMap`, `OptionModuleIds`, `LockedVersions`, `AssetContentSnapshot` | | `function` | 14 | `client_env`, `next_js_file`, `convert_path`, `is_hot_module_replacement_enabled`, `any_content_changed_of_output_asset` | Also cleaned up imports that became unused after the removals.
-