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

Record visibility of reexports for all items, not just type items #73365

Merged
merged 3 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,22 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
if !res_did.is_local() && !is_no_inline {
let attrs = clean::inline::load_attrs(self.cx, res_did);
let self_is_hidden = attrs.lists(sym::doc).has_word(sym::hidden);
match res {
Res::Def(
DefKind::Trait
| DefKind::Struct
| DefKind::Union
| DefKind::Enum
| DefKind::ForeignTy
| DefKind::TyAlias,
did,
) if !self_is_hidden => {
self.cx.renderinfo.get_mut().access_levels.map.insert(did, AccessLevel::Public);
}
Res::Def(DefKind::Mod, did) => {
if !self_is_hidden {
crate::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did);
if !self_is_hidden {
if let Res::Def(kind, did) = res {
if kind == DefKind::Mod {
crate::visit_lib::LibEmbargoVisitor::new(self.cx).visit_mod(did)
} else {
// All items need to be handled here in case someone wishes to link
// to them with intra-doc links
self.cx
.renderinfo
.get_mut()
.access_levels
.map
.insert(did, AccessLevel::Public);
}
}
_ => {}
}

return false;
}

Expand Down
19 changes: 19 additions & 0 deletions src/test/rustdoc/intra-doc-crate/auxiliary/hidden.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![crate_name = "hidden_dep"]
#![deny(intra_doc_link_resolution_failure)]

#[doc(hidden)]
pub mod __reexport {
pub use crate::*;
}

pub mod future {
mod ready {

/// Link to [`ready`](function@ready)
pub struct Ready;
pub fn ready() {}

}
pub use self::ready::{ready, Ready};

}
10 changes: 10 additions & 0 deletions src/test/rustdoc/intra-doc-crate/hidden.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// aux-build:hidden.rs
// build-aux-docs
#![deny(intra_doc_link_resolution_failure)]

// tests /~https://github.com/rust-lang/rust/issues/73363

extern crate hidden_dep;

// @has 'hidden/struct.Ready.html' '//a/@href' '../hidden/fn.ready.html'
pub use hidden_dep::future::{ready, Ready};