Skip to content

tests: Add regression test for infinite recursive dereference - #165729

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
hardikxk:tests/infinite-comp
Nov 12, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
hardikxk:tests/infinite-comp

Conversation

@hardikxk

@hardikxk hardikxk commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Add a test for a case that results in a recursive loop that runs until it runs out of memory or gets killed.

closes #67064

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 9, 2026
@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 79 candidates
  • Random selection from 22 candidates

@rust-log-analyzer

This comment has been minimized.

@hardikxk

hardikxk commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure why the CI failed if someone can help explain since the .stderr seems identical to what I got when I ran the test and seems correct?

And I tried using #![recursion_limit = "16"] instead but it still lead to the recursive output until it ran out of memory and failed the test.

@adwinwhite

Copy link
Copy Markdown
Contributor

It seems that you didn't commit the stderr file.

@hardikxk

Copy link
Copy Markdown
Contributor Author

Ohh I didn't know I was supposed to, I just generated it with bless and ran the test. I'll add it in the following commit.
Thanks!

@adwinwhite adwinwhite left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you squash the commits? Then it's all good :>

View changes since this review

Comment on lines +1 to +4
// Regression test for: https://github.com/rust-lang/rust/issues/67064
// This used to take a long time to compile because dereferencing led to
// recursive expansion of the type of the struct.
//@ compile-flags: -Zwrite-long-types-to-disk=yes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Regression test for: https://github.com/rust-lang/rust/issues/67064
// This used to take a long time to compile because dereferencing led to
// recursive expansion of the type of the struct.
//@ compile-flags: -Zwrite-long-types-to-disk=yes
//@ compile-flags: -Zwrite-long-types-to-disk=yes
// Regression test for: https://github.com/rust-lang/rust/issues/67064
// This used to take a long time to compile because dereferencing led to
// recursive expansion of the type of the struct.

Add a test for a case that results in a recursive loop that runs until
it runs out of memory or gets killed. This used to take a long time to
compile because of nested recursion caused by dereferencing the type of
the struct.

Signed-off-by: Hardik Kumar <hardikxk@gmail.com>
@hardikxk

Copy link
Copy Markdown
Contributor Author

Could you squash the commits? Then it's all good :>

Sure, thanks!

@hardikxk
hardikxk force-pushed the tests/infinite-comp branch from 80e13e1 to a7280a9 Compare November 11, 2026 07:38
@adwinwhite

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a7280a9 has been approved by adwinwhite

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 12, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 12, 2026
…winwhite

tests: Add regression test for infinite recursive dereference

Add a test for a case that results in a recursive loop that runs until it runs out of memory or gets killed.

closes rust-lang#67064
rust-bors Bot pushed a commit that referenced this pull request Nov 12, 2026
Rollup of 6 pull requests

Successful merges:

 - #165778 (Bump stage0 to 1.101.0-beta.1)
 - #163077 (feat: support nested functions with `#[offload_kernel]`)
 - #165578 (Avoid `Hash::hash` when stable-hashing various types)
 - #165729 (tests: Add regression test for infinite recursive dereference)
 - #165819 (Avoid redundant scans when extracting stage0 archives)
 - #165822 (Remove unused compiler modules and types)
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 12, 2026
…winwhite

tests: Add regression test for infinite recursive dereference

Add a test for a case that results in a recursive loop that runs until it runs out of memory or gets killed.

closes rust-lang#67064
rust-bors Bot pushed a commit that referenced this pull request Nov 12, 2026
Rollup of 12 pull requests

Successful merges:

 - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values)
 - #165778 (Bump stage0 to 1.101.0-beta.1)
 - #165412 (Implement `core::ops::FnAddr`)
 - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax)
 - #165818 (do not lint `redundant_lifetimes` on items from external macros)
 - #163077 (feat: support nested functions with `#[offload_kernel]`)
 - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases)
 - #165578 (Avoid `Hash::hash` when stable-hashing various types)
 - #165729 (tests: Add regression test for infinite recursive dereference)
 - #165819 (Avoid redundant scans when extracting stage0 archives)
 - #165822 (Remove unused compiler modules and types)
 - #165824 (Add regression test for HRTB projection bound with TryFrom error)
rust-bors Bot pushed a commit that referenced this pull request Nov 12, 2026
Rollup of 11 pull requests

Successful merges:

 - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values)
 - #165778 (Bump stage0 to 1.101.0-beta.1)
 - #165412 (Implement `core::ops::FnAddr`)
 - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax)
 - #165818 (do not lint `redundant_lifetimes` on items from external macros)
 - #163077 (feat: support nested functions with `#[offload_kernel]`)
 - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases)
 - #165578 (Avoid `Hash::hash` when stable-hashing various types)
 - #165729 (tests: Add regression test for infinite recursive dereference)
 - #165822 (Remove unused compiler modules and types)
 - #165824 (Add regression test for HRTB projection bound with TryFrom error)
@rust-bors
rust-bors Bot merged commit 8277932 into rust-lang:main Nov 12, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 12, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 12, 2026
Rollup merge of #165729 - hardikxk:tests/infinite-comp, r=adwinwhite

tests: Add regression test for infinite recursive dereference

Add a test for a case that results in a recursive loop that runs until it runs out of memory or gets killed.

closes #67064
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Nov 13, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values)
 - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1)
 - rust-lang/rust#165412 (Implement `core::ops::FnAddr`)
 - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax)
 - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros)
 - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`)
 - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases)
 - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types)
 - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference)
 - rust-lang/rust#165822 (Remove unused compiler modules and types)
 - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
mehmettoplu-rs pushed a commit to mehmettoplu-rs/miri that referenced this pull request Nov 13, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values)
 - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1)
 - rust-lang/rust#165412 (Implement `core::ops::FnAddr`)
 - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax)
 - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros)
 - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`)
 - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases)
 - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types)
 - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference)
 - rust-lang/rust#165822 (Remove unused compiler modules and types)
 - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
folkertdev pushed a commit to folkertdev/stdarch that referenced this pull request Nov 16, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values)
 - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1)
 - rust-lang/rust#165412 (Implement `core::ops::FnAddr`)
 - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax)
 - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros)
 - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`)
 - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases)
 - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types)
 - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference)
 - rust-lang/rust#165822 (Remove unused compiler modules and types)
 - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clever recursive types + deref = seemingly infinite compile time

4 participants