Skip to content

Exponential parse time involving recover_const_arg #103620

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

Open
jruderman opened this issue Oct 27, 2022 · 0 comments
Open

Exponential parse time involving recover_const_arg #103620

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

Comments

@jruderman
Copy link
Contributor

jruderman commented Oct 27, 2022

This code takes minutes to parse:

fn main() {
    0 +
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        { let _ : A<B<C = D, x:^
        }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}

The output (with --error-format=short) includes:

src/main.rs:32:32: error: expected one of `!`, `(`, `,`, `>`, `?`, `for`, `~`, lifetime, or path, found `^`
src/main.rs:31:32: error: expected one of `!`, `(`, `,`, `>`, `?`, `for`, `~`, lifetime, or path, found `^`
src/main.rs:30:32: error: expected one of `!`, `(`, `,`, `>`, `?`, `for`, `~`, lifetime, or path, found `^`
...

where each error takes significantly longer to produce than the previous.

Where it's slow

According to -Z time-passes, the slow pass is parse_crate.

sample-head-103620.txt

handle_ambiguous_unbraced_const_arg and recover_const_arg repeatedly on the stack is sus.

Impact

This input is nonsense, so it's possible the only impact of the issue is slowing down fuzzing, very slightly.

Version

rustc --version --verbose:

rustc 1.66.0-nightly (bed4ad65b 2022-10-25)
binary: rustc
commit-hash: bed4ad65bf7a1cef39e3d66b3670189581b3b073
commit-date: 2022-10-25
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2

Regression

Regression in nightly-2020-10-28

@rustbot label +I-compiletime

@jruderman jruderman added the C-bug Category: This is a bug. label Oct 27, 2022
@rustbot rustbot added the I-compiletime Issue: Problems and improvements with respect to compile times. label Oct 27, 2022
@jruderman jruderman changed the title Exponential parse time with this input Exponential parse time involving recover_const_arg Nov 29, 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