Skip to content

rustdoc: Show use-site paths for unevaluated const array lengths - #158334

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lapla-cogito:rustdoc_typeconst
Jul 2, 2026
Merged

rustdoc: Show use-site paths for unevaluated const array lengths#158334
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lapla-cogito:rustdoc_typeconst

Conversation

@lapla-cogito

@lapla-cogitolapla-cogito commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

After #158171, I noticed a few additional issues with the rendering of consts in rustdoc. This PR fixes them. When rendering array lengths, avoid inlining the full definition of unevaluated constants via print_inlined_const. Instead, fall back to Const::to_string() for use-site rendering, matching the behavior already used for projections without bodies.

r? camelid

@rustbotrustbot 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. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 23, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@camelidcamelid 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.

Looks good, just one comment.

View changes since this review

Comment threadsrc/librustdoc/clean/utils.rs Outdated
@camelidcamelid 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 29, 2026
@lapla-cogito

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

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

@camelidcamelid 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.

@camelid

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-borsBot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f4b09e has been approved by camelid

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Jul 1, 2026
@jhprattjhpratt mentioned this pull request Jul 1, 2026
rust-borsBot pushed a commit that referenced this pull request Jul 1, 2026
Rollup of 8 pull requests
Successful merges:
- #156737 (Implement `DoubleEndedIterator::next_chunk_back`)
- #158180 (std: use `OnceLock` for SGX environment variable storage)
- #158427 (Implement `ptr::{read,write}_unaligned` via `repr(packed)`)
- #158531 (Change `adjust_ident_and_get_scope` arg to `LocalDefId`)
- #158574 (Clarify ExitStatusExt documentation)
- #158334 (rustdoc: Show use-site paths for unevaluated const array lengths)
- #158364 (rustc_target/asm: add LoongArch LSX/LASX inline asm register support)
- #158667 (rustc_sanitizers: use twox-hash without default features)
@rust-bors
rust-borsBot merged commit 9fa3449 into rust-lang:mainJul 2, 2026
13 checks passed
@rustbotrustbot added this to the 1.98.0 milestone Jul 2, 2026
@lapla-cogito
lapla-cogito deleted the rustdoc_typeconst branch July 2, 2026 01:09
rust-timer added a commit that referenced this pull request Jul 2, 2026
Rollup merge of #158334 - lapla-cogito:rustdoc_typeconst, r=camelid
rustdoc: Show use-site paths for unevaluated const array lengths
After #158171, I noticed a few additional issues with the rendering of consts in rustdoc. This PR fixes them. When rendering array lengths, avoid inlining the full definition of unevaluated constants via `print_inlined_const`. Instead, fall back to `Const::to_string()` for use-site rendering, matching the behavior already used for projections without bodies.
r? camelid
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant 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.

3 participants

@lapla-cogito@rustbot@camelid