Skip to content

Conversation

tgross35
Copy link
Contributor

Our current e! macro makes it easy to run into UB if C headers add a variant that isn't represented in the Rust version. Add a path to migrate away from this by introducing the c_enum! macro which represents a C enum as Rust constants and a type alias.

Part of 1.

@rustbot label +stable-nominated

@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2025

@tgross35: no appropriate reviewer found, use r? to override

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Apr 15, 2025
@tgross35 tgross35 changed the title Introduce a new enum_ macro Introduce a new c_enum macro Apr 15, 2025
@tgross35 tgross35 enabled auto-merge April 15, 2025 23:37
@tgross35 tgross35 added this pull request to the merge queue Apr 15, 2025
@tgross35 tgross35 removed this pull request from the merge queue due to a manual request Apr 16, 2025
@tgross35 tgross35 enabled auto-merge April 16, 2025 00:08
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419
@tgross35 tgross35 added this pull request to the merge queue Apr 16, 2025
Merged via the queue into rust-lang:main with commit e50722e Apr 16, 2025
50 checks passed
@tgross35 tgross35 deleted the enum-macro branch April 16, 2025 01:01
tgross35 added a commit to tgross35/rust-libc that referenced this pull request May 28, 2025
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419

(cherry picked from commit 62051ca)
(backport <rust-lang#4420>)
@tgross35 tgross35 mentioned this pull request May 28, 2025
tgross35 added a commit to tgross35/rust-libc that referenced this pull request May 28, 2025
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419

(cherry picked from commit 62051ca)
(backport <rust-lang#4420>)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request May 28, 2025
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419

(backport <rust-lang#4420>)
(cherry picked from commit 62051ca)
tgross35 added a commit to tgross35/rust-libc that referenced this pull request May 28, 2025
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419

(backport <rust-lang#4420>)
(cherry picked from commit 62051ca)
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Jun 1, 2025
DorianNiemiecSVRJS pushed a commit to DorianNiemiecSVRJS/rust-libc that referenced this pull request Jun 21, 2025
Our current `e!` macro makes it easy to run into UB if C headers add a
variant that isn't represented in the Rust version. Add a path to
migrate away from this by introducing the `c_enum!` macro which
represents a C enum as Rust constants and a type alias.

Part of [1].

[1]: rust-lang#4419

(backport <rust-lang#4420>)
(cherry picked from commit 62051ca)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants