Implement RFC 3373: Avoid non-local definitions in functions by Urgau · Pull Request #120393 · rust-lang/rust (original) (raw)

@rylev I tried very hard in #121625 to fix the perf regression, but it when mostly nowhere. My latest (and most promising) attempt end up having a correctness issue.

At some point I was wondering why diesel was the only benchmark to show any regressions (even in incremental), just to realize that in the Crater run some older versions of the crate were affect by the lint; and indeed it now produces 155 warnings!

No wonder why my all attempts went no-where.

If only I could have gotten kcachegrind working earlier it would have screamed this to me; it shows that 99.39% the instructions in the lint is the diagnostic machinery.

So in summary, there is no perf-regression per se, rustc is now just doing way more work because it has to display more than 155 different warnings.

For those curious:
image2