Skip to content

Add regression test for mono item collection ICE with generic_const_exprs#154547

Closed
jeanibarz wants to merge 1 commit intorust-lang:mainfrom
jeanibarz:fix/add-test-149035
Closed

Add regression test for mono item collection ICE with generic_const_exprs#154547
jeanibarz wants to merge 1 commit intorust-lang:mainfrom
jeanibarz:fix/add-test-149035

Conversation

@jeanibarz
Copy link
Copy Markdown
Contributor

@jeanibarz jeanibarz commented Mar 29, 2026

Regression test for #149035.

The ICE in mono item collection with -Clink-dead-code=true was fixed by #152129 but didn't get a test. Adapted the reproducer to use type const since const handling changed after the issue was filed.

Closes #149035

@rustbot

This comment was marked as resolved.

@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 Mar 29, 2026
@rustbot

This comment has been minimized.

@jeanibarz jeanibarz force-pushed the fix/add-test-149035 branch from 16a45fb to 5c589b8 Compare March 29, 2026 12:13
@rustbot

This comment has been minimized.

@jeanibarz jeanibarz force-pushed the fix/add-test-149035 branch from 5c589b8 to 3ef77ce Compare March 29, 2026 12:14
@jeanibarz
Copy link
Copy Markdown
Contributor Author

r? rust-lang/compiler

Copy link
Copy Markdown
Member

@reddevilmidzy reddevilmidzy left a comment

Choose a reason for hiding this comment

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

Also, please refrain from using LLM when writing PR descriptions.

View changes since this review

@rust-log-analyzer

This comment has been minimized.

@jeanibarz jeanibarz force-pushed the fix/add-test-149035 branch 2 times, most recently from 745fe6a to 6982ce5 Compare March 29, 2026 13:28
…xprs

Exercises -Clink-dead-code=true with generic_const_exprs and
min_generic_const_args, which previously caused an ICE in mono
item collection.
@jeanibarz jeanibarz force-pushed the fix/add-test-149035 branch from 6982ce5 to 68ea4d5 Compare March 29, 2026 13:40
@jeanibarz jeanibarz changed the title Add regression test for #149035 Add regression test for mono item collection ICE with generic_const_exprs Mar 29, 2026

#![feature(min_generic_const_args, generic_const_exprs)]

type const L: usize = 4;
Copy link
Copy Markdown
Member

@TaKO8Ki TaKO8Ki Apr 1, 2026

Choose a reason for hiding this comment

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

Do you have any reason why this line is different from one in provided code in the issue? #149035 (comment)

Ideally, we need to verify with that test that the ICE occurs without the fix in #152129.

Copy link
Copy Markdown
Contributor Author

@jeanibarz jeanibarz Apr 1, 2026

Choose a reason for hiding this comment

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

The original const L doesn't compile on current main, as #152129 both fixed the ICE and introduced type const syntax for free consts, so I had to adapt the reproducer.

I verified with rustup:

  • nightly-2025-11-17 (same as the issue): const L ICEs in mono item collection
  • nightly-2026-02-05 (day before MGCA: require #[type_const] on free consts too #152129 merged): const L still ICEs, type const is a parse error
  • current nightly: const L gets a hard error, type const L compiles cleanly

So there's no nightly where type const exists and the ICE is still present, as the syntax was introduced by the same PR that fixed the bug. That means this test can't directly catch a revert of #152129 (the syntax would vanish too). It's more of a smoke test for the const-in-generic-arg + -Clink-dead-code=true path in mono item collection.

Happy to drop it if you don't think that's useful enough, or adjust the approach if you have something else in mind.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we need to test with type const

So I think it would have been more appropriate to close the issue with obsolete instead of adding E-needs-test labels.

I'll close the issue and PR, thanks for your contribution :)

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

ICE erroneous constant missed by mono item collection

5 participants