about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-20 04:11:16 +0000
committerbors <bors@rust-lang.org>2024-04-20 04:11:16 +0000
commit9c7b1f4848263b7a39486a2cd482db0d632884e8 (patch)
tree48a19b26eac885c5cfc72c4fd0136f9f8b8fbdac /compiler/rustc_parse/src/errors.rs
parentc8d19a92aa9022eb690899cf6d54fd23cb6877e5 (diff)
parent986d9f104b2da25f7388ad824b9868c3ce1e5f21 (diff)
downloadrust-9c7b1f4848263b7a39486a2cd482db0d632884e8.tar.gz
rust-9c7b1f4848263b7a39486a2cd482db0d632884e8.zip
Auto merge of #124114 - scottmcm:better-checked, r=workingjubilee
Make `checked` ops emit *unchecked* LLVM operations where feasible

For things with easily pre-checked overflow conditions -- shifts and unsigned subtraction -- write the checked methods in such a way that we stop emitting wrapping versions of them.

For example, today <https://rust.godbolt.org/z/qM9YK8Txb> neither
```rust
a.checked_sub(b).unwrap()
```
nor
```rust
a.checked_sub(b).unwrap_unchecked()
```
actually optimizes to `sub nuw`.  After this PR they do.

cc #103299
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions