Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bincode v2.0.0 error: cannot find decode_borrowed_from_slice #2876

Open
BeadiestStar64 opened this issue Mar 7, 2025 · 5 comments
Open

bincode v2.0.0 error: cannot find decode_borrowed_from_slice #2876

BeadiestStar64 opened this issue Mar 7, 2025 · 5 comments

Comments

@BeadiestStar64
Copy link

Describe the bug
When I do a cargo build with Burn as a dependency, cargo reports that Burn Core cannot find bincode::serde.

To Reproduce

  1. Execute cargo add burn --features wgpu.
  2. Execute cargo test.

Expected behavior
Pass the test without any problems.

Screenshots
Image

Desktop (please complete the following information):

  • OS: Windows 11 Home 24H2
  • Rust Edition: 2021
@laggui
Copy link
Member

laggui commented Mar 7, 2025

bincode version 2.0.0 was officially released yesterday, which introduced some breaking changes.

Burn uses 2.0.0-rc.3, but cargo dependency resolver treats pre-release versions (-rc.3) as lower priority than stable releases... so it fetches the 2.0.0 release (which is not compatible).

For the released Burn versions, please add an explicit dependency to the pre-release version in your Cargo.toml:

[dependencies]
burn = { version = "0.16.0", features = ["wgpu"] }
bincode = "=2.0.0-rc.3"
bincode_derive = "=2.0.0-rc.3"

The new bincode release also only supports 1.85 MSRV, so for now we'll have to explicitly pin the release candidate on main and eventually upgrade to the last release.

@BeadiestStar64
Copy link
Author

Thank you so much for your detailed explanation and solution.
As you suggested, adding an explicit dependency on the pre-release version of bincode quickly resolved the issue👍

asukaminato0721 added a commit to open-spaced-repetition/fsrs-rs-nodejs that referenced this issue Mar 8, 2025
asukaminato0721 added a commit to open-spaced-repetition/fsrs-rs-nodejs that referenced this issue Mar 8, 2025
@DaniilSkLi DaniilSkLi marked this as a duplicate of #2879 Mar 9, 2025
@laggui
Copy link
Member

laggui commented Mar 10, 2025

Re-opening in favor of #2880 since an explanation and solution has been given here.

@laggui laggui reopened this Mar 10, 2025
@laggui laggui changed the title Burn cannot find decode_borrowed_from_slice bincode v2.0.0 error: cannot find decode_borrowed_from_slice Mar 10, 2025
@alessandromazza98
Copy link

alessandromazza98 commented Mar 11, 2025

is there an eta for the fix on main branch? or new release ideally.

@laggui
Copy link
Member

laggui commented Mar 11, 2025

For some reason cargo was not resolving to bincode v2.0 locally or on the CI so I thought the pinned rc3 had been merged, but it's still contained in another PR.

Just opened a PR for this fix specifically. Will update to 2.0 once rust 1.86 comes out because we always support current (1.85) and prev (1.84), and bincode 2.0 has MSRV 1.85.

No ETA for a release at this time, we have a couple of things we still want to do to wrap up the next release 🙂

@laggui laggui marked this as a duplicate of #2897 Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants