-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
make UB during CTFE a hard error #86194
Conversation
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try |
⌛ Trying commit 98a710fc2a08c585a96b27a7667bd46a6447787b with merge 8552849d5ae3b6c66b89a0ac2e9c1e3ef5cde346... |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
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.
Looks good to me, but I'll re-assign to someone more involved in const eval.
r? @oli-obk |
🎉 Experiment
|
As far as I can see, these are all spurious. :-) |
98a710f
to
3c08cf8
Compare
This comment has been minimized.
This comment has been minimized.
@RalfJung This seems consistent with @rust-lang/lang consensus. Thanks for working on this! |
@@ -1,5 +1,4 @@ | |||
// build-fail | |||
|
|||
// error-pattern: evaluation of constant value failed |
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 is not great, but arguably the old test already did not match in anything interesting in the error annotations either.
Maybe that was premature :) I can't remember the state of things here. |
Still needs a review; currently @oli-obk is assigned. |
@@ -1,5 +1,8 @@ | |||
#![feature(const_raw_ptr_deref)] | |||
#![feature(const_ptr_offset_from)] | |||
#![feature(core_intrinsics)] | |||
|
|||
use std::intrinsics::ptr_offset_from; |
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 changed this test to call the intrinsic directly, so that we can properly match on the spans for the error messages.
@bors r+ |
📌 Commit 7475661 has been approved by |
☀️ Test successful - checks-actions |
@RalfJung Would it make sense to add a note to https://github.com/rust-lang/reference/blob/master/src/const_eval.md that mentions that undefined behavior is an error? I'm not sure if the ub chapter covers what MIRI checks for, or if those checks should be explicitly listed? |
RFC 3016 contains some explanation of which kinds of UB CTFE will find. (That's less than what Miri-the-tool will find, mostly for performance reasons.) But in general we don't want to make stable guarantees about the set of UB detected by CTFE. So not sure sure if that should be in the reference. |
Is this worth putting in |
Yes, I think it should be. |
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc `@rust-lang/wg-const-eval`
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc `@rust-lang/wg-const-eval`
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc ``@rust-lang/wg-const-eval``
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc ```@rust-lang/wg-const-eval```
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc ````@rust-lang/wg-const-eval````
… r=estebank make const_err show up in future breakage reports As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports. Cc `````@rust-lang/wg-const-eval`````
This is a next step for #71800.
const_err
has been a future-incompatibility lint for 4 months now since #80394 (and err-by-default for many years before that), so I think we could try making it a proper hard error at least in some situations.I didn't yet adjust the tests, since I first want to gauge the fall-out via crater.
Cc @rust-lang/wg-const-eval