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 issues with macro reexport #56173

Closed
weiznich opened this issue Nov 22, 2018 · 4 comments
Closed

Rustdoc issues with macro reexport #56173

weiznich opened this issue Nov 22, 2018 · 4 comments

Comments

@weiznich
Copy link
Contributor

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)
@bkchr
Copy link
Contributor

bkchr commented Nov 28, 2018

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)

@weiznich
Copy link
Contributor Author

@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.)

@bkchr
Copy link
Contributor

bkchr commented Nov 28, 2018

@weiznich nice :)

@QuietMisdreavus
Copy link
Member

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.

pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 6, 2018
…ort, r=QuietMisdreavus

Rustdoc inline macro reexport

Fixes rust-lang#56173

I assume this needs to have tests? Any pointers where these need to be added?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants