rust/compiler/rustc_const_eval/src/interpret
Michael Goulet 5460f92a0f
Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk
Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`

As described in <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BinOp.html#variant.Div>, the ordinary `BinOp`s for these are already UB for division by zero ([or overflow](https://llvm.org/docs/LangRef.html#sdiv-instruction), [demo](https://rust.godbolt.org/z/71e7P7Exh)), as MIR building is responsible for inserting code to panic for those cases regardless of whether the overflow checks are enabled.

So we can lower these in the same arm that lowers `wrapping_add` to MIR `BinOp::Add` and such, as all these cases turn into ordinary `Rvalue::BinaryOp`s.
2023-06-02 16:02:06 -07:00
..
intrinsics Remove ExpnKind::Inlined. 2023-05-25 16:43:14 +00:00
cast.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
discriminant.rs Various minor Idx-related tweaks 2023-04-16 02:42:50 -07:00
eval_context.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
intern.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
intrinsics.rs Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk 2023-06-02 16:02:06 -07:00
machine.rs Report a backtrace for memory leaks under Miri 2023-04-16 08:52:00 -04:00
memory.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
mod.rs Add UnwindAction::Unreachable 2023-04-06 09:34:16 +01:00
operand.rs Suppress "erroneous constant used" for constants tainted by errors 2023-05-15 00:00:00 +00:00
operator.rs share BinOp::Offset between CTFE and Miri 2023-04-28 16:00:08 +02:00
place.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
projection.rs Use target instead of machine for mir interpreter integer handling. 2023-02-15 08:56:18 +00:00
step.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
terminator.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
traits.rs add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
util.rs rename needs_subst to has_param 2023-04-27 08:35:19 +01:00
validity.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
visitor.rs basic dyn* support for Miri 2023-02-20 15:08:05 +01:00