Rollup merge of #91856 - ouz-a:master, r=oli-obk
Looser check for overflowing_binary_op Fix for issue #91636 tight check resulted in ICE, this makes the check a little looser. It seems `eq` allows comparing of `supertype` and `subtype` if `lhs = supertype` and `rhs = subtype` but not vice versa, is this intended behavior ?
This commit is contained in:
commit
bae9270989
2 changed files with 12 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue