diff options
| author | bors <bors@rust-lang.org> | 2024-05-20 18:04:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-05-20 18:04:19 +0000 |
| commit | be71fd477243f253a735bb35e0cd23cc528cf30a (patch) | |
| tree | c9e82040cf28f18b0cbd9f0187b7d4b0dea5ecdd /compiler/rustc_const_eval/src/transform/validate.rs | |
| parent | 474bee7bf540db9344ca975298b6c1646a74b772 (diff) | |
| parent | 1640225b9d15da64e6af922b4dc3573b337138d0 (diff) | |
| download | rust-be71fd477243f253a735bb35e0cd23cc528cf30a.tar.gz rust-be71fd477243f253a735bb35e0cd23cc528cf30a.zip | |
Auto merge of #125331 - matthiaskrgr:rollup-4kfrh4n, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #124682 (Suggest setting lifetime in borrowck error involving types with elided lifetimes) - #124917 (Check whether the next_node is else-less if in get_return_block) - #125106 (coverage: Memoize and simplify counter expressions) - #125173 (Remove `Rvalue::CheckedBinaryOp`) - #125305 (add some codegen tests for issue 120493) - #125314 ( Add an experimental feature gate for global registration) - #125318 (Migrate `run-make/rustdoc-scrape-examples-whitespace` to `rmake.rs`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src/transform/validate.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index fdc7f6a69cb..3a2b2c5f300 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -1037,8 +1037,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { ) } } - AddUnchecked | SubUnchecked | MulUnchecked | Shl | ShlUnchecked | Shr - | ShrUnchecked => { + AddUnchecked | AddWithOverflow | SubUnchecked | SubWithOverflow + | MulUnchecked | MulWithOverflow | Shl | ShlUnchecked | Shr | ShrUnchecked => { for x in [a, b] { check_kinds!( x, @@ -1067,31 +1067,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { } } } - Rvalue::CheckedBinaryOp(op, vals) => { - use BinOp::*; - let a = vals.0.ty(&self.body.local_decls, self.tcx); - let b = vals.1.ty(&self.body.local_decls, self.tcx); - match op { - Add | Sub | Mul => { - for x in [a, b] { - check_kinds!( - x, - "Cannot perform checked arithmetic on type {:?}", - ty::Uint(..) | ty::Int(..) - ) - } - if a != b { - self.fail( - location, - format!( - "Cannot perform checked arithmetic on unequal types {a:?} and {b:?}" - ), - ); - } - } - _ => self.fail(location, format!("There is no checked version of {op:?}")), - } - } Rvalue::UnaryOp(op, operand) => { let a = operand.ty(&self.body.local_decls, self.tcx); match op { |
