Skip to content

Commit b6c8098

Browse files
committed
Add regression test and comment
1 parent a01b13d commit b6c8098

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: compiler/rustc_const_eval/src/interpret/operator.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
328328
self.binary_int_op(bin_op, l, left.layout, r, right.layout)
329329
}
330330
_ if left.layout.ty.is_any_ptr() => {
331-
// The RHS type must be the same *or an integer type* (for `Offset`).
331+
// The RHS type must be a `pointer` *or an integer type* (for `Offset`).
332+
// (This is workaround for the issue #91636)
332333
assert!(
333334
right.layout.ty.is_any_ptr() || right.layout.ty.is_integral(),
334335
"Unexpected types for BinOp: {:?} {:?} {:?}",

Diff for: src/test/ui/binop/binary-op-on-fn-ptr-eq.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Tests equality between supertype and subtype of a function
2+
// See the issue #91636
3+
fn foo(_a: &str) {}
4+
5+
fn main() {
6+
let x = foo as fn(&'static str);
7+
let _ = x == foo;
8+
}

0 commit comments

Comments
 (0)