Skip to content

fix: Do not stop visible_parent_map breadth-first search reaching children of #[doc(hidden)] modules#159881

Open
zalanlevai wants to merge 1 commit into
rust-lang:mainfrom
zalanlevai:fix-incomplete-visible-parent-map
Open

fix: Do not stop visible_parent_map breadth-first search reaching children of #[doc(hidden)] modules#159881
zalanlevai wants to merge 1 commit into
rust-lang:mainfrom
zalanlevai:fix-incomplete-visible-parent-map

Conversation

@zalanlevai

@zalanlevai zalanlevai commented Jul 25, 2026

Copy link
Copy Markdown

The visible_parent_map query misses putting the child items of #[doc(hidden)] modules into the queue, resulting in the breadth-first search missing them entirely. This results in inconsistent path printing behavior affecting diagnostics: namely that re-exports nested deeply within #[doc(hidden)] modules are not considered as a possible fallback path. See the linked issue (#159880) for more details and an example of how this manifests in diagnostics.

This PR makes sure that #[doc(hidden)] parents in the fallback map are still searched as part of the breadth-first search.

Fixes #159880.

The two tests for this change are based on the inconsistent diagnostics shown in the issue:

  • tests/ui/suggestions/suggest-path-through-direct-dep-crate/hidden-reexport-of-transitive-dep-item.rs captures the current, expected behavior in the already working base case where the hidden module is still recorded in the fallback map;
  • tests/ui/suggestions/suggest-path-through-direct-dep-crate/hidden-reexport-of-nested-transitive-dep-item.rs is a regression test for the breadth-first search covering nested children of #[doc(hidden)] modules to populate the fallback map by testing whether the diagnostic prefers the hidden but accessible path through the direct dependency crate.

Related PRs/issues:

@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 Jul 25, 2026
@rustbot

rustbot commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @fee1-dead (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

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

@zalanlevai

Copy link
Copy Markdown
Author

@rustbot label +A-diagnostics +A-visibility

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints A-visibility Area: Visibility / privacy labels Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnostics Area: Messages for errors, warnings, and lints A-visibility Area: Visibility / privacy 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent path to item in transitive dependency crate in diagnostic when the re-export is #[doc(hidden)]

3 participants