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

Fstar core modelling of IntoIterator trait fails on some generated code using it #1168

Open
maximebuyse opened this issue Dec 3, 2024 · 3 comments
Assignees
Labels
bug Something isn't working f* F* backend libcore

Comments

@maximebuyse
Copy link
Contributor

/* fn test(items: impl IntoIterator<Item = i32>) -> bool {
    let mut has_negative = false;
    for i in items.into_iter() {
        if i < 0{
            has_negative = true
        }
    }
    has_negative
} */

fn test(items: impl IntoIterator<Item = bool>) -> bool {
    items.into_iter().next().unwrap_or(false)
}
fn main (v: Vec<bool>) -> bool {
    test(v)
}

Open this code snippet in the playground

The generated code has the following lax-checking error:

* Error 228 at Playground.fst(19,7-19,38):
  - Could not solve typeclass constraint
      `Core.Iter.Traits.Iterator.iterator i1.f_IntoIter`
  - See also FStar.Tactics.Typeclasses.fst(297,6-300,7)
@maximebuyse maximebuyse added bug Something isn't working f* F* backend libcore labels Dec 3, 2024
@franziskuskiefer
Copy link
Member

Needs a fix in F* core iter library.

@maximebuyse maximebuyse self-assigned this Jan 8, 2025
@franziskuskiefer
Copy link
Member

Let's PR the changes @maximebuyse

@maximebuyse
Copy link
Contributor Author

maximebuyse commented Jan 16, 2025

Let's PR the changes @maximebuyse

Actually the IntoIter problem that I fixed in #1192 is different. So as far as I know, the issue here still needs a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working f* F* backend libcore
Projects
None yet
Development

No branches or pull requests

2 participants