borrowck is superlinear in the number of `.await`s in one function
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
An async fn with many awaits spends superlinear time in mir_borrowck — doubling the awaits costs ~9x. It is the EverInitializedPlaces fixpoint: it visits each basic block about N/2 times where N is the await count, while every other dataflow analysis over the same body settles in one or two. In our tree one 3539-line e2e test function with 679 awaits cost 8.4s of mir_borrowck on its own.
$ git clone https://github.com/ashi009/rustc-async-borrowck-repros && cd rustc-async-borrowck-repros
$ rustc -V
rustc 1.97.1 (8bab26f4f 2026-07-14)
$ time rustc --edition 2021 --crate-type=lib --emit=metadata awaits_800.rs
real 2.27
$ time rustc --edition 2021 --crate-type=lib --emit=metadata awaits_1600.rs
real 21.67
Each .await leaves a loop in the MIR borrowck sees, and loops_N.rs — a plain fn with N sequential loop { … break } blocks and no async — shows the same per-block visit count, so the apparent trigger is loop count rather than the coroutine. Same timings on 1.98.0-beta.2 and 1.94.1.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mir_borrowck and the EverInitializedPlaces fixpoint, then reproduce the scaling with awaits_800.rs and awaits_1600.rs from the linked repository. Compare the per-block visits against loops_N.rs, and consider the issue resolved when borrow checking no longer scales superlinearly with the number of awaits or equivalent loops.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100