This repository was archived by the owner on Dec 17, 2025. It is now read-only.
Open
Conversation
There were two bugs: - Defaults used in combination with constraints would get parsed as part of the constraints because we didn't stop consuming tokens when encountering `=`. - Defaults used in const generics weren't handled at all.
bgw
added a commit
to vercel/next.js
that referenced
this pull request
Dec 5, 2025
…bo task values (#85580) It looks like bincode should reduce the filesystem cache size by ~10% versus pot, because its not a self-describing format. This attempts to add the `bincode::Encode`/`bincode::Decode` traits everywhere, so that we can use those instead of serde. ## Why not use bincode's serde compatibility feature? - Unfortunately, serde has some bugs/incompatibilities/footguns with non-self-describing formats. `bincode`'s traits avoid this by not exposing features that would be incompatible with a self-describing format. https://docs.rs/bincode/latest/bincode/serde/index.html#known-issues - `bincode::Encode`/`Decode` are much simpler traits than serde's equivalents, so we'll probably get some rustc build performance and turbopack binary size benefits from using the bincode versions. In cases where we do have to implement these traits by hand, it's much easier than implementing the serde equivalents. - I'd like to kill `erased-serde` anyways because we're probably paying some performance cost from the large amounts of dynamic dispatch it performs, and we're not getting any benefits from it if we only ever serialize to a single format. ## Forks of Upstream Crates - I've forked `bincode` here: https://github.com/bgw/bincode/commits/bgw/patches/ - I submitted a patch via email to the maintainer via sourcehut - Upstream: https://git.sr.ht/~stygianentity/bincode - Fork: https://git.sr.ht/~bgw/bincode - This adds a few extra derive features and fixes type bounds on `PhantomData`. - The type bounds on `PhantomData` aren't very important, and we could work around it in our code. - We could just fork the derive crate if upstream doesn't want to accept the patches. - And `virtue` here: bgw/virtue@e386f35 - I've submitted a PR to `virtue` here: bincode-org/virtue#94 - This fixes a bug in the parsing of const enums and generics with defaults. - We don't hit this very often as most of our types are not generics, so we could work around it in our code if upstream doesn't want to accept the patch. ## Other Notes - Depends on a patched version of the `bincode` and `virtue` crates to fix a few bugs and add a few new features. I'll work on upstreaming these changes. - This implements `BorrowDecode` everywhere because the `bincode::Decode` derive macro requires it. I plan to add an attribute in my bincode fork to allow disabling this, and then we can get rid of all of the `BorrowDecode` impls. We don't want/need `BorrowDecode` for turbo task values because everything needs to be owned anyways.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into this while using the bincode derive macros.
There were two bugs:
=.API changes:
ConstGenericstruct.