Rollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomez
rustdoc: Remove unused `collapsed` field `render/context` always runs after `run_global_context`, so it was always set to `true`. This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was removed ages ago, and the ability to configure passes is about to be removed. Found while reviewing https://github.com/rust-lang/rust/pull/91305.
This commit is contained in:
commit
1f080f64ee
5 changed files with 4 additions and 17 deletions
|
@ -122,12 +122,11 @@ crate struct Crate {
|
||||||
crate primitives: ThinVec<(DefId, PrimitiveType)>,
|
crate primitives: ThinVec<(DefId, PrimitiveType)>,
|
||||||
/// Only here so that they can be filtered through the rustdoc passes.
|
/// Only here so that they can be filtered through the rustdoc passes.
|
||||||
crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
|
crate external_traits: Rc<RefCell<FxHashMap<DefId, TraitWithExtraInfo>>>,
|
||||||
crate collapsed: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Crate` is frequently moved by-value. Make sure it doesn't unintentionally get bigger.
|
// `Crate` is frequently moved by-value. Make sure it doesn't unintentionally get bigger.
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
rustc_data_structures::static_assert_size!(Crate, 80);
|
rustc_data_structures::static_assert_size!(Crate, 72);
|
||||||
|
|
||||||
impl Crate {
|
impl Crate {
|
||||||
crate fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
crate fn name(&self, tcx: TyCtxt<'_>) -> Symbol {
|
||||||
|
|
|
@ -72,7 +72,7 @@ crate fn krate(cx: &mut DocContext<'_>) -> Crate {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Crate { module, primitives, external_traits: cx.external_traits.clone(), collapsed: false }
|
Crate { module, primitives, external_traits: cx.external_traits.clone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn external_generic_args(
|
fn external_generic_args(
|
||||||
|
|
|
@ -510,9 +510,6 @@ crate fn run_global_ctxt(
|
||||||
|
|
||||||
krate = tcx.sess.time("create_format_cache", || Cache::populate(&mut ctxt, krate));
|
krate = tcx.sess.time("create_format_cache", || Cache::populate(&mut ctxt, krate));
|
||||||
|
|
||||||
// The main crate doc comments are always collapsed.
|
|
||||||
krate.collapsed = true;
|
|
||||||
|
|
||||||
(krate, ctxt.render_options, ctxt.cache)
|
(krate, ctxt.render_options, ctxt.cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,6 @@ crate struct SharedContext<'tcx> {
|
||||||
crate local_sources: FxHashMap<PathBuf, String>,
|
crate local_sources: FxHashMap<PathBuf, String>,
|
||||||
/// Show the memory layout of types in the docs.
|
/// Show the memory layout of types in the docs.
|
||||||
pub(super) show_type_layout: bool,
|
pub(super) show_type_layout: bool,
|
||||||
/// Whether the collapsed pass ran
|
|
||||||
collapsed: bool,
|
|
||||||
/// The base-URL of the issue tracker for when an item has been tagged with
|
/// The base-URL of the issue tracker for when an item has been tagged with
|
||||||
/// an issue number.
|
/// an issue number.
|
||||||
pub(super) issue_tracker_base_url: Option<String>,
|
pub(super) issue_tracker_base_url: Option<String>,
|
||||||
|
@ -142,12 +140,6 @@ impl SharedContext<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the `collapsed_doc_value` of the given item if this is the main crate, otherwise
|
|
||||||
/// returns the `doc_value`.
|
|
||||||
crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option<String> {
|
|
||||||
if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() }
|
|
||||||
}
|
|
||||||
|
|
||||||
crate fn edition(&self) -> Edition {
|
crate fn edition(&self) -> Edition {
|
||||||
self.tcx.sess.edition()
|
self.tcx.sess.edition()
|
||||||
}
|
}
|
||||||
|
@ -472,7 +464,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||||
let (sender, receiver) = channel();
|
let (sender, receiver) = channel();
|
||||||
let mut scx = SharedContext {
|
let mut scx = SharedContext {
|
||||||
tcx,
|
tcx,
|
||||||
collapsed: krate.collapsed,
|
|
||||||
src_root,
|
src_root,
|
||||||
local_sources,
|
local_sources,
|
||||||
issue_tracker_base_url,
|
issue_tracker_base_url,
|
||||||
|
|
|
@ -567,7 +567,7 @@ fn document_full_inner(
|
||||||
is_collapsible: bool,
|
is_collapsible: bool,
|
||||||
heading_offset: HeadingOffset,
|
heading_offset: HeadingOffset,
|
||||||
) {
|
) {
|
||||||
if let Some(s) = cx.shared.maybe_collapsed_doc_value(item) {
|
if let Some(s) = item.collapsed_doc_value() {
|
||||||
debug!("Doc block: =====\n{}\n=====", s);
|
debug!("Doc block: =====\n{}\n=====", s);
|
||||||
if is_collapsible {
|
if is_collapsible {
|
||||||
w.write_str(
|
w.write_str(
|
||||||
|
@ -1612,7 +1612,7 @@ fn render_impl(
|
||||||
write!(w, "</summary>")
|
write!(w, "</summary>")
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
|
if let Some(ref dox) = i.impl_item.collapsed_doc_value() {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
|
|
Loading…
Reference in a new issue