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.

recursive struct gives: overflow evaluating the requirement SliceReader: Sized #467

@ghost

Description

use std::collections::BTreeMap;

#[derive(bincode::Decode)]
struct AllTypes(BTreeMap<u8, AllTypes>);

fn main() {
    let result: Result<(AllTypes, _), _> = bincode::decode_from_slice(
        &[],
        bincode::config::Configuration::standard().with_limit::<1024>(),
    );
}
[dependencies]
bincode = "2.0.0-beta.0"
error[E0275]: overflow evaluating the requirement `SliceReader: Sized`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`scratchhM619rEHl`)
  = note: required because of the requirements on the impl of `Decoder` for `DecoderImpl<SliceReader, Configuration<LittleEndian, Varint, SkipFixedArrayLength, Limit<1024_usize>>>`
  = note: 128 redundant requirements hidden
  = note: required because of the requirements on the impl of `Decoder` for `&mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut &mut DecoderImpl<SliceReader, Configuration<LittleEndian, Varint, SkipFixedArrayLength, Limit<1024_usize>>>`

This code might be wrong, but is there any way to detect it earlier?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions