rust-lang / rust-lang/rust

Slow coherence checking and type checking.

Open
#138,828 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-coherence A-trait-system C-bug I-compiletime T-compiler T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I was working on creating a crate and encountered some unexpectedly long compile times.
I don't have a minimal reproduction, but I have expanded my macros, and copied the code into a playground.

It occurs on all channels. It is still pretty bad even with the parallel front-end enabled. According to time-passes, the biggest culprits were coherence checking and type checking.

time:   6.038; rss:   80MB ->  272MB ( +192MB)  coherence_checking
time:   6.084; rss:   80MB ->  274MB ( +195MB)  type_check_crate

My use case is clearly atypical, so I will understand if you consider this frivolous and close it. (Although, when I searched to see if my issue had already been reported, I did notice submitted situations that were arguably even less likely to be encountered by anyone.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Rust Playground example and reproduce the compile-time and memory behavior across compiler channels, using time-passes to inspect coherence checking and type_check_crate. Reduce the expanded macro case if possible and compare it with parallel front-end enabled; done means identifying a reproducible cause or a focused minimal reproduction for the slow checks.

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
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.