Add regression test and comment
This commit is contained in:
parent
a01b13dede
commit
b6c80985bd
2 changed files with 10 additions and 1 deletions
|
@ -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: {:?} {:?} {:?}",
|
||||
|
|
8
src/test/ui/binop/binary-op-on-fn-ptr-eq.rs
Normal file
8
src/test/ui/binop/binary-op-on-fn-ptr-eq.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Tests equality between supertype and subtype of a function
|
||||
// See the issue #91636
|
||||
fn foo(_a: &str) {}
|
||||
|
||||
fn main() {
|
||||
let x = foo as fn(&'static str);
|
||||
let _ = x == foo;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue