rust/compiler/rustc_const_eval/src
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
..
const_eval Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
interpret Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk 2023-06-02 16:02:06 -07:00
transform Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
util Remove const eval limit and implement an exponential backoff lint instead 2023-05-31 10:24:17 +00:00
errors.rs fix diagnostic message 2023-06-01 14:45:19 +00:00
lib.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00