Slow probing for missing functions near type errors · Issue #103427 · rust-lang/rust (original) (raw)

This takes over a second to emit each cannot find function error message. Somehow, the time spent for each missing function is linear in the number of type errors in the argument expression. Overall, this creates quadratic compilation time, and with a rather high constant factor.

fn slow() { not_found_1({ not_found_2({ not_found_3({ not_found_4({ let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); let _ : u32 = (); }) }) }) }) }

fn main() {}

Where it's slow

The item_bodies_checking pass is the slow one. It seems to be spending time in probe_for_return_type, like in #103411.

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (dcb376115 2022-10-20)
binary: rustc
commit-hash: dcb376115066d111dbf5f13d5ac2a2dbe8c12add
commit-date: 2022-10-20
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2

@rustbot label +I-compiletime