Skip to content

Rustdoc --passes strip-priv is broken #19111

Closed
@scialex

Description

@scialex

According to rustdoc's help text and man page an invocation such as

rustdoc --no-defaults --passes unindent-comments --passes collapse-docs --passes strip-hidden lib.rs

should produce a doc webpage with all modules and functions being documented (except those explicitly marked doc(hidden)).

It does not do this. Instead only the contents of public modules are displayed.

For example the rust code below:

pub use aaa::exp;

/// The abc mod
pub mod abc {
    /// This is public
    pub fn def() {}

    /// This is not
    fn hij() {}
}

/// This should be seen with --no-defaults
mod aaa {
    /// So should this
    fn kkk() {}
    /// And this
    pub fn lll() {}

    /// This is exported
    pub fn exp() {}
}

With the default rustdoc arguments (rustdoc lib.rs) we get this page. We would expect that running the command rustdoc --no-defaults --passes unindent-comments --passes collapse-docs --passes strip-hidden lib.rs would produce a webpage where all items are shown, instead it produces this page. Note the absence of an aaa module in the page. Also note that abc::hij is shown. Finally note that although abc::hij is (correctly) included in the index nothing within the aaa module is.

(Links may take a little bit to start working, they are github pages)

This seems to be because the html renderer is the one that is actually culling private modules from the page.

This is likely related to #19106

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions