Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

bincode::encode_to_vec is incompatible with bincode::serde::encode_to_vec in standard configuration #613

@JanBeh

Description

@JanBeh

Using version 2.0.0-rc.2, the following code:

fn main() {
    let array: [u8; 3] = [11, 12, 13];
    let stdcfg = bincode::config::standard();
    assert_eq!(
        bincode::encode_to_vec(&array, stdcfg).unwrap(),
        bincode::serde::encode_to_vec(&array, stdcfg).unwrap(),
    );
}

Fails with:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `[3, 11, 12, 13]`,
 right: `[11, 12, 13]`', src/main.rs:6:5

This means bincode::encode_to_vec isn't compatible with bincode::serde::encode_to_vec. This is highly surprising.

See also: How can bincode distinguish between tuples and (fixed size) arrays? on URLO.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions