rust-lang / rust-lang/rust

Compile time regression with the new trait solver and diesel

Open
#131,231 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I tried this code: https://github.com/diesel-rs/diesel/commit/381be195688db339fe2927e49bc818ab86754dd9 with both RUSTFLAGS=-Znext-solver=globally set and not set

I expected to see this happen: Code compiles similar fast with both combinations

Instead, this happened: RUSTFLAGS=-Znext-solver=globally results in the code compiling takes over 10 times as long. For me the compiler takes ~10s to compile diesel from scratch with the old trait solver. The same operation takes 1:53 min, so over 10 times of what the old trait solver needed.

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (9ff5fc4ff 2024-10-03)
binary: rustc
commit-hash: 9ff5fc4ffbbe1e911527aa054e789b05ae55ffcc
commit-date: 2024-10-03
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

@rustbot label +I-compiletime +WG-trait-system-refactor

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

Reproduce the Diesel commit 381be195688db339fe2927e49bc818ab86754dd9 with rustc 1.83.0-nightly (9ff5fc4ff) using and omitting RUSTFLAGS=-Znext-solver=globally. Compare clean-build times and investigate the trait-system compiler path; done means the large compile-time regression is explained and the two configurations compile at comparable speed.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.