-
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
Abort if a promoted fails to be const evaluable and its runtime checks didn't trigger #52571
Conversation
@bors r+ |
📌 Commit 7064f69 has been approved by |
A test would be great still. Either a codegen or run-pass that self-invokes is fine. |
@bors r=nagisa |
📌 Commit 92fad0f has been approved by |
This comment has been minimized.
This comment has been minimized.
@bors r=nagisa |
📌 Commit 297ad72 has been approved by |
@bors r- You cannot spawn a process on wasm32. Please
|
@bors r=nagisa |
📌 Commit 555a7b4 has been approved by |
.stdout(Stdio::piped()) | ||
.stdin(Stdio::piped()) | ||
.arg("test").output().unwrap(); | ||
assert!(!p.status.success()); |
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 would also pass if the program SEGFAULTs (like some variants of this did) instead of SIGILLs... but I am not sure how to test for this properly, so whatever.^^
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.
rust/src/test/run-pass/segfault-no-out-of-stack.rs
Lines 26 to 40 in a5c2d0f
#[cfg(unix)] | |
fn check_status(status: std::process::ExitStatus) | |
{ | |
use libc; | |
use std::os::unix::process::ExitStatusExt; | |
assert!(status.signal() == Some(libc::SIGSEGV) | |
|| status.signal() == Some(libc::SIGBUS)); | |
} | |
#[cfg(not(unix))] | |
fn check_status(status: std::process::ExitStatus) | |
{ | |
assert!(!status.success()); | |
} |
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.
So...? That's how this test could be improved, is what you are saying?
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.
I mean we already have copy-pastable code that does the exact checking necessary here. We should avoid writing non-trivial tests by hand when there's already a good example.
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// ignore-wasm |
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.
Sorry it should be // ignore-wasm32
😭 (or maybe // ignore-emscripten
to include asm.js too, I'm not sure if asm.js can run a program)
@bors r=nagisa |
📌 Commit 233a6e1 has been approved by |
☀️ Test successful - status-appveyor, status-travis |
[beta] Abort instead of UB if promotion fails original PR: #52571 (not beta approved yet) r? @nikomatsakis cc @RalfJung
landed in beta in #52624 |
[beta] Abort instead of UB if promotion fails original PR: rust-lang/rust#52571 (not beta approved yet) r? @nikomatsakis cc @RalfJung
r? @eddyb
cc @RalfJung @nagisa
cc #49760