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.

negative explicit variant discriminator not allowed in enums #592

@trevyn

Description

@trevyn

From #537 (comment):

error: Invalid rust syntax, expected literal, got Some(Punct { ch: '-', spacing: Alone, span: #0 bytes(20762..20763) })

#[derive(Encode, Decode)]
pub enum TypeOfFile {
    Unknown = -1,
}

It appears that enum discriminators are encoded as u32, and changing this to i32 will change the byte encoding of positive discriminators as well.

I've done some work on a patch for this if this is a desirable change.

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