Skip to content

C enums as module consts + deprecation#1748

Merged
workingjubilee merged 7 commits into
pgcentralfoundation:developfrom
workingjubilee:c-enums-as-module-consts
Jul 5, 2024
Merged

C enums as module consts + deprecation#1748
workingjubilee merged 7 commits into
pgcentralfoundation:developfrom
workingjubilee:c-enums-as-module-consts

Conversation

@workingjubilee

@workingjubilee workingjubilee commented Jul 4, 2024

Copy link
Copy Markdown
Member

I tried to do without the deprecation warning code but I found it simply so annoying that rustc couldn't find the right names (its Levenshtein-derived algorithm doesn't reason about pathnames quite that way) that I figured it would be easiest to simply add the relevant codegen. That made it possible to distinguish between disappearing types and now-outdated names.

Closes #1370.

@workingjubilee workingjubilee force-pushed the c-enums-as-module-consts branch 2 times, most recently from aa21e3b to 37467f8 Compare July 4, 2024 00:38
@eeeebbbbrrrr

Copy link
Copy Markdown
Contributor

This is cool. Has this ModuleConsts form always been there or is it relatively new to bindgen? Neat

@workingjubilee

Copy link
Copy Markdown
Member Author

It's been there since before pgrx's initial commit.

Comment thread pgrx-pg-sys/build.rs
Comment thread pgrx-pg-sys/build.rs Outdated
Comment thread pgrx-pg-sys/build.rs
Comment thread pgrx-pg-sys/build.rs Outdated
Comment thread pgrx-pg-sys/build.rs Outdated
Comment thread pgrx/src/callbacks.rs
Comment on lines +63 to +70
XACT_EVENT_ABORT => PgXactCallbackEvent::Abort,
XACT_EVENT_COMMIT => PgXactCallbackEvent::Commit,
XACT_EVENT_PARALLEL_ABORT => PgXactCallbackEvent::ParallelAbort,
XACT_EVENT_PARALLEL_COMMIT => PgXactCallbackEvent::ParallelCommit,
XACT_EVENT_PARALLEL_PRE_COMMIT => PgXactCallbackEvent::ParallelPreCommit,
XACT_EVENT_PREPARE => PgXactCallbackEvent::Prepare,
XACT_EVENT_PRE_COMMIT => PgXactCallbackEvent::PreCommit,
XACT_EVENT_PRE_PREPARE => PgXactCallbackEvent::PrePrepare,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making these matches a bit less awful to read was basically my primary goal here.

Comment thread pgrx-pg-sys/build.rs
@workingjubilee workingjubilee merged commit 80ea231 into pgcentralfoundation:develop Jul 5, 2024
usamoi pushed a commit to tensorchord/pgrx that referenced this pull request Mar 6, 2025
I tried to do without the deprecation warning code but I found it simply
so annoying that rustc couldn't find the right names (its
Levenshtein-derived algorithm doesn't reason about pathnames quite that
way) that I figured it would be easiest to simply add the relevant
codegen. That made it possible to distinguish between disappearing types
and now-outdated names.

Closes pgcentralfoundation#1370.
workingjubilee added a commit to workingjubilee/pgrx that referenced this pull request Oct 28, 2025
This was added as a mercy in pgcentralfoundation#1748 to help migration but time is up:
It has been over a year now.
@workingjubilee workingjubilee deleted the c-enums-as-module-consts branch October 28, 2025 06:39
workingjubilee added a commit that referenced this pull request Oct 28, 2025
This was added as a mercy in #1748 to help
migration but time is up: It has been over a year now.
daamien pushed a commit to daamien/pgrx that referenced this pull request Dec 15, 2025
This was added as a mercy in pgcentralfoundation#1748 to help
migration but time is up: It has been over a year now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use .default_enum_style(EnumVariation::ModuleConsts)

2 participants