Deprioritize doc(hidden) re-exports in diagnostic paths#153630
Open
arferreira wants to merge 1 commit intorust-lang:mainfrom
Open
Deprioritize doc(hidden) re-exports in diagnostic paths#153630arferreira wants to merge 1 commit intorust-lang:mainfrom
arferreira wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
eggyal
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #153477.
This is the other half of #99698, which fixed the case where the parent module is
#[doc(hidden)]but left the case where the re-export itself is#[doc(hidden)]as a FIXME (with a tracking test indont-suggest-doc-hidden-variant-for-enum/hidden-child.rs).The problem: when a crate does
#[doc(hidden)] pub use core::error::Error, diagnostics pick up the hidden re-export path instead of the canonical one. For example,snafu::Errorinstead ofstd::error::Error.Two changes:
In
visible_parent_map, theadd_childclosure now checks whether the re-export itself is#[doc(hidden)]viareexport_chainand sends it tofallback_map, same treatment as doc-hidden parents and underscore re-exports.should_encode_attrsnow returnstrueforDefKind::Use. Without this,#[doc(hidden)]onuseitems was never written to crate metadata, sois_doc_hiddenalways returnedfalsecross-crate. This was the actual root cause, the check invisible_parent_mapalone isn't enough if the attribute isn't in the metadata.The existing FIXME test now serves as the regression test. The
.stderrgoes from suggestinghidden_child::__private::Some(1i32)to justSome(1i32).cc @eggyal