Skip to content

macros: Require unsafe in f! invocations - #5302

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
tgross35:f-unsafe
Jul 21, 2026
Merged

macros: Require unsafe in f! invocations#5302
tgross35 merged 1 commit into
rust-lang:mainfrom
tgross35:f-unsafe

Conversation

@tgross35

Copy link
Copy Markdown
Contributor

The current behavior of automatically adding unsafe means the functions read differently from how they actually get defined. This gets confusing, especially in large blocks or diffs where the f! may not be obvious.

Make the unsafe keyword required, similar to most Rust function definitions.

@rustbot

rustbot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an OpenBSD module

cc @semarie

Some changes occurred in an Android module

cc @maurer

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

Some changes occurred in a NetBSD-like module

cc @semarie

The current behavior of automatically adding `unsafe` means the
functions read differently from how they actually get defined. This gets
confusing, especially in large blocks or diffs where the `f!` may not be
obvious.

Make the `unsafe` keyword required, similar to most Rust function
definitions.
@tgross35
tgross35 enabled auto-merge July 21, 2026 18:32
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Jul 21, 2026
@tgross35
tgross35 added this pull request to the merge queue Jul 21, 2026
Merged via the queue into rust-lang:main with commit bbd9253 Jul 21, 2026
57 checks passed
This was referenced Jul 21, 2026
@tgross35
tgross35 deleted the f-unsafe branch July 21, 2026 19:10
jollaitbot pushed a commit to sailfishos-mirror/rust-libc that referenced this pull request Jul 22, 2026
The current behavior of automatically adding `unsafe` means the
functions read differently from how they actually get defined. This gets
confusing, especially in large blocks or diffs where the `f!` may not be
obvious.

Make the `unsafe` keyword required, similar to most Rust function
definitions.

(backport <rust-lang/libc#5302>)
(cherry picked from commit bbd9253)
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.

2 participants