Description
Hello rustaceans, I'll start with the brief overview and provide repro instructions at the end:
Given the following code:
pub async fn spawn_execute_process(self: Arc<Self>) -> JoinHandle<()> {
tokio::task::spawn(async move {
execution_process(&self).await;
})
}
The current output is:
error: implementation of `FnOnce` is not general enough
--> crates/sui-core/src/authority_active.rs:327:9
|
327 | tokio::task::spawn(async move {
| ^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(&'0 (u64, sui_types::base_types::TransactionDigest)) -> u64` must implement `FnOnce<(&(u64, sui_types::base_types::TransactionDigest),)>`, for any lifetime `'0`...
= note: ...but it actually implements `FnOnce<(&(u64, sui_types::base_types::TransactionDigest),)>`
This is pretty fishy looking already - as you can see there is no closure in the code above, and the async block doesn't look anything like (u64, TransactionDigest) -> u64
I did however add such a closure in another file. And sure enough if I remove that closure from that other file, this problem goes away.
Unfortunately I don't have time to try to pare this down to a minimal repro right now, but I can provide a repo link.
Instructions:
git clone https://github.com/mystenmark/sui.git
cd sui
git checkout rust-bug-repro
(commit description is "Reproduce the error at this commit")cargo check
- Observe the error
git checkout rust-bug-repro-workaround
(commit description is "Make the error magically go away")cargo check
- Observe that the error is gone
As you can see the commit that fixes the error isn't even in the same file, nor does it alter any public function signatures or type defintions: mystenmark/sui@73302e1
Lastly, this is happens on both rust 1.62.0 and 1.62.1 - the branch above uses 1.62.1