Add regression test and comment

This commit is contained in:
ouz-a 2021-12-14 00:15:50 +03:00
parent a01b13dede
commit b6c80985bd
2 changed files with 10 additions and 1 deletions

View file

@ -328,7 +328,8 @@ 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`).
// (This is workaround for the issue #91636)
assert!(
right.layout.ty.is_any_ptr() || right.layout.ty.is_integral(),
"Unexpected types for BinOp: {:?} {:?} {:?}",