Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exponential compile time with let in unsupported position within closure #104871

Open
jruderman opened this issue Nov 25, 2022 · 0 comments
Open
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times.

Comments

@jruderman
Copy link
Contributor

Found with a modified fuzz-rustc

Code

Variant A: slow and high memory use
fn main () {
    let z = 0_u32; 

    let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    || let _ =
    z;
}
Variant B: slow only
fn main () {
    let _clos = || { 
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        let _ =
        0_u32; 
    };
}

Where it's slow

From -Z time-passes:

  • item_bodies_checking

From sample-head.txt:

  • ExprUseVisitor when called by rustc_hir_typeck::upvar::FnCtxt::analyze_closure

Regression

Regression in nightly-2021-08-17, perhaps from #80357

Version

rustc 1.67.0-nightly (ff8c8dfbe 2022-11-22)
binary: rustc
commit-hash: ff8c8dfbe66701531e3e5e335c28c544d0fbc945
commit-date: 2022-11-22
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

(Doesn't reproduce on playground)

@rustbot label +I-compiletime

@jruderman jruderman added the C-bug Category: This is a bug. label Nov 25, 2022
@rustbot rustbot added the I-compiletime Issue: Problems and improvements with respect to compile times. label Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times.
Projects
None yet
Development

No branches or pull requests

2 participants