Skip to content

Rustdoc issues with macro reexport #56173

Closed

Description

@weiznich

I've toying around a bit with how and where to document things. For this I've tried to reexport things at certain locations. To let the documentation appear on the reexported location I've been using #[doc(inline)]. This works fine for normal items, but fails for macros generated by macro rules and for custom derives. They are continued to be rendered just as reexports.

Reproducing example:

/// item
pub struct SomeItem {
    i: i32
}

/// some macro
#[macro_export]
macro_rules! foo {
    ($i: ident) => {}
}

/// foo
pub mod bar {
    #[doc(inline)]
    pub use super::SomeItem;

    #[doc(inline)]
    pub use foo;
}

Resulting docs for bar:
docs

I would expect that the documentation appears inline similar like the documentation of SomeItem.

Rustdoc version:

rustdoc --version       
rustdoc 1.32.0-nightly (0b9f19dff 2018-11-21)

Activity

  1. bkchr commented on Nov 28, 2018

    @bkchr
    Contributor

    Hey @QuietMisdreavus as you implemented the doc(inline) support for macros in #51611, do you have any idea why that is not working?
    (I have the same problem as @weiznich)

  2. weiznich commented on Nov 28, 2018

    @weiznich
    ContributorAuthor

    @bkchr See the PR I've opened. That does fix the problem for me. (It basically worked, but missed some pieces to do the actual inlining in case of macros.)

  3. bkchr commented on Nov 28, 2018

    @bkchr
    Contributor

    @weiznich nice :)

  4. QuietMisdreavus commented on Dec 3, 2018

    @QuietMisdreavus
    Contributor

    For derives, it was deliberate to only have them appear as re-exports. The documentation information disappears when the proc-macro is sent between crates, so any re-export page would be completely blank other than the name of the derive. For macro_rules! macros, i'm less sure about those. I'll take a look at the PR.

  5. added a commit that references this issue on Dec 6, 2018
    3073c7a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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