diff options
| author | bors <bors@rust-lang.org> | 2021-12-15 00:23:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-15 00:23:44 +0000 |
| commit | d594910a2da12f158477b4c7281716f535cfa3de (patch) | |
| tree | 3736af2bf5abf5caa6f64e54c609fb9d5ed7237f /compiler/rustc_const_eval/src | |
| parent | 2f4da6243f817b26c5c8156408911a01b39f9759 (diff) | |
| parent | bae9270989cda75f891c3099383352daa5435404 (diff) | |
| download | rust-d594910a2da12f158477b4c7281716f535cfa3de.tar.gz rust-d594910a2da12f158477b4c7281716f535cfa3de.zip | |
Auto merge of #91933 - matthiaskrgr:rollup-cw9qolb, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #89825 (Make split_inclusive() on an empty slice yield an empty output) - #91239 (regression test for issue 87490) - #91597 (Recover on invalid operators `<>` and `<=>`) - #91774 (Fix typo for MutVisitor) - #91786 (Return an error when `eval_rvalue_with_identities` fails) - #91798 (Avoid suggest adding `self` in visibility spec) - #91856 (Looser check for overflowing_binary_op) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/operator.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/operator.rs b/compiler/rustc_const_eval/src/interpret/operator.rs index a90582fc338..48c90e1881a 100644 --- a/compiler/rustc_const_eval/src/interpret/operator.rs +++ b/compiler/rustc_const_eval/src/interpret/operator.rs @@ -328,9 +328,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { self.binary_int_op(bin_op, l, left.layout, r, right.layout) } _ if left.layout.ty.is_any_ptr() => { - // The RHS type must be the same *or an integer type* (for `Offset`). + // The RHS type must be a `pointer` *or an integer type* (for `Offset`). + // (Even when both sides are pointers, their type might differ, see issue #91636) assert!( - right.layout.ty == left.layout.ty || right.layout.ty.is_integral(), + right.layout.ty.is_any_ptr() || right.layout.ty.is_integral(), "Unexpected types for BinOp: {:?} {:?} {:?}", left.layout.ty, bin_op, |
