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
commit5460f92a0f97238e87fef281134b08deb2f587ee (patch)
treecb108b149eb72261ac2ddd42adc1e42b4f82bb8b /compiler/rustc_interface/src/errors.rs
parentdd09f4d35c5b6881f0eb757b5fd8c1604be3b06a (diff)
parentadb37d4999cbb83bd670bb767b3c8d08e43e3c7c (diff)
downloadrust-5460f92a0f97238e87fef281134b08deb2f587ee.tar.gz
rust-5460f92a0f97238e87fef281134b08deb2f587ee.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