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

WTERMSIG (and others) are unsafe on macOS, but safe on Linux #1888

Closed
Thomasdezeeuw opened this issue Sep 10, 2020 · 5 comments
Closed

WTERMSIG (and others) are unsafe on macOS, but safe on Linux #1888

Thomasdezeeuw opened this issue Sep 10, 2020 · 5 comments

Comments

@Thomasdezeeuw
Copy link
Contributor

WTERMSIG and related functions have been changed to no longer require unsafe, seemingly in commit 5a1df22. However on macOS these functions are still unsafe. See the definition on Linux https://docs.rs/libc/0.2.77/libc/fn.WTERMSIG.html (no unsafe) vs. macOS https://docs.rs/libc/0.2.77/x86_64-apple-darwin/libc/fn.WTERMSIG.html (requires unsafe). Was it intentional to leave macOS out?

Also this causes warnings, e.g. see https://github.com/rust-lang/rust/pull/76561/checks?check_run_id=1096958697#step:23:213 (https://github.com/rust-lang/rust/commit/7c3e1ffd7a945b4044e5e80d7d74ba944ff54d0f/checks/1096958697/logs).

/cc @joshtriplett who wrote the commit.

@joshtriplett
Copy link
Member

It's not that I intentionally left macOS out, I just didn't go changing any other targets systematically in that first commit. Now that the infrastructure is in place, by all means we should update various other functions to use it, including on other targets.

And yes, I'm not surprised that this resulted in "unused unsafe" warnings. We should prioritize adding this to matching functions for other targets, to avoid having problems where one target wants unsafe and another doesn't.

@joshtriplett
Copy link
Member

773f556 should fix this on all platforms. The fix should be available in the next release of the libc crate.

@xmo-odoo
Copy link

@joshtriplett @Thomasdezeeuw rustc's Cargo.lock pins to 0.2.85 which was released on Feb. 2, 2021. The unsafe blocks & warning suppressions are still present in the latest rustc, are they still necessary?

@Thomasdezeeuw
Copy link
Contributor Author

@xmo-odoo @joshtriplett did that in rust-lang/rust@16ebf75.

@xmo-odoo
Copy link

@Thomasdezeeuw

did that in rust-lang/rust@16ebf75.

Uh. Weird, I wonder what I fucked up that I apparently reached an outdated revision (through the github search according to my browser history, but now it links to an up-to-date one).

Sorry about that.

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

No branches or pull requests

3 participants