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

Misc PR: core extraction features, traits, generic improvements... #249

Merged
merged 56 commits into from
Oct 10, 2023

Conversation

W95Psp
Copy link
Collaborator

@W95Psp W95Psp commented Sep 6, 2023

This PR is a bit unfortunate, it's packing a huge number of interleaved features...
However, each the (basic) CI is green on each and every commit, and I extensively cleaned up the history, so things should not be too much messed up.

Previous description:

This PR tweaks Hax so that it is able to translate Rust's core library.

This PR adds a special mode for the exporter when exporting core. The environment variable HAX_CORE_EXTRACTION_MODE disables attributes and makes every function body be unit (for now. This should be panic or something).

On about 20 000 definitions, for now, we're able to extract 19 000 definitions (without body). That takes about one minute. Things that fail to extract trigger the following errors:

error[HAX0000]: (AST import) Unsafe blocks are not allowed.
occurences: 213
error[HAX0001]: (AndMutDefSite) something is not implemented yet.
occurences: 13
error[HAX0001]: (AST import) something is not implemented yet.
occurences: 111
error[HAX0001]: (FStar backend) something is not implemented yet.
occurences: 294
error[HAX0002]: (AndMutDefSite) Fatal error: something we considered as impossible occurred! Please report this by submitting an issue on GitHub!
occurences: 5
error[HAX0003]: (RefMut) The mutation of this &mut is not allowed here.
occurences: 270
error[HAX0008]: (reject_RawOrMutPointer) ExplicitRejection { reason: "unknown reason" }
occurences: 1

I've tweaked and fixed some bugs in the F* backend, now I'm at a point where F* complains because of module cycles. That means we're producing syntaxically correct code for the whole core crate!

My plan is thus to implement #203.

I push the current F* extraction there: https://github.com/W95Psp/rust/tree/hax/library/core/proofs/fstar/extraction

@W95Psp W95Psp changed the title Extract signature only core to F* with Hax Extract signature-only core to F* with Hax Sep 7, 2023
@W95Psp W95Psp force-pushed the extract-core branch 27 times, most recently from 61ee937 to 8313546 Compare October 6, 2023 10:40
frontend/exporter/src/traits.rs Outdated Show resolved Hide resolved
frontend/exporter/src/traits.rs Show resolved Hide resolved
cli/options/src/lib.rs Outdated Show resolved Hide resolved
@W95Psp W95Psp force-pushed the extract-core branch 2 times, most recently from 8f43a58 to 7f8fb0b Compare October 9, 2023 14:04
This commit adds a `capture` primitive in `Diagnostics.ml`. `capture`
can run a function without reporting directly errors, instead
returning the errors as data.

Dep. analysis occurs on Hax's internal AST. Thus, we need to import
items first. But we don't support importing everything. Errors
occuring on import should thus be delayed and displayed only when they
are about items we actually want to extract.

That's what this commit does with `capture`.
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.

Let's get this in.
Just add something in a readme for that one nit.

frontend/exporter/src/types/new.rs Show resolved Hide resolved
@W95Psp W95Psp enabled auto-merge October 10, 2023 15:11
@W95Psp W95Psp added this pull request to the merge queue Oct 10, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 10, 2023
@W95Psp W95Psp enabled auto-merge October 10, 2023 15:44
@W95Psp W95Psp added this pull request to the merge queue Oct 10, 2023
Merged via the queue into main with commit 43a1fb1 Oct 10, 2023
9 checks passed
@W95Psp W95Psp deleted the extract-core branch October 10, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants