diff --git a/crates/flux-infer/src/infer.rs b/crates/flux-infer/src/infer.rs index 0b8026a16f..ffd5258c82 100644 --- a/crates/flux-infer/src/infer.rs +++ b/crates/flux-infer/src/infer.rs @@ -550,6 +550,10 @@ impl Sub { } Ok(()) } + (BaseTy::FnPtr(sig_a), BaseTy::FnPtr(sig_b)) => { + assert_eq!(sig_a, sig_b); + Ok(()) + } _ => Err(query_bug!("incompatible base types: `{a:?}` - `{b:?}`"))?, } } diff --git a/tests/tests/pos/surface/fnptr00.rs b/tests/tests/pos/surface/fnptr00.rs new file mode 100644 index 0000000000..5abf3d3dca --- /dev/null +++ b/tests/tests/pos/surface/fnptr00.rs @@ -0,0 +1,18 @@ +#![allow(unused)] + +type Binop = fn(i32, i32) -> i32; + +struct Foo { + f: Binop, +} + +// TODO: should actually support the below, not just leave it as `trusted` +#[flux::trusted] +fn bar(b: Binop) -> i32 { + b(3, 4) +} + +fn test00(foo: Foo) -> i32 { + let x = bar(foo.f); + x +}