Skip to content

rustdoc: Avoid ICE on unevaluated type const projections in array lengths#158171

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lapla-cogito:issue_158155
Jun 22, 2026
Merged

rustdoc: Avoid ICE on unevaluated type const projections in array lengths#158171
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lapla-cogito:issue_158155

Conversation

@lapla-cogito

@lapla-cogito lapla-cogito commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

clean_middle_ty used normalize_erasing_regions when rendering array lengths, which panics on unevaluatable associated const projections such as <T as Trait>::ASSOC under mGCA.

Fixes #158155

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

rustbot commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

r? @camelid

rustbot has assigned @camelid.
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: rustdoc
  • rustdoc expanded to 8 candidates
  • Random selection from GuillaumeGomez, camelid, notriddle

@rust-log-analyzer

This comment has been minimized.

@lapla-cogito lapla-cogito force-pushed the issue_158155 branch 3 times, most recently from c256212 to 7a6277d Compare June 20, 2026 12:40

@camelid camelid left a comment

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.

Thanks! Looks good, but I'd like to improve the test.

View changes since this review

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.

Could you move this test to the rustdoc-html directory, and then you can add @has checks to make sure the HTML output is actually correct? Currently this test just makes sure rustdoc doesn't crash, but not that the output looks right. So basically for both your new test case and the existing one in the file, add a check that the type renders correctly as [(); <T as Tr>::SIZE].

You can see examples of how @has checks look in the other tests in rustdoc-html, or the docs for it here. Feel free to ask me here or on Zulip if you need help!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated the test. Additionally, when actually adding the @has check, I found that the previous fix alone result in the HTML displaying [(); const SIZE: usize;]. This issue occurred because print_inlined_const() was displaying the definition side for assoc const projections without bodies, so I've included a corresponding fix for this as well.

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2026
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Jun 22, 2026
@lapla-cogito

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 22, 2026

@camelid camelid left a comment

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 suspect there's some more underlying issues with the const rendering code, but this should be a good improvement already. Thanks!

View changes since this review

@camelid

camelid commented Jun 22, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a616db3 has been approved by camelid

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 5. This pull request will be tested once the tree is reopened.

@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 Jun 22, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
@rust-bors rust-bors Bot merged commit 5d9537a into rust-lang:main Jun 22, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 22, 2026
rust-timer added a commit that referenced this pull request Jun 22, 2026
Rollup merge of #158171 - lapla-cogito:issue_158155, r=camelid

rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths

`clean_middle_ty` used `normalize_erasing_regions` when rendering array lengths, which panics on unevaluatable associated const projections such as `<T as Trait>::ASSOC` under mGCA.

Fixes #158155
@lapla-cogito lapla-cogito deleted the issue_158155 branch June 23, 2026 01:49
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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: rustdoc: mgca: Failed to normalize Alias

4 participants