WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Why this stack overflow? #1505

@frederikhors

Description

@frederikhors

Using this code:

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, utoipa::ToSchema)]
#[serde(untagged)]
pub enum PlayerFilters {
    And(Vec<Self>),
    Id(Id),
    CreatedAt(DateTime),
    CreatedBy(NullId),
    Number(Number<i64>),
    WithEquipment(Box<EquipmentFilters>),
    HasSkill(bool),
}

if I generate schema from utoipa I get this error:

thread 'main' (19548) has overflowed its stack

if I remove the And(Vec<Self>), it works! Why?

Vec<> moves things already on the heap: I don't need Box.

If I remove #[serde(untagged)] is the same.

#1504 does not fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions