next.js
cdb37cc2 - turbo-tasks: pretty-print lazy payloads in TaskStorage Debug + type-id sanity check

Commit
90 days ago
turbo-tasks: pretty-print lazy payloads in TaskStorage Debug + type-id sanity check Debug: - TaskStorage::fmt walks `lazy_tail.present` and routes each set bit through a new schema-emitted `lazy_debug_dispatch(tag, ptr, &mut DebugMap)`, rendering each present variant by its real field name and value. - Dropped Debug from LazyTail and TaskStorageInner: neither can format the tail without a pointer to it, so the owning TaskStorage's hand- written impl is the only one that makes sense. - Added `test_debug_impl_renders_lazy_variant_names` to pin the output contains the inline head plus the lazy variant names and payloads. Type-id sanity check: - Schema now emits `LAZY_TYPE_IDS: [TypeId; LAZY_N + 1]` alongside LAZY_SIZE/LAZY_ALIGN, indexed by tag. - `Tag::debug_assert_type::<T>()` consults the table and `debug_assert_eq!`s against `TypeId::of::<T>()`. Compiles to nothing in release. - Every typed `LazyTail` and `TaskStorage` method (`find`, `find_mut`, `take`, `insert_unchecked`, `replace_in_place`, `lazy_*`) now bounds `T: 'static` and calls `tag.debug_assert_type::<T>()` before the unsafe pointer cast — catches wrong-type-cast bugs at the call site rather than producing UB downstream. Clippy fixes (caught by `cargo clippy --tests`): - `LazyTail::find_mut(&self, ...) -> &mut T` → take `&mut self` (`clippy::mut_from_ref`). - `head_size % LAZY_MAX_ALIGN == 0` → `head_size.is_multiple_of(...)` (`clippy::manual_is_multiple_of`). - Two test setups switched from `LazyTail::default()` + field reassignment to struct-literal init (`clippy::field_reassign_with_default`). All `backend::lazy_tail::tests` (8) and `backend::storage_schema::tests` (17) pass under cargo test, clippy, and Miri's default Stacked Borrows mode.
Author
Committer
Parents
Loading