rust/compiler/rustc_middle/src/mir
Jubilee ea453bb10b
Rollup merge of #130885 - RalfJung:interp-error-discard, r=oli-obk
panic when an interpreter error gets unintentionally discarded

One important invariant of Miri is that when an interpreter error is raised (*in particular* a UB error), those must not be discarded: it's not okay to just check `foo().is_err()` and then continue executing.

This seems to catch new contributors by surprise fairly regularly, so this PR tries to make it so that *if* this ever happens, we get a panic rather than a silent missed UB bug. The interpreter error type now contains a "guard" that panics on drop, and that is explicitly passed to `mem::forget` when an error is deliberately discarded.

Fixes https://github.com/rust-lang/miri/issues/3855
2024-10-01 23:15:59 -07:00
..
interpret make InterpResult a dedicated type to avoid accidentally discarding the error 2024-10-01 21:45:35 +02:00
basic_blocks.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
consts.rs make InterpResult a dedicated type to avoid accidentally discarding the error 2024-10-01 21:45:35 +02:00
coverage.rs coverage: Rename CodeRegion to SourceRegion 2024-08-28 22:17:42 +10:00
generic_graph.rs Add warn(unreachable_pub) to rustc_middle. 2024-08-29 20:13:06 +10:00
generic_graphviz.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
graphviz.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
mod.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
mono.rs Replace -Z default-hidden-visibility with -Z default-visibility 2024-10-01 22:32:13 +10:00
patch.rs Remove #[macro_use] extern crate tracing from rustc_middle. 2024-05-23 18:02:40 +10:00
pretty.rs Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
query.rs be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
statement.rs be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
syntax.rs update doc comment 2024-09-24 23:12:02 +02:00
tcx.rs rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
terminator.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
traversal.rs Compute reachable locals as part of non_ssa_locals 2024-09-21 01:07:00 -04:00
type_foldable.rs Make DefiningAnchor::Bind only store the opaque types that may be constrained, instead of the current infcx root item. 2024-03-11 17:19:37 +00:00
visit.rs Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00