-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Documentation of a re-export doesn't appear on level-two re-export #81893
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
Comments
Some related bugs: mod a {
/// baz
pub struct Type;
}
mod b {
/// bar
pub use crate::a::Type;
}
/// foo
pub use b::Type; only shows mod a {
/// baz
pub struct Type;
}
/// bar
pub use a::Type; |
A bit of trivia, not particularly helpful: In 1.33, the cross-crate issue behaved as the single crate issue and only showed |
@rustbot claim |
It is about work on this issue! |
@TaKO8Ki hi, have you made any progress on this issue? No problem if not, but please comment |
@jyn514 |
Sure thing. If it helps, I think this is the place to look: rust/src/librustdoc/clean/inline.rs Line 287 in 4fa76a4
|
@jyn514 |
The problem evolved a bit. With this code: mod a {
/// baz
pub struct Type;
}
mod b {
/// bar
pub use crate::a::Type;
}
/// foo
pub use b::Type; We now have |
Isn't that the same thing I wrote originally? Or is the change that it happens inside one crate as well now (I don't think I tested that scenario before)? |
Sorry, you are absolutely right. I worked on something similar recently and checked if the problem still existed and forgot to check your first message. Sorry. I'm working on this issue to fix it definitely. |
I just tested it and unfortunately it doesn't appear fixed for Ruma in Original definition: https://github.com/ruma/ruma/blob/28a665c3d9be8b83f4d722113a7f3159094d6a3b/crates/ruma-macros/src/lib.rs#LL385C5-L385C15 |
Can you write a minimum code to reproduce the issue please? I think the proc-macro call might be messing with it. |
…-doc-comments, r=notriddle Fix missing reexports' doc comments Fixes rust-lang#81893. The issue was that an import directly "links" to the target without the intermediate imports. Unfortunately, to fix this bug we need to go through them one by one. To do so, I take the import path direct parent (so `b` in `a::b::c`) and then look for `c` into it. r? `@notriddle`
Updated https://github.com/jplatte/rust-issue-81893 with a new reproducer. |
Found out about this issue: the problem is that reexports don't exist in the Rust ABI at the moment. There is work in progress to add support for it but we're far from done. Until then, I'm afraid that foreign reexports docs won't appear... |
what are you talking about? "rust abi" isn't a thing and it wouldn't involve rustdoc if it did, abi is a codegen thing and rustdoc doesn't do codegen. |
By that I meant that this information isn't stored in the |
ok. it's ok not to know everything about the compiler, but please don't make up random words if you're not sure the right word, i would much rather you say "this information isn't stored in the rmeta file" than confuse everyone involved. |
Thanks! |
also there are two parts to this issue, one is within the same crate and one is across crates; only the one across crates can be affected by what's in the metadata file. is the part within the same crate fixed? if not, i think it's unlikely that metadata is related. |
In the same crate it was fixed recently. I wrote a blog post recently about the work on how re-exports are handled in rustdoc here. I also describe how "intermediate" re-exports are handled. So now, the only bug remaining is about foreign re-exports. |
Strictly speaking, there is such a thing as "the Rust ABI". It is unstable, but implicitly, it is defined by "whatever we are currently doing during codegen". However, "ABI" only concerns parts of the program that are reachable at runtime, such as a struct's binary layout, what registers data is passed in, or thread-local storage data. It would be... a strange day where that sort of thing is relevant to rustdoc. |
I have a macro crate with a "peer dependency" on another crate, i.e. I can't write doctests for the macro itself without introducing circular dev-dependencies which are kind of annoying. The other crate re-exports the macro and the macro is actually expected to only ever be used through there, so I documented the re-export instead. However, there's another higher-level crate that re-exports a bunch of other crates entirely including the one that re-exports the macro. In the documentation of the higher-level crate, the documentation for the macro does not appear, while it appears on the "level-one" re-export.
Minimal reproduction:
Crate foo re-exports a type from bar, which is itself a re-export of a type from baz. The docs on each of the declarations (original type definition in
baz
, re-exports inbar
andfoo
) are simply the crate nameHere is a repo with this: https://github.com/jplatte/rust-issue-81893
I expected to see this happen: the docs of
foo::Type
should befoo bar baz
Instead, this happened: the docs of
foo::Type
arefoo baz
Meta
Happens with latest nightly from rustup that has rustfmt:
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: