dtolnay / dtolnay/async-trait

The `'async_trait` outlives bounds trigger a rustc caching bug, re-proving `Send` once per impl

Open
#297 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.2k
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Follow-up to #174. For `async fn m(&self)` the macro (v0.1.89) emits outlives clauses:

```rust
fn m<'life0, 'async_trait>(&'life0 self)
-> Pin + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait;
```

Those clauses are exactly the trigger for rust-lang/rust#157595 — a region outlives bound in scope makes the trait solver re-prove `Send`/`Sync` of the captured state once per impl instead of caching it; repro and numbers there. When the receiver is the only reference input the bound isn't needed: #298 emits a receiver-tied future (`… + '_`) for that case, which sidesteps the bug at no change to the output contract.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.