Code change:
I tried this code: I expected to see this happen: The documentation is empty. Instead, this happened: ! <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: rustdoc 1.58.0-nightly ( 2021-11-12) cc I suspect this is related to one of your recent changes to visibility.
This does appear to have been . I'm not entirely sure how to fix this. Basically, what's happening here is that the query is checking if the use statement is accessible from its parent module. It is, because the parent module of the top level of the module is itself. Before this, it would have been documented if you did a , but not with just . The new behavior is more consistent, and better in that sense, but perhaps not ideal. Do you have an idea on how you'd like this to work?
Some additional thoughts: If we want to stick to the "visible from parent module" thing, the simplest way to do that would be to add a check for whether is the top level module. Of course, I'd also have to add a check for the visibility being actually public... sighs. Might need to break this into a seperate thing. I guess the problem I'm struggling with after thinking about all of this is that I don't fully understand the justification for all of this logic. Why is it that we want to show some imports but not others? If these were structs, we'd just show all of them, regardless of their visibility. That said, if this really is the behavior we want, it shouldn't be hard to implement.
I think we should inline neither nor bare (pretty sure I said so on the PR, but I guess I forgot to check for a test case). Because the structs are only visible from the module where they're defined. The use statements aren't intended to be used from elsewhere in the crate.
I think I explained this poorly above. We generally don't inline either or bare . Not doing so is the intended behavior from the PR. Because of how I implemented it, the top of the crate ended up being an inadvertent exception, and we didn't have any tests that covered the top of the crate as opposed to lower level modules. It's an easy fix if we want it not to be an exception, I was just trying to make sure we had a clear philosophical reason for wanting things to be the way we were trying to have them be. (In other words, I was double-checking that the behavior the PR was supposed to create is really what we want before submitting a PR to do that.) It sounds like it is, so I'll get working on a bugfix. I feel like I'm expressing myself rather unclearly at the moment. If there's anything I need to clear up about this explanation, please feel free to let me know.
Oh oops, I missed this bit. Yes, I think this should be consistent with the submodules of the crate.
I agree, that sounds like the right behavior to me.
Quick update: I've got a substantive patch, but it's taking a while to get the tests to a point where I'm satisfied with them.
My PR is up! Also, I'm going to assign this as a , per the discussion in of the prioritization working group.

Related discussion:
text: // @has 'foo/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {' pub use reexports::addr_of; <del> // @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {' </del> <ins> // @!has 'foo/macro.addr_of_crate.html' </ins> pub(crate) use reexports::addr_of_crate; <del> // @has 'foo/macro.addr_of_self.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_self($place : expr) {' </del> <ins> // @!has 'foo/macro.addr_of_self.html' </ins> pub(self) use reexports::addr_of_self; <ins> // @!has 'foo/macro.addr_of_local.html' use reexports::addr_of_local; </ins> // @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo; <del> // @has 'foo/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;' </del> <ins> // @!has 'foo/struct.FooCrate.html' </ins> pub(crate) use reexports::FooCrate; <del> // @has 'foo/struct.FooSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooSelf;' </del> <ins> // @!has 'foo/struct.FooSelf.html' </ins> pub(self) use reexports::FooSelf; <ins> // @!has 'foo/struct.FooLocal.html' use reexports::FooLocal; </ins> // @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar; <del> // @has 'foo/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {' </del> <ins> // @!has 'foo/enum.BarCrate.html' </ins> pub(crate) use reexports::BarCrate; <del> // @has 'foo/enum.BarSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarSelf {' </del> <ins> // @!has 'foo/enum.BarSelf.html' </ins> pub(self) use reexports::BarSelf; <ins> // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; </ins> // @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo; <del> // @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' </del> <ins> // @!has 'foo/fn.foo_crate.html' </ins> pub(crate) use reexports::foo_crate; <del> // @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()' </del> <ins> // @!has 'foo/fn.foo_self.html' </ins> pub(self) use reexports::foo_self; <ins> // @!has 'foo/fn.foo_local.html' use reexports::foo_local; </ins> // @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type; <del> // @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' </del> <ins> // @!has 'foo/type.TypeCrate.html' </ins> pub(crate) use reexports::TypeCrate; <del> // @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf =' </del> <ins> // @!has 'foo/type.TypeSelf.html' </ins> pub(self) use reexports::TypeSelf; <ins> // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; </ins> // @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union; <del> // @has 'foo/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {' </del> <ins> // @!has 'foo/union.UnionCrate.html' </ins> pub(crate) use reexports::UnionCrate; <del> // @has 'foo/union.UnionSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionSelf {' </del> <ins> // @!has 'foo/union.UnionSelf.html' </ins> pub(self) use reexports::UnionSelf; <ins> // @!has 'foo/union.UnionLocal.html' use reexports::UnionLocal; </ins> <del> pub mod foo { // @!has 'foo/foo/union.Union.html' use crate::reexports::Union; </del> <ins> pub mod outer { pub mod inner { // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {' pub use reexports::addr_of; // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {' pub(crate) use reexports::addr_of_crate; // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="docblock item-decl"]' 'pub(in outer) macro addr_of_super($place : expr) {' pub(super) use reexports::addr_of_super; // @!has 'foo/outer/inner/macro.addr_of_self.html' pub(self) use reexports::addr_of_self; // @!has 'foo/outer/inner/macro.addr_of_local.html' use reexports::addr_of_local; // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;' pub(crate) use reexports::FooCrate; // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) struct FooSuper;' pub(super) use reexports::FooSuper; // @!has 'foo/outer/inner/struct.FooSelf.html' pub(self) use reexports::FooSelf; // @!has 'foo/outer/inner/struct.FooLocal.html' use reexports::FooLocal; // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {' pub(crate) use reexports::BarCrate; // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) enum BarSuper {' pub(super) use reexports::BarSuper; // @!has 'foo/outer/inner/enum.BarSelf.html' pub(self) use reexports::BarSelf; // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo; // @has 'foo/outer/inner/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' pub(crate) use reexports::foo_crate; // @has 'foo/outer/inner/fn.foo_super.html' '//*[@class="rust fn"]' 'pub(in outer) fn foo_super()' pub(super) use::reexports::foo_super; // @!has 'foo/outer/inner/fn.foo_self.html' pub(self) use reexports::foo_self; // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type; // @has 'foo/outer/inner/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' pub(crate) use reexports::TypeCrate; // @has 'foo/outer/inner/type.TypeSuper.html' '//*[@class="rust typedef"]' 'pub(in outer) type TypeSuper =' pub(super) use reexports::TypeSuper; // @!has 'foo/outer/inner/type.TypeSelf.html' pub(self) use reexports::TypeSelf; // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union; // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {' pub(crate) use reexports::UnionCrate; // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) union UnionSuper {' pub(super) use reexports::UnionSuper; // @!has 'foo/outer/inner/union.UnionSelf.html' pub(self) use reexports::UnionSelf; // @!has 'foo/outer/inner/union.UnionLocal.html' use reexports::UnionLocal; } } mod re_re_exports { // @!has 'foo/re_re_exports/union.Union.html' use crate::reexports::Union; </ins> }