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

undocumented and potentially unnessary unsafe blocks #1380

Closed
matu3ba opened this issue Jan 31, 2021 · 2 comments
Closed

undocumented and potentially unnessary unsafe blocks #1380

matu3ba opened this issue Jan 31, 2021 · 2 comments

Comments

@matu3ba
Copy link
Contributor

matu3ba commented Jan 31, 2021

In wait.rs are #[allow(unused_unsafe)] annotated blocks and unsafe without explanation.

Looking at the libc crate, they use safe_f macro rules. I think this should mean that usage of this function is safe (in contrast to f macro rule in libc).

Reason for my request is a global lint rule forbidding unused unsafe.

The functions exited, exit_status, signaled, term_signal, dumped_core, stopped, stop_signal are also untested.

What am I missing on this?

@asomers
Copy link
Member

asomers commented Feb 13, 2021

They're there because libc originally defined those functions as unsafe, then later change them into safe functions. The #[allow] directive was necessary in order to allow Nix to build with both old and new versions of libc. If Nix's minimum version of libc now exceeds the version that made those functions safe (I haven't checked), then please submit a PR removing the directive.

See also #1294 .

@matu3ba
Copy link
Contributor Author

matu3ba commented Feb 13, 2021

Take a look for example at libc tag 0.2.82 fuchsia and all non-windows systems.

newlibc in crate libc has currently no definition or bindings to the according status requests (probably due to targeting embedded area).

Will link the PR.

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

2 participants