about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-02 16:02:06 -0700
committerGitHub <noreply@github.com>2023-06-02 16:02:06 -0700
commit4ecd45a5889153f5844c142e404bf5398b24dfec (patch)
tree6ea5351c8118e8152a91038cab7731b323c8f81c /compiler/rustc_interface/src/errors.rs
parentfcd93accb49b21c908e2b86af9e5f9e5d90534bb (diff)
parent919da2f16ce207dfac883182e8f70ebcd7079b66 (diff)
downloadrust-4ecd45a5889153f5844c142e404bf5398b24dfec.tar.gz
rust-4ecd45a5889153f5844c142e404bf5398b24dfec.zip
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.
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions