Skip to content

remove the safe keyword from a c-variadic foreign function. #1838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

folkertdev
Copy link
Contributor

Calling a c-variadic function is never safe: passing an unexpected number of arguments, or arguments of an unexpected type, is UB.

As requested in rust-lang/rust#141733 (comment), cc @ehuss

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jun 3, 2025
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

Calling a c-variadic function is never safe: passing an unexpected number of arguments, or arguments of an unexpected type, is UB.
@ehuss ehuss force-pushed the c-variadic-remove-safe-keyword branch from d23cd92 to 3c50306 Compare June 3, 2025 21:26
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks! I went ahead and changed it to also include the unsafe keyword for consistency, and there is a general intention of making this more of a style it.

@ehuss ehuss enabled auto-merge June 3, 2025 21:27
@ehuss ehuss added this pull request to the merge queue Jun 3, 2025
Merged via the queue into rust-lang:master with commit 056d4e6 Jun 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: The marked PR is awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants