Async/await does not compile
The invariant and ensures macros place the actual body of the function in a closure, which can cause issues in async functions. For example, the following code does not compile:
use contracts::{ensures};
fn main() { foo(); }
#[ensures(true)]
async fn foo() { bar().await; }
async fn bar() {}
This is because the await in foo() is placed in a non-async closure.
If a contract is applied to an async function, it should create an async closure instead of a synchronous one, and then await the result of that closure. This would permit the use of await in async functions with contracts.
Edited by thederekkaplan