-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fixing unsafe_op_in_unsafe_fn
for std::{os, sys}
#127747
Comments
…workingjubilee Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of rust-lang#127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
…workingjubilee Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of rust-lang#127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
Rollup merge of rust-lang#127750 - ChrisDenton:safe-unsafe-unsafe, r=workingjubilee Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of rust-lang#127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
My current belief is that, like with every edition update so far, we will eventually fix the lint in all relevant places. By "fixed" I mean actually fixing it. However, it is fine if a platform adds more instances of Pinging first everyone who has their own
Also remember to check |
Xous already has Adding it to the top of
But otherwise there are no issues for Xous. |
I think we should add |
Adding |
Thanks for @-ing us @workingjubilee! Adding |
…kingjubilee zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib` This also adds an additional `unsafe` block to address compiler errors. This PR is intended to address rust-lang#127747 for the zkvm target.
Identified and sifted out some targets into their own set.
Hi, you all are currently listed as maintainers for a target that
Unfortunately, the way the |
…kingjubilee zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib` This also adds an additional `unsafe` block to address compiler errors. This PR is intended to address rust-lang#127747 for the zkvm target.
kmc-solid already has
Table
¹ Inline module. Its submodules are implemented in ² Shared with |
Rollup merge of rust-lang#127833 - risc0:erik/zkvm-deny-unsafe, r=workingjubilee zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib` This also adds an additional `unsafe` block to address compiler errors. This PR is intended to address rust-lang#127747 for the zkvm target.
…tgross35 Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]` As part of rust-lang#127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block. I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there. r? libs
…tgross35 Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]` As part of rust-lang#127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block. I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there. r? libs
…tgross35 Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]` As part of rust-lang#127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block. I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there. r? libs
Rollup merge of rust-lang#127763 - ChrisDenton:safe-unsafe-unsafe, r=tgross35 Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]` As part of rust-lang#127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block. I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there. r? libs
…e, r=workingjubilee Fix vita build of std and forbid unsafe in unsafe in the os/vita module See rust-lang#127747 r? `@workingjubilee` `@pheki` `@nikarh`
Rollup merge of rust-lang#128315 - zetanumbers:psvita-unsafe-in-unsafe, r=workingjubilee Fix vita build of std and forbid unsafe in unsafe in the os/vita module See rust-lang#127747 r? `@workingjubilee` `@pheki` `@nikarh`
emscripten is littered throughout the "unix" code, like many others. |
Pinging the remaining tier 3 Unix maintainers for this. Please be aware that when this lint is enabled, all code which is only compiled for tier 3 targets, but nonetheless violates this lint, will cease compiling without any check from CI. As these are all considered "Unix" implementations, it is possible the majority or even all of your
This entire exercise is really a warm-up for actually having the (un)safety in the standard library's platform interfaces properly documented in the actual code and cross-referencing external sources as appropriate. |
Thanks for reminding. AIX does not have specific parts to change. |
Thanks for the heads-up. I added |
|
Hey, thanks for reaching out. I see that in this file there're 8 lines which don't compile for |
All the tier 1 Windows targets have the Windows specific stuff taken care of. There are still some shared code that needs handling in I've not checked tier 3 Windows targets. |
@workingjubilee Regarding the ESP-IDF targets:
Factoring out I wouldn't consider ATM, as it would be a gigantic effort, and so far the "intermingling" had worked well for us actually. We occasionally get a build failure once per a couple of months or so, but since we run a So I would say I prefer to "take the hit", wait until the Tier-1/2 target maintainers fix the |
…fe_fn, r=joboet fix(hermit): `deny(unsafe_op_in_unsafe_fn)` Tracking issue: rust-lang#127747 r? workingjubilee CC: `@stlankes`
…fe_fn, r=joboet fix(hermit): `deny(unsafe_op_in_unsafe_fn)` Tracking issue: rust-lang#127747 r? workingjubilee CC: ``@stlankes``
Rollup merge of rust-lang#128433 - hermit-os:hermit-unsafe_op_in_unsafe_fn, r=joboet fix(hermit): `deny(unsafe_op_in_unsafe_fn)` Tracking issue: rust-lang#127747 r? workingjubilee CC: ``@stlankes``
As you wish. :^) |
As seen in pr #128539, deny_unsafeop_in_unsafe_fn in VxWorks specific files does not affect the build( No code where this lint can be applied is present in VxWorks specific files). VxWorks uses most of Unix library code. |
Forbid unused unsafe in vxworks-specific std modules Tracking issue rust-lang#127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? `@workingjubilee`
Forbid unused unsafe in vxworks-specific std modules Tracking issue rust-lang#127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? ``@workingjubilee``
Forbid unused unsafe in vxworks-specific std modules Tracking issue rust-lang#127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? ```@workingjubilee```
Rollup merge of rust-lang#128539 - biabbas:deny_unsafe, r=workingjubilee Forbid unused unsafe in vxworks-specific std modules Tracking issue rust-lang#127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? ```@workingjubilee```
…_unsafe, r=<try> WASI: foirbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of rust-lang#127747 for WASI try-job: test-various
…it_unsafe, r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of rust-lang#127747 for WASI try-job: test-various
…it_unsafe, r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of rust-lang#127747 for WASI try-job: test-various
…it_unsafe, r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of rust-lang#127747 for WASI try-job: test-various
Rollup merge of rust-lang#128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe, r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of rust-lang#127747 for WASI try-job: test-various
In #127744 we begin to
deny(unsafe_op_in_unsafe_fn)
in the standard library, but there are... many... platforms which all use unsafe code inside unsafe functions. It is unreasonable to fix them all in one step.Even if it is technically possible to do this in one push that "fixes" it for all the platforms we run tier 1/2 CI on, that would be extremely rude. That would then immediately nuke all tier 3 platforms that aren't a variation on the tier 2 ones. We should at least try to allow people to respond before we do so. After all, we will eventually update the standard library to edition 2024 anyway.
To fix each platform, one at a time,
deny(unsafe_op_in_unsafe_fn)
should be moved into that platform's support modules (and even individual functions, if necessary). As we can see from the following test sample, you can have a deny, then an allow, then a deny, and it still works correctly. So we will keep theallow
s at the top level ofstd::os
andstd::sys
in place.For now.
In order to not have one giant table of targets that make my eyes blur, I have split the categories in somewhat arbitrary ways. This is primarily based on the heuristic of "if other examples in this category are fixed, are the rest likely to also be fixed?" except for the "uniques" set, which I expect will almost all require individual attention.
berkeley software descendants
darwinian
linuxen
unixen
embedded unix + newlib
Unix-ish impls mostly intended for embedded-ish usage, all using newlib.
unsafe_op_in_unsafe_fn
when building std for armv6k-nintendo-3ds #127996windows-y
#![deny(unsafe_op_in_unsafe_fn)]
#127750#![deny(unsafe_op_in_unsafe_fn)]
#127763c_void
rather than using the full path #128131uniques
We have a grab bag of others here, some of which are "Unix family" but are... estranged cousins, if so.
deny(unsafe_op_in_unsafe_fn)
#128433#![forbid(unsafe_op_in_unsafe_fn)]
#127873#[forbid(unsafe_op_in_unsafe_fn)]
instdlib
#127833The text was updated successfully, but these errors were encountered: