Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE on FnPtr #803

Closed
ranjitjhala opened this issue Sep 17, 2024 · 0 comments · Fixed by #804
Closed

ICE on FnPtr #803

ranjitjhala opened this issue Sep 17, 2024 · 0 comments · Fixed by #804

Comments

@ranjitjhala
Copy link
Contributor

[Stripped down test from zkevm]

The following code

#![allow(unused)]

type Binop = fn(i32, i32) -> i32;

struct Foo {
    f: Binop,
}

#[flux::trusted]
fn bar(b: Binop) -> i32 {
    b(3, 4)
}

fn test00(foo: Foo) -> i32 {
    let x = bar(foo.f);
    x
}

currently crashes with

error[E0999]: internal flux error: crates/flux-infer/src/infer.rs:553:22
  --> tests/tests/todo/fnptr00.rs:15:13
   |
15 |     let x = bar(foo.f);
   |             ^^^^^^^^^^
-Ztrack-diagnostics: created at crates/flux-middle/src/queries.rs:794:45
   |
   = note: incompatible base types: `fn(∃b0. i32[b0], ∃b1. i32[b1]) -> ∃b2. i32[b2]` - `fn(∃b0. i32[b0], ∃b1. i32[b1]) -> ∃b2. i32[b2]`

i.e. at the subtyping check for FnPtr... is there any reason NOT to conservatively (?) check that the base types are the same in this case and then move on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant