-
Notifications
You must be signed in to change notification settings - Fork 40
[F* lib] Tls codec panic freedom #1742
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Two points might need to be documented :
- Why do you need to replace some
resbytrue ==> res? - Why inverting condition and invariant in
functionalize_loops? It might affect other backends
| let variant = UB.make_closure [ bpat ] variant variant.span in | ||
| UB.call fold_operator | ||
| [ condition; invariant; variant; init; body ] | ||
| [ invariant; condition; variant; init; body ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes there are computations in the loop condition that can be proven panic free only using the invariant, this means in our encoding the invariant should come first so that it can be assumed to hold inside the condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. This will probably require some updates in the Lean Lib though (the Fold functions). Ping me if you want me to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only for while loops, the lean backend produces Rust_primitives.Hax.while_loop, but I don't find the definition in the Lean lib. Is it because it is just not defined?
Thanks for the review. I answered in threads. I will probably remove the commented code, there are also some more things I want to add to this PR. |
F* core lib changes necessary for panic freedom of TLS codec:
TryIntoinstances which can beInfallibleorTryFromIntErrordepending on the integer types.