Skip to content

Exponential parse time involving maybe_suggest_struct_literal #105067

Open
@jruderman

Description

@jruderman

Code

fn main() {
    0 & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {
    x: y & {

Where it's slow

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

sample-head.txt

maybe_suggest_struct_literal repeatedly on the stack is sus.

Regression

Regression in nightly-2020-10-09, most likely from #75470, which added the function maybe_suggest_struct_literal (@estebank)

Version

rustc 1.67.0-nightly (1eb62b123 2022-11-27)
binary: rustc
commit-hash: 1eb62b1235fd77200e6bd967d70e83c0f2497233
commit-date: 2022-11-27
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label +I-compiletime

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions