-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Fix weird rustdoc output when single and glob reexport conflict on a name #143590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix weird rustdoc output when single and glob reexport conflict on a name #143590
Conversation
r? @notriddle rustbot has assigned @notriddle. Use |
This comment has been minimized.
This comment has been minimized.
b3f629e
to
1b29e03
Compare
Ah bad luck. A function I modified was used in a more up-to-date version. ^^' Anyway, rebased and fixed the CI failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some things could use clarification. i don't entirely understand if things are getting merged or overwritten. the unit test comment is confusing: all glob attrs are ignored, or just those on shadowed items? this should be clarified.
the test could also include coverage for the case where an item is renamed to itself. also what happens if an item is renamed then renamed back to the original name in a chain?
@@ -152,8 +152,12 @@ pub(crate) fn try_inline( | |||
}; | |||
|
|||
cx.inlined.insert(did.into()); | |||
let import_def_ids: &[LocalDefId] = match import_def_id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't Option::as_slice be used here?
/// ``` | ||
/// | ||
/// So in this case, we don't want to have two items but just one with attributes from both | ||
/// imports to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is merging the attributes correct? i thought that per the reference, only items not shadowed by non-glob imports would actually be shadowed. i guess that doesn't exactly say what happens when you shadow a glob import with an identical item...
not that i see putting docs on glob imports to be a common usecase, i think much more common is docs on the regular import and no docs on the glob import.
Fixes #143107.
The problem was that the second reexport would overwrite the first, leading to having unexpected results. To fix it, I now group items by their original
DefId
and their name and keep tracks of all imports for this item (should very rarely be more than one though, and even less often more than 2).cc @lolbinarycat