]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #85546 - hyd-dev:unwind, r=RalfJung
authorbors <bors@rust-lang.org>
Fri, 28 May 2021 08:49:48 +0000 (08:49 +0000)
committerbors <bors@rust-lang.org>
Fri, 28 May 2021 08:49:48 +0000 (08:49 +0000)
commitce0d64e03ef9875e0935bb60e989542b7ec29579
tree759e3bb5281ff07fc4fbf0d182a44afb9471b970
parent18135ec85be45df013ecd0d1eb4a49128d043e20
parentf6348f1924626ea15bc6c4e6be3f525f891767e3
Auto merge of #85546 - hyd-dev:unwind, r=RalfJung

const-eval: disallow unwinding across functions that `!fn_can_unwind()`

Following https://github.com/rust-lang/miri/pull/1776#discussion_r633074343, so r? `@RalfJung`

This PR turns `unwind` in `StackPopCleanup::Goto` into a new enum `StackPopUnwind`, with a `NotAllowed` variant to indicate that unwinding is not allowed. This variant is chosen based on `rustc_middle::ty::layout::fn_can_unwind()` in `eval_fn_call()` when pushing the frame. A check is added in `unwind_to_block()` to report UB if unwinding happens across a `StackPopUnwind::NotAllowed` frame.

Tested with Miri `HEAD` with [minor changes](https://github.com/rust-lang/miri/compare/HEAD..9cf3c7f0d86325a586fbcbf2acdc9232b861f1d8) and the rust-lang/miri#1776 branch with [these changes](https://github.com/rust-lang/miri/compare/d866c1c52f48bf562720383455b75c257bb1ad92..626638fbfe2fff34648dda29a34d59db498a6e52).