Skip to content

Rustdoc ignores no_inline when re-exporting modules from other crates #131180

Open
@clarfonthey

Description

@clarfonthey

This one is going to be a bit difficult to explain, so, here's an example of a rather large workspace experiencing this bug: https://github.com/clarfonthey/bevy/tree/no-inline-bug

Essentially, if a crate example has a module including no_inline exports like so:

pub mod prelude {
    #[doc(no_inline)]
    pub use crate::{thing1, thing2};
}

Then rustdoc will correctly show these as re-exports in the documentation for that module, on that crate. The exports will be shown as crate::thing1 and crate::thing2.

However, if you re-export that module on another crate, then you would expect these items to continue to show up as re-exports, just as example::thing1 and example::thing2 instead of relative to crate::. However, instead Rustdoc simple inlines these.

In the example given, the bevy crate contains pub use bevy_internal::* without any special doc attributes. You'll find that thus, bevy::prelude will inline all of its contents instead of showing them as re-exports, despite the fact that bevy_internal::prelude does show them as re-exports.

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (fb4aebddd 2024-09-30)
binary: rustc
commit-hash: fb4aebddd18d258046ddb51fd41589295259a0fa
commit-date: 2024-09-30
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions