1
Fork 0
rust/compiler/rustc_middle/src
bors ce0d64e03e 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](d866c1c52f..626638fbfe).
2021-05-28 08:49:48 +00:00
..
dep_graph Rollup merge of #85583 - cjgillot:no-previous-dg, r=petrochenkov 2021-05-27 03:02:09 +02:00
hir Auto merge of #85178 - cjgillot:local-crate, r=oli-obk 2021-05-17 01:42:03 +00:00
ich Rename RealFileName::Named to LocalPath and Devirtualized to Remapped 2021-05-05 15:10:50 +01:00
infer Add comment 2021-05-15 12:12:56 -04:00
middle Use () for analysis. 2021-05-12 14:01:16 +02:00
mir emit diagnostic after post-monomorphization errors 2021-05-25 18:39:50 +02:00
query Update compiler/rustc_middle/src/query/mod.rs 2021-05-27 10:31:47 -04:00
traits Make traits with GATs not object safe 2021-04-27 14:34:23 -04:00
ty Auto merge of #85546 - hyd-dev:unwind, r=RalfJung 2021-05-28 08:49:48 +00:00
util Make panic/assert calls in rustc compatible with Rust 2021. 2021-02-03 22:42:53 +01:00
arena.rs Make THIR building a stealable query 2021-05-22 14:36:22 +02:00
lib.rs Auto merge of #84985 - pietroalbini:bootstrap-1.54, r=Mark-Simulacrum 2021-05-25 05:48:00 +00:00
lint.rs Implement span quoting for proc-macros 2021-05-12 00:51:31 -04:00
macros.rs Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk 2020-11-17 12:24:34 +00:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Make THIR building a stealable query 2021-05-22 14:36:22 +02:00