-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Get rid of uses of mem::uninitialized #62397
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
…lacrum Remove last use of mem::uninitialized in SGX See rust-lang#62397
…lacrum Remove last use of mem::uninitialized in SGX See rust-lang#62397
…xcrichton Remove some uses of mem::uninitialized cc rust-lang#62397 r? @RalfJung
…xcrichton Remove some uses of mem::uninitialized cc rust-lang#62397 r? @RalfJung
…xcrichton Remove some uses of mem::uninitialized cc rust-lang#62397 r? @RalfJung
…xcrichton Remove some uses of mem::uninitialized cc rust-lang#62397 r? @RalfJung
Going to take a stab at addressing this issue if that's all right. |
Actually looks like some of this was already handled. |
The SGX and libterm and codegen ones have been handled. CloudAbi and |
Ah, gotcha. Will take a crack at it. Thanks! |
And what about all the tests? |
Good question. I'm a bit less confident with figuring out how to handle those tests. I removed My progress can be viewed here for reference/guidance. |
I'm less worried about the tests TBH. The affected ones fairly deliberately cause UB. They can probably be fixed by replacing it with @JulianGindi IMO it anyway makes sense to separate the test changes from the others as they are unrelated, so why don't you make a PR with what you got? |
Sounds good @RalfJung. I have that test code as well for later if we want to move forwards with it. I have submitted the PR and it's linked above. |
The remaining open boxes in this issue are up for grabs again. To properly fix this, you should have some experience with unsafe code. Maybe I should mark this "hard" instead of "medium"? I don't know how to figure out which label is more appropriate. It's not a lot of work to do this, but it requires rewriting some subtle unsafe code that deals with uninitialized memory. |
Remove last use of mem::uninitialized from std::io::util Addresses rust-lang#62397 for std::io::util
@nathanwhit please make you to mention in an issue when you are (partially) addressing it. Now we both did the same work but in different ways. |
I'm sorry, that's totally my mistake. These are my first few contributions, so I'm still in the process of learning the ropes. I'll make sure to do so in the future. |
No hard feelings, just letting you know. :) |
Seems like under the new UB guidelines, those tests should be testing unspecified rather than uninitialised values. (I believe they're being called "frozen" values?) |
do not use assume_init in std::io Cc rust-lang#62397
I've done work on addressing this for CloudAbi (excluding the tests), the PR with my work so far is #62738, feedback is much appreciated! |
do not use assume_init in std::io Cc rust-lang#62397
… r=RalfJung Remove uses of mem::uninitialized from std::sys::cloudabi Addresses rust-lang#62397 for std::sys::cloudabi, excluding the tests within cloudabi, which will be a separate PR
… r=RalfJung Remove uses of mem::uninitialized from std::sys::cloudabi Addresses rust-lang#62397 for std::sys::cloudabi, excluding the tests within cloudabi, which will be a separate PR
… r=RalfJung Remove uses of mem::uninitialized from std::sys::cloudabi Addresses rust-lang#62397 for std::sys::cloudabi, excluding the tests within cloudabi, which will be a separate PR
…fJung Remove uses of `mem::uninitialized()` from cloudabi This PR removes uses of `mem::uninitialized` from `cloudabi` module, excluding the layout test in `src/libstd/sys/cloudabi/abi/cloudabi.rs`. r? @RalfJung cc @EdSchouten cc rust-lang#62397
…fJung Remove uses of `mem::uninitialized()` from cloudabi This PR removes uses of `mem::uninitialized` from `cloudabi` module, excluding the layout test in `src/libstd/sys/cloudabi/abi/cloudabi.rs`. r? @RalfJung cc @EdSchouten cc rust-lang#62397
Remaining (removable) cases in our test cases are removed in #67507. I also filed NuxiNL/cloudabi#18 upstream to suggest fixing the CloudABI piece; I don't think we should keep this open once #67507 lands as the CloudABI issue must be fixed upstream (the file says "don't edit"). |
I've updated the upstream |
Uh oh!
There was an error while loading. Please reload this page.
007d87f added a bunch of
allow(deprecated)
because there are still a few places where we usemem::uninitialized
. These should all be fixed, to remove theallow
(and hopefully prevent other deprecated methods from being used there).src/libstd/sys/cloudabi/abi/cloudabi.rs
)Cc @EdSchouten for CloudAbi, @jethrogb for SGX.
The text was updated successfully, but these errors were encountered: