Make TerminatorKind::Abort an error in all const contexts#77460
Make TerminatorKind::Abort an error in all const contexts#77460ecstatic-morse wants to merge 1 commit intorust-lang:masterfrom
TerminatorKind::Abort an error in all const contexts#77460Conversation
I'm not too up-to-date on FFI-unwind stuff, but `Abort` denotes that panics inside function calls (usually across an FFI boundary) will abort immediately. These semantics are not supported by Miri, and I don't think you can even enable them on the current stable. Forbid them in all const-contexts before that last part changes.
I am not sure what you mean by this... how could a terminator have any semantics when it is not even run? AFAIK Miri implements the abort terminator correctly, and we even have a test for that. If you know of a program that is executed incorrectly under Miri, I'd be curious to learn about that. |
|
Here's what the code looks like in the const-eval engine: rust/compiler/rustc_mir/src/interpret/machine.rs Lines 178 to 180 in a585aae I'll ask in a different way: What's the long-term plan for unwinding/aborting in the const-eval engine? I don't see why |
TerminatorKind::Abort an error in all contextsTerminatorKind::Abort an error in all const contexts
AFAIK the plan is that panics immediately abort execution with an error pointing at the panic site. Thus, no unwinding would happen. It seems reasonable to do something similar for aborts. The error should maybe be made nicer ("unsupported" errors are meant to be prevented by the static checks I think), but other than that I see no problem with just allowing it in the static checks. EDIT: actually, if no unwinding ever happens, this code is ureachable anyway. So yeah we can probably just allow abort terminators. Maybe with a comment in some suitable place saying that |
|
Obseleted by #77512 |
I'm not too up-to-date on FFI-unwind stuff, but
Abortdenotes that panics inside function calls (usually across an FFI boundary) will abort immediately. These semantics are not supported byMirithe const-eval engine AFAICT, and I don't think you can even enable them on the current stable. Forbid them in all const-contexts before that last part changes.r? @oli-obk
cc @RalfJung (for long-term plan around
Abortin Miri)