Skip to content

Use .default_enum_style(EnumVariation::ModuleConsts) #1370

Description

@workingjubilee

We actually all kinda hate the current enum style.

It's not correct, due to various reasons, to use Rust enums for every case... we want to only do that in cases where we verify it's correct, like NodeTag. Otherwise it's UB.

A nicer version that looks like Rust enums when you use them but has the same types as we currently use and doesn't have weird UB implications is EnumVariation::ModuleConsts.

Hypothetically, if people wanted we could make a slightly more graceful changeover of taking every enum and running a callback which then generates the old enum style but tagged with #[deprecated(message = "use EnumName::Variant instead"]. I'd accept such a PR. I probably won't write it that way myself. If anyone wants to do that, now is the time, and you'd probably be best-off doing it via ParseCallbacks::enum_variant_{name,behavior} (but don't actually do anything, just record things so you can emit the extra constants later).

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocks-0.12.0build-sysRegarding the "build system" of pgrx which is split between cargo-pgrx, pg-sys, and sql-entity-graph

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions