event loop: remove ManagedTask; each callback is its own task type
What does this PR do?
Removes ManagedTask, the event loop's generic callback task, and gives each of its 19 users its own task type. A task now costs one allocation, one free and one indirect call less than before.
ManagedTask was a heap box holding a context pointer, a function pointer and an optional cleanup function, queued under one shared tag. A Task is 16 bytes (tag, context id, pointer), so it has no room for a function pointer. The tag has to say what to run, which is how every other task already works.
- Sites that already had an object (server,
FetchTasklet,RewriterPipe, pluginLoad/Resolve, the VM) queue that pointer under a#[repr(transparent)]wrapper with its own tag. No allocation. - Sites that boxed a payload keep that one box. The graph-context "stop again" task packs its
ContextIdinto the pointer instead. NewServer<SSL, DEBUG>andNewApp<SSL>pick their tag from the const generics.ConcurrentTask::from_callbackand theManagedTaskcase inrelease_refusedare deleted.
Behaviour change: each Taskable impl now decides what happens when the VM stops before the task runs. Boxed payloads are dropped, and the fetch request-drain hop and the HTMLRewriter background pull give back their ref and protect(). These leaked before. Server deinit, the Windows mkdirp hops, the bundler plugin hops and the graph-context tasks stay no-ops there. Every new task keeps ContextId::NONE.
How did you verify your code works?
Debug build on Linux; cargo check for x86_64-pc-windows-msvc. On the debug build: bun-serve-html-405.test.ts (includes the LSan server-teardown test), html-rewriter-leak.test.ts and test/bake/dev/plugins.test.ts pass, and a cancelled dns.promises.Resolver query rejects with ECANCELLED.
Not run: the three Windows-only tasks (type-checked only) and the valkey failure task.