-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
implement zeroed and uninitialized with MaybeUninit #69922
Conversation
r? @oli-obk |
This comment has been minimized.
This comment has been minimized.
@bors r+ |
📌 Commit c7eb0f2 has been approved by |
@bors rollup=never to make this bisectable |
@bors p=1 |
Giving back priority (#69922 (comment)) |
⌛ Testing commit c7eb0f2 with merge 954159622b131f800ed65cbd9e60585d03dac100... |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-azure |
|
||
const SIZE: usize = 1024 * 1024; | ||
|
||
fn main() { | ||
// do the test in a new thread to avoid (spurious?) stack overflows | ||
thread::spawn(|| { | ||
let _memory: [u8; SIZE] = unsafe { init() }; | ||
let _memory: [u8; SIZE] = unsafe { mem::zeroed() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing on the "noopt" builder. And that makes sense; there's now a function call "in the way" here where previously the intrinsic was expanded in-line to zero-initializing LLVM IR.
@oli-obk I added |
Maybe we should mark the wrapper functions as |
Sure, I can do that. Note that this already applied before this PR. |
Oh, right. so it's the more complex code in MaybeUninit that llvm doesn't handle without optimizations. I guess that's alright, though maybe we can teach mir optimizations about that at some point. @bors r+ |
📌 Commit a2160e6 has been approved by |
implement zeroed and uninitialized with MaybeUninit This is the second attempt of doing such a change (first PR: rust-lang#62150). The last change [got reverted](rust-lang#63343) because it [caused](rust-lang#62825) some [issues](rust-lang#52898 (comment)) in [code that incorrectly used these functions](AltF02/x11-rs#99). Since then, the [problematic code has been fixed](AltF02/x11-rs#101), and rustc [gained a lint](rust-lang#63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](rust-lang#66059) instead of causing UB for some incorrect uses. Fixes rust-lang#62825
@bors retry rollup=maybe Ignoring |
⌛ Testing commit a2160e6 with merge 1d1d192555bc828cdc42a61cd9b6a02c6b260960... |
implement zeroed and uninitialized with MaybeUninit This is the second attempt of doing such a change (first PR: rust-lang#62150). The last change [got reverted](rust-lang#63343) because it [caused](rust-lang#62825) some [issues](rust-lang#52898 (comment)) in [code that incorrectly used these functions](AltF02/x11-rs#99). Since then, the [problematic code has been fixed](AltF02/x11-rs#101), and rustc [gained a lint](rust-lang#63346) that is able to detect many misuses of these functions statically and a [dynamic check that panics](rust-lang#66059) instead of causing UB for some incorrect uses. Fixes rust-lang#62825
💔 Test failed - checks-azure |
"Received request to deprovision: The request was cancelled by the remote provider."...? @bors retry |
⌛ Testing commit a2160e6 with merge 8da5b0313f3288a314a81f571c81ac9957b0df5e... |
@bors retry rolled up. |
Rollup of 7 pull requests Successful merges: - #68746 (Make macro metavars respect (non-)hygiene) - #69688 (Move tidy check to mingw-check) - #69735 (bootstrap: Use hash to determine if sanitizers needs to be rebuilt) - #69922 (implement zeroed and uninitialized with MaybeUninit) - #69956 (Ensure HAS_FREE_LOCAL_NAMES is set for ReFree) - #70061 (Cosmetic fixes in documentation) - #70064 (Update books) Failed merges: r? @ghost
x11-dl was using std::mem::uninitialized incorrectly and when rustlang added MaybeUninit and intrinsic panics on UB caused by improper use of uninitialized (see rust-lang/rust/pull/69922) it caused issues with X11 initialization. x11-dl pr AltF02/x11-rs/pull/101 updated x11-dl to use MaybeUninit correctly
x11-dl was using std::mem::uninitialized incorrectly and when rustlang added MaybeUninit and intrinsic panics on UB caused by improper use of uninitialized (see rust-lang/rust/pull/69922) it caused issues with X11 initialization. x11-dl pr AltF02/x11-rs/pull/101 updated x11-dl to use MaybeUninit correctly
This is the second attempt of doing such a change (first PR: #62150). The last change got reverted because it caused some issues in code that incorrectly used these functions.
Since then, the problematic code has been fixed, and rustc gained a lint that is able to detect many misuses of these functions statically and a dynamic check that panics instead of causing UB for some incorrect uses.
Fixes #62825