-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add basic support for async/.await #1414
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.
It looks good to me. Just some minor comments.
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.
Awesome!
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.
well I don't want to be left out of the approval chain
Description of changes:
This implements the language constructs
async
and.await
. Since they are lowered to generators in the Rust MIR, #1378 did most of the heavy lifting. The only necessary change was to stop ignoring thestd::future::from_generator
function, which turns a generator into a future. Kani can compile it successfully now.Call-outs:
To test this, I had to add a function
poll_loop
, which repeatedly polls a future until it completes. We'd probably want to keep such a function in the kani library underkani::async_await
. But this PR is intentionally minimal and leaves such improvements for later.Testing:
How is this change tested? Added a test for both
async { ... }
blocks andasync fn
functions.Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.