Fix ICEs on invalid vtable size/alignment const UB errors#86245
Fix ICEs on invalid vtable size/alignment const UB errors#86245bors merged 2 commits intorust-lang:masterfrom
Conversation
|
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
c29f599 to
b38e376
Compare
There was a problem hiding this comment.
I feel like InvalidVtable{Size,Alignment,DropFn} would be clearer names for these variants. What do you think?
There was a problem hiding this comment.
sure, I'll do that ! I initially did name those specifically for vtables but then InvalidDropFn "convinced me" not to do so ^^
There was a problem hiding this comment.
| // ICEs as tracked by #86193. So we also use the transparent wrapper to verify actual const UB hard | |
| // errors are emitted now instead of ICEs. | |
| // ICEs as tracked by #86193. So we also use the transparent wrapper to verify proper validation | |
| // errors are emitted instead of ICEs. |
There was a problem hiding this comment.
There was a problem hiding this comment.
if you and oli want this, I can certainly do that in this PR
There was a problem hiding this comment.
This will affect many tests, so it should be a separate PR. Reviewing is also much easier if we keep PRs small. But sure, if you want to help with this that'd be great. :)
There was a problem hiding this comment.
Agreed, I'll do that in another PR.
Would something like this work for you ? Changing ValidationFailure's content from a String message to a path: Option<String>, mesg: String so that
rust/compiler/rustc_mir/src/interpret/validity.rs
Lines 27 to 47 in 3e827cc
(I don't know when I'll get to this though: I'm currently having trouble executing some 32bits tests of the master branch, which fail with syntax errors when executed in the test runner but not by themselves, making blessing tests rather ... difficult. Thankfully it did not happen on the test in this PR 😓 )
There was a problem hiding this comment.
Let's discuss the implementation details elsewhere (possibly on Zulip), if/when @oli-obk agrees that we even want to do this. :)
There was a problem hiding this comment.
I agree that the proposed ordering is better than the current one
|
This looks great, thanks a lot. :-) |
|
📌 Commit 9c7133c95bdfaf3b14798f61d40edeb1564b2ed3 has been approved by |
This comment has been minimized.
This comment has been minimized.
|
@bors r- |
They were "freeform const UB" error message, but could reach validation and trigger ICEs there. We now catch them during validation to avoid that.
|
CI is green after actually calling rustfmt... @bors r=RalfJung |
|
📌 Commit e29f3e8 has been approved by |
|
☀️ Test successful - checks-actions |
Improve CTFE UB validation error messages As mentioned in rust-lang#86245 (comment) this PR slightly improves the formatting of validation errors, to move the path to the error prefix. From: `type validation failed: encountered invalid vtable: size is bigger than largest supported object at .0` To: `type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object`.
Improve CTFE UB validation error messages As mentioned in rust-lang#86245 (comment) this PR slightly improves the formatting of validation errors, to move the path to the error prefix. From: `type validation failed: encountered invalid vtable: size is bigger than largest supported object at .0` To: `type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object`.
The invalid vtable size/alignment errors from
InterpCx::read_size_and_align_from_vtablewere "freeform const UB errors", causing ICEs when reaching validation. This PR turns them into const UB hard errors to catch them during validation and avoid that.Fixes #86193
r? @RalfJung
(It seemed cleaner to have 2 variants but they can be merged into one variant with a message payload if you prefer that ?)