Skip to content
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

Make some inline functions like WIFEXITED and WEXITSTATUS const and safe #1870

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

joshtriplett
Copy link
Member

No description provided.

@rust-highfive
Copy link

r? @JohnTitor

(rust_highfive has picked a reviewer for you, use r? to override)

@JohnTitor
Copy link
Member

I'm quite not sure if we could allow the safe things here; @alexcrichton if you have some time, could you review this? I assume you're familiar with that.

@alexcrichton
Copy link
Member

AFAIK this should be fine to do, there's nothing technically preventing this. I believe the original decision for these functions was uniformity in libc, but that's not necessarily the best thing to optimize for here.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Thanks, Alex! The macro itself looks good to me, let's go ahead :) And thanks to Josh for implementing it!

@JohnTitor JohnTitor merged commit ace7ba8 into rust-lang:master Aug 20, 2020
@joshtriplett joshtriplett deleted the safe-functions branch August 20, 2020 19:42
@joshtriplett
Copy link
Member Author

Awesome, thanks @JohnTitor and @alexcrichton.

xonatius added a commit to xonatius/nix that referenced this pull request Sep 13, 2020
Use #[allow(unused_unsafe)] to work around inconsitency with fn unsafe
in libc after [nix-rust#1870](rust-lang/libc#1870) change.
xonatius added a commit to xonatius/libc that referenced this pull request Sep 13, 2020
The pr rust-lang#1870 introduced safe_f! macro, which made some functions like
WIFEXITED and WEXITSTATUS const and safe on linux_like platform only,
which causes inconsistency when trying to use those functions in crates
compiled across multiple platforms, as using unsafe on those functions
will generate unused_unsafe warning on linux platforms and lack of
unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all
the same functions on other platforms too.
xonatius added a commit to xonatius/libc that referenced this pull request Sep 13, 2020
The pr rust-lang#1870 introduced safe_f! macro, which made some functions like
WIFEXITED and WEXITSTATUS const and safe on linux_like platform only,
which causes inconsistency when trying to use those functions in crates
compiled across multiple platforms, as using unsafe on those functions
will generate unused_unsafe warning on linux platforms and lack of
unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all
the same functions on other platforms too.
vi added a commit to vi/nix that referenced this pull request Sep 13, 2020
(rust-lang/libc#1870)

Denied lint being overridden instead of unsafe block removed
to preserve compatibility with old `libc` versions.
xonatius added a commit to xonatius/nix that referenced this pull request Sep 20, 2020
Use #[allow(unused_unsafe)] to work around inconsitency with fn unsafe
in libc after [nix-rust#1870](rust-lang/libc#1870) change.
yoav-steinberg pushed a commit to yoav-steinberg/nix that referenced this pull request Oct 4, 2020
(rust-lang/libc#1870)

Denied lint being overridden instead of unsafe block removed
to preserve compatibility with old `libc` versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants