Skip to content

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Nov 7, 2025

The trimmed_def_paths query examines all items in the current crate, and all pub items in immediate-dependency crates (including the standard library), to see which item names are unique and can therefore be printed unambiguously as a bare name without a module path.

Currently that query has no special handling for #[doc(hidden)] items, which has two consequences:

  • Hidden names can be considered unique, and will therefore be printed without a path, making it hard to find where that name is defined (since it normally isn't listed in documentation).
  • Hidden names can conflict with visible names that would otherwise be considered unique, causing diagnostics to mysteriously become more verbose based on internal details of other crates.

This PR therefore makes the trimmed_def_paths query ignore external-crate items that are #[doc(hidden)], along with their descendants.

As a result, hidden item names are never considered unique for trimming, and no longer interfere with visible item names being considered unique.


@rustbot
Copy link
Collaborator

rustbot commented Nov 7, 2025

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@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 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 7, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
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

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Zalathar Zalathar changed the title Ignore #[doc(hidden)] items when computing trimmed paths for diagnostics Ignore #[doc(hidden)] items when computing trimmed paths for printing Nov 8, 2025
@bors

This comment was marked as resolved.

@rustbot

This comment has been minimized.

@bors

This comment was marked as resolved.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@Zalathar Zalathar closed this Nov 14, 2025
@Zalathar Zalathar deleted the trimmed-paths branch November 14, 2025 02:19
@Zalathar Zalathar restored the trimmed-paths branch November 14, 2025 02:19
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 14, 2025
@Zalathar Zalathar reopened this Nov 14, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 14, 2025
@bors

This comment was marked as resolved.

@rustbot

This comment has been minimized.

@Zalathar
Copy link
Member Author

@rustbot ready

@rustbot

This comment has been minimized.

@rustbot rustbot assigned davidtwco and unassigned wesleywiser Jan 5, 2026
@rust-bors

This comment was marked as resolved.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2026

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.

@davidtwco
Copy link
Member

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 19, 2026

📌 Commit 2df2c72 has been approved by davidtwco

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 Jan 19, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 19, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #148623 (Ignore `#[doc(hidden)]` items when computing trimmed paths for printing)
 - #150550 (Miscellaneous cleanups to borrowck related code)
 - #150879 (Remove the diagnostic lints)
 - #150895 (rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`)
 - #150987 (remote-test-server: Fix header in batch mode)
 - #151004 (std: implement `sleep_until` on Apple platforms)
 - #151045 (Simplify some literal-value negations with `u128::wrapping_neg`)
 - #151119 (Support pointers in type reflection)
 - #151171 (Do not recover from `Trait()` if generic list is unterminated)
 - #151231 (HIR typeck cleanup: clarify and re-style `check_expr_unop`)
 - #151249 (Parse ident with allowing recovery when trying to diagnose)
 - #151295 (THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`)
 - #151326 (Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`)
 - #151361 (add test for issue 61463)
 - #151371 (Add `S-blocked` to `labels_blocking_approval`)

r? @ghost
@rust-bors rust-bors bot merged commit 619f137 into rust-lang:main Jan 20, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 20, 2026
rust-timer added a commit that referenced this pull request Jan 20, 2026
Rollup merge of #148623 - trimmed-paths, r=davidtwco

Ignore `#[doc(hidden)]` items when computing trimmed paths for printing

The `trimmed_def_paths` query examines all items in the current crate, and all pub items in immediate-dependency crates (including the standard library), to see which item names are unique and can therefore be printed unambiguously as a bare name without a module path.

Currently that query has no special handling for `#[doc(hidden)]` items, which has two consequences:
- Hidden names can be considered unique, and will therefore be printed without a path, making it hard to find where that name is defined (since it normally isn't listed in documentation).
- Hidden names can conflict with visible names that would otherwise be considered unique, causing diagnostics to mysteriously become more verbose based on internal details of other crates.

This PR therefore makes the `trimmed_def_paths` query ignore external-crate items that are `#[doc(hidden)]`, along with their descendants.

As a result, hidden item names are never considered unique for trimming, and no longer interfere with visible item names being considered unique.

---
- Fixes #148387.
@Zalathar Zalathar deleted the trimmed-paths branch January 20, 2026 02:29
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jan 20, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#148623 (Ignore `#[doc(hidden)]` items when computing trimmed paths for printing)
 - rust-lang/rust#150550 (Miscellaneous cleanups to borrowck related code)
 - rust-lang/rust#150879 (Remove the diagnostic lints)
 - rust-lang/rust#150895 (rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`)
 - rust-lang/rust#150987 (remote-test-server: Fix header in batch mode)
 - rust-lang/rust#151004 (std: implement `sleep_until` on Apple platforms)
 - rust-lang/rust#151045 (Simplify some literal-value negations with `u128::wrapping_neg`)
 - rust-lang/rust#151119 (Support pointers in type reflection)
 - rust-lang/rust#151171 (Do not recover from `Trait()` if generic list is unterminated)
 - rust-lang/rust#151231 (HIR typeck cleanup: clarify and re-style `check_expr_unop`)
 - rust-lang/rust#151249 (Parse ident with allowing recovery when trying to diagnose)
 - rust-lang/rust#151295 (THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`)
 - rust-lang/rust#151326 (Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`)
 - rust-lang/rust#151361 (add test for issue 61463)
 - rust-lang/rust#151371 (Add `S-blocked` to `labels_blocking_approval`)

r? @ghost
@Kobzol
Copy link
Member

Kobzol commented Jan 20, 2026

@rust-timer build e83b9d3

Checking for #151381.

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e83b9d3): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.1% [0.5%, 20.2%] 18
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [2.1%, 4.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary 6.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.7% [2.9%, 17.6%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 473.058s -> 474.781s (0.36%)
Artifact size: 383.29 MiB -> 383.31 MiB (0.00%)

@rustbot rustbot added the perf-regression Performance regression. label Jan 20, 2026
@Kobzol
Copy link
Member

Kobzol commented Jan 20, 2026

So, the regressions are only on stress tests, but it still seems a bit suspicious. The is_doc_hidden query is apparently not that cheap 😆

github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Jan 22, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#148623 (Ignore `#[doc(hidden)]` items when computing trimmed paths for printing)
 - rust-lang/rust#150550 (Miscellaneous cleanups to borrowck related code)
 - rust-lang/rust#150879 (Remove the diagnostic lints)
 - rust-lang/rust#150895 (rustc_errors: Add (heuristic) Syntax Highlighting for `rustc --explain`)
 - rust-lang/rust#150987 (remote-test-server: Fix header in batch mode)
 - rust-lang/rust#151004 (std: implement `sleep_until` on Apple platforms)
 - rust-lang/rust#151045 (Simplify some literal-value negations with `u128::wrapping_neg`)
 - rust-lang/rust#151119 (Support pointers in type reflection)
 - rust-lang/rust#151171 (Do not recover from `Trait()` if generic list is unterminated)
 - rust-lang/rust#151231 (HIR typeck cleanup: clarify and re-style `check_expr_unop`)
 - rust-lang/rust#151249 (Parse ident with allowing recovery when trying to diagnose)
 - rust-lang/rust#151295 (THIR patterns: Use `ty::Value` in more places throughout `const_to_pat`)
 - rust-lang/rust#151326 (Remove `DiagMessage::Translated` in favour of `DiagMessage::Str`)
 - rust-lang/rust#151361 (add test for issue 61463)
 - rust-lang/rust#151371 (Add `S-blocked` to `labels_blocking_approval`)

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

Standard library internal modules are treated as potential name colliders

8 participants