-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Allow Unreachable
terminators unconditionally in const-checking
#71691
Conversation
The reason we forbade these is that we wanted to statically prevent these from existing, instead of catching them post-monomorphization. It's not very clear yet what our story on unsound or unconst things for Although in this case, you're right, nothing problematic can come from it. Even if an unconst/unsound r? @RalfJung for confirmation of my above thoughts |
The dynamic checks are entirely capable of handling I don't know what the concerns are for static checks, but... naively I'd think they should be fine with this as well; if the code does here that means the static checks already failed to prevent "bad" behavior elsewhere. What use-cases does this enable? |
Const-checking currently sees I think there's no reason to forbid |
Makes sense, thanks @ecstatic-morse! @bors r=oli-obk,RalfJung |
📌 Commit a1aff18 has been approved by |
Rollup of 8 pull requests Successful merges: - rust-lang#71148 (Vec drop and truncate: drop using raw slice *mut [T]) - rust-lang#71465 (Add a convenience method on `TyCtxt` for checking for thread locals) - rust-lang#71567 (Handle build completion message from Cargo) - rust-lang#71590 (MIR dump: print pointers consistently with Miri output) - rust-lang#71682 (Bump pulldown-cmark) - rust-lang#71688 (Allow `Downcast` projections unconditionally in const-checking) - rust-lang#71691 (Allow `Unreachable` terminators unconditionally in const-checking) - rust-lang#71719 (Update backtrace-sys) Failed merges: r? @ghost
If we ever actually reach an
Unreachable
terminator while executing, the MIR is ill-formed or the user's program is UB due to something likeunreachable_unchecked
. I don't think we need to forbid these inqualify_min_const_fn
.r? @oli-obk