Skip to content

Commit

Permalink
chore(turbo-tasks): Delete vc generics support (#70817)
Browse files Browse the repository at this point in the history
The previous PRs in this stack remove the only uses/callsites. This
removes support for vc generics!

There's still a small bit of support left in the form of
`VcValueType::Repr`, but that touches more things, so that'll be a
follow-up PR.

## Why?

Rather than extended support for `Vc` generics to `ResolvedVc`, I plan
to remove support for them entirely. That means fixing all the callsites
(there's not many).

Removing this is needed to get us to a point where 100% of structs can
be `ResolvedValue`, because structs using these fields cannot otherwise
be ported over to `ResolvedVc`.

## Okay, but Why?

Explained here:
vercel/turborepo#8843 (comment)

I expect removing support for this will decrease the overall size of the
codebase, as the logic for supporting generics is rather complicated.
  • Loading branch information
bgw authored and kdy1 committed Oct 10, 2024
1 parent ba65c9d commit d9f812c
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 579 deletions.
1 change: 0 additions & 1 deletion turbopack/crates/turbo-tasks-backend/tests/generics.rs

This file was deleted.

1 change: 0 additions & 1 deletion turbopack/crates/turbo-tasks-memory/tests/generics.rs

This file was deleted.

223 changes: 0 additions & 223 deletions turbopack/crates/turbo-tasks-testing/tests/generics.rs

This file was deleted.

20 changes: 0 additions & 20 deletions turbopack/crates/turbo-tasks-testing/tests/local_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,6 @@ async fn test_store_and_read() -> Result<()> {
.await
}

#[tokio::test]
async fn test_store_and_read_generic() -> Result<()> {
run(&REGISTRATION, || async {
// `Vc<Vec<Vc<T>>>` is stored as `Vc<Vec<Vc<()>>>` and requires special
// transmute handling
let cells: Vc<Vec<Vc<u32>>> =
Vc::local_cell(vec![Vc::local_cell(1), Vc::local_cell(2), Vc::cell(3)]);

let mut output = Vec::new();
for el in cells.await.unwrap() {
output.push(*el.await.unwrap());
}

assert_eq!(output, vec![1, 2, 3]);

Ok(())
})
.await
}

#[turbo_tasks::function(local_cells)]
async fn returns_resolved_local_vc() -> Vc<u32> {
let cell = Vc::<u32>::cell(42);
Expand Down
83 changes: 0 additions & 83 deletions turbopack/crates/turbo-tasks/src/generics/index_map.rs

This file was deleted.

Loading

0 comments on commit d9f812c

Please sign in to comment.