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

feat(engine/fstar): --interfaces: add option to extract only fsti #470

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

W95Psp
Copy link
Collaborator

@W95Psp W95Psp commented Jan 29, 2024

Fixes #397 and fixes #465

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I can't get both anymore? That's a little weird.
Now I have to explicitly add all the modules I want to have interfaces for. Can't we make this a little nicer?

@W95Psp
Copy link
Collaborator Author

W95Psp commented Jan 29, 2024

I re-read the explanations on the --interfaces flag, that was very unclear.

I now wrote that:

Modules for which Hax should extract interfaces (*.fsti files) in supplement to implementations (*.fst files). By default we extract no interface, only implementations. This flag expects a space-separated list of inclusion clauses. An inclusion clause is a Rust path prefixed with +, +! or -. - means implementation only, +! means interface only and + means implementation and interface. Rust path chunks can be either a concrete string, or a glob (just like bash globs, but with Rust paths).

Is that the behavior you would expect?

edit: Oh and I just edited the title, which was very misleading as well...

@W95Psp W95Psp changed the title feat(engine/fstar): --interfaces: extract only fsti feat(engine/fstar): --interfaces: add option to extract only fsti Jan 29, 2024
@W95Psp W95Psp force-pushed the feat-fstar-fsti-only branch 3 times, most recently from 5c76f21 to c9e96b1 Compare January 30, 2024 06:43
@W95Psp W95Psp force-pushed the feat-fstar-fsti-only branch from c9e96b1 to ba58bec Compare January 30, 2024 07:37
Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, lets get this in. It works.
We may want to improve on this later. Right now we have to add +! twice (for -i and --interfaces), to get only an interfaces, which is a little unintuitive. If the -i flag is only about what to include, a + should be enough.

@franziskuskiefer franziskuskiefer added this pull request to the merge queue Jan 31, 2024
@W95Psp
Copy link
Collaborator Author

W95Psp commented Jan 31, 2024

You mean that if you want only the interface for Foo (without impl), then you don't want to extract dependencies of Foo's items, right?

So maybe we should have, for -i "modifies":

  • + includes items with dependencies and with bodies;
  • +! include items without dependencies but with bodies;
  • +!! (or something else...) include items without dependencies or bodies.

But then, we need to have a representation for items without bodies, define what that means for types, for traits, etc. And also we need to define what it means in the various backend, to have empty bodies, which is not easy.

Merged via the queue into main with commit e1b8466 Jan 31, 2024
10 checks passed
@franziskuskiefer franziskuskiefer deleted the feat-fstar-fsti-only branch January 31, 2024 11:24
W95Psp added a commit that referenced this pull request Jan 31, 2024
I introduced a bug in #470: a
negative `-i` clause would drop not only the matching items but any
items they rely on!
This resulted in an extremely confusing behavior...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants