Open
Description
I tried this code:
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index c08fe47696b..9238ed5477e 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -479,7 +479,12 @@ fn to_module_fqp(shortty: ItemType, fqp: &[String]) -> &[String] {
if shortty == ItemType::Module { &fqp[..] } else { &fqp[..fqp.len() - 1] }
}
- if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private {
+ if !cache.access_levels.is_public(did) && !cache.document_private {
+ // Private local items used to not be checked. Make sure that the behavior is the same as before.
+ if did.is_local() {
+ // NOTE: we don't need to check `external_paths.get(did).is_none()` because the crate will always be unknown.
+ assert!(cache.paths.get(&did).is_none(), "{:?}", did);
+ }
return None;
}
I expected to see this happen: All the rustdoc tests pass; this should be the same behavior as before.
Instead, this happened:
---- [rustdoc] rustdoc/blanket-reexport-item.rs stdout ----
------------------------------------------
stderr:
------------------------------------------
thread 'rustc' panicked at 'DefId(0:5 ~ foo[cf51]::m::S)', src/librustdoc/html/format.rs:486:13
The code for this test is
rust/src/test/rustdoc/blanket-reexport-item.rs
Lines 1 to 8 in dfd7b8d
m::S
should be marked as public (since it's accessible through the glob re-export), but is not.
Meta
HEAD is 432e145.
Backtrace
thread 'rustc' panicked at 'DefId(0:5 ~ foo[cf51]::m::S)', src/librustdoc/html/format.rs:486:13
stack backtrace:
0: rust_begin_unwind
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/std/src/panicking.rs:515:5
1: std::panicking::begin_panic_fmt
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/std/src/panicking.rs:457:5
2: rustdoc::html::format::href
at ./src/librustdoc/html/format.rs:486:13
3: rustdoc::html::format::anchor
at ./src/librustdoc/html/format.rs:681:17
4: rustdoc::html::format::resolved_path
at ./src/librustdoc/html/format.rs:585:13
5: rustdoc::html::format::fmt_type
at ./src/librustdoc/html/format.rs:711:13
6: rustdoc::html::format::<impl rustdoc::clean::types::Impl>::print::{{closure}}
7: <rustdoc::html::format::display_fn::WithFormatter<F> as core::fmt::Display>::fmt
at ./src/librustdoc/html/format.rs:1429:13
8: <T as alloc::string::ToString>::to_string
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/alloc/src/string.rs:2379:9
9: rustdoc::html::render::write_shared::write_shared::{{closure}}
at ./src/librustdoc/html/render/write_shared.rs:520:31
10: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/core/src/ops/function.rs:269:13
11: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::find_map
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/core/src/slice/iter/macros.rs:268:38
12: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/core/src/iter/adapters/filter_map.rs:61:9
13: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/alloc/src/vec/spec_from_iter_nested.rs:23:32
14: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/alloc/src/vec/spec_from_iter.rs:33:9
15: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/alloc/src/vec/mod.rs:2453:9
16: core::iter::traits::iterator::Iterator::collect
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/library/core/src/iter/traits/iterator.rs:1748:9
17: rustdoc::html::render::write_shared::write_shared
at ./src/librustdoc/html/render/write_shared.rs:506:28
18: <rustdoc::html::render::context::Context as rustdoc::formats::renderer::FormatRenderer>::init
at ./src/librustdoc/html/render/context.rs:504:9
19: rustdoc::formats::renderer::run_format::{{closure}}
at ./src/librustdoc/formats/renderer.rs:62:17
20: rustc_data_structures::profiling::VerboseTimingGuard::run
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_data_structures/src/profiling.rs:573:9
21: rustdoc::formats::renderer::run_format
at ./src/librustdoc/formats/renderer.rs:60:40
22: rustdoc::run_renderer
at ./src/librustdoc/lib.rs:668:11
23: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}::{{closure}}
at ./src/librustdoc/lib.rs:769:25
24: rustc_data_structures::profiling::VerboseTimingGuard::run
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_data_structures/src/profiling.rs:573:9
25: rustc_session::utils::<impl rustc_session::session::Session>::time
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_session/src/utils.rs:16:9
26: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}
at ./src/librustdoc/lib.rs:768:51
27: rustc_interface::passes::QueryContext::enter::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/passes.rs:780:42
28: rustc_middle::ty::context::tls::enter_context::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_middle/src/ty/context.rs:1765:50
29: rustc_middle::ty::context::tls::set_tlv
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_middle/src/ty/context.rs:1749:9
30: rustc_middle::ty::context::tls::enter_context
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_middle/src/ty/context.rs:1765:9
31: rustc_interface::passes::QueryContext::enter
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/passes.rs:780:9
32: rustdoc::main_options::{{closure}}::{{closure}}
at ./src/librustdoc/lib.rs:742:13
33: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/queries.rs:390:19
34: rustdoc::main_options::{{closure}}
at ./src/librustdoc/lib.rs:722:9
35: rustc_interface::interface::create_compiler_and_run::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/interface.rs:208:13
36: rustc_span::with_source_map
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_span/src/lib.rs:917:5
37: rustc_interface::interface::create_compiler_and_run
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/interface.rs:202:5
38: rustdoc::main_options
at ./src/librustdoc/lib.rs:721:5
39: rustdoc::main_args::{{closure}}
at ./src/librustdoc/lib.rs:648:17
40: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/util.rs:155:13
41: scoped_tls::ScopedKey<T>::set
at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
42: rustc_span::create_session_globals_then
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_span/src/lib.rs:108:5
43: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/util.rs:153:9
44: rustc_interface::util::scoped_thread::{{closure}}
at /rustc/432e145bd5a974c5b6f4dd9b352891bd7502b69d/compiler/rustc_interface/src/util.rs:128:24
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.