Skip to content
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

rustdoc: #[doc(inline)] does not work on cross-crate glob re-exports #51252

Closed
QuietMisdreavus opened this issue May 31, 2018 · 1 comment
Closed
Assignees
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@QuietMisdreavus
Copy link
Member

cf. This is the std::alloc docs page:

image

...but this is how those items are declared:

image

As i understand it, #[doc(inline)] properly applies to local glob re-exports, but apparently not for cross-crate ones. This is not being handled correctly.

@QuietMisdreavus QuietMisdreavus added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 31, 2018
@QuietMisdreavus QuietMisdreavus self-assigned this May 31, 2018
@QuietMisdreavus QuietMisdreavus added the C-bug Category: This is a bug. label May 31, 2018
@QuietMisdreavus
Copy link
Member Author

Here's the offending code:

let inner = if self.glob {
Import::Glob(resolve_use_source(cx, path))
} else {
let name = self.name;
if !denied {
let mut visited = FxHashSet();
if let Some(items) = inline::try_inline(cx, path.def, name, &mut visited) {
return items;
}
}
Import::Simple(name.clean(cx), resolve_use_source(cx, path))
};

When cleaning an import statement, rustdoc will only load an item if the import is not a glob import. If it is a glob import, it instead registers the underlying path (which i believe is the module/enum path) and leaves the import statement alone. It would instead be prudent to check the import statement for #[doc(inline)] (done already and saved in denied), check whether the glob import is based in a module, scan that module for its items, then import all those items, just like what it does for single-item imports.

bors added a commit that referenced this issue Jun 16, 2018
rustdoc: process cross-crate glob re-exports

Turns out, we were deliberately ignoring glob re-exports when they were occurring across crates, even though we were fully processing them for local re-exports. This will at least bring the two into parity.

Fixes #51252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant