Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e7f340e
BTree: move blocks around in node.rs
ssomers Feb 16, 2021
7f5964a
Add `download-rustc = "if-unchanged"`
jyn514 Mar 22, 2021
865d0c6
Fix error codes check run and ensure it will not go unnoticed again
GuillaumeGomez Mar 24, 2021
4f73d21
Fix compiletest on FreeBSD
asomers Mar 26, 2021
617e135
rustdoc: highlight macros more efficiently
notriddle Mar 15, 2021
f64038f
rustdoc: update macro highlight tests
notriddle Apr 3, 2021
8a05892
List trait impls before methods from deref in the sidebar of Rustdoc'…
slightlyoutofphase Apr 3, 2021
72502e8
Remove trailing whitespace
slightlyoutofphase Apr 3, 2021
13e482b
Remove unneeded INITIAL_IDS const
GuillaumeGomez Apr 3, 2021
3bd241f
cleanup leak after test to make miri happy
the8472 Apr 2, 2021
572873f
suggestion from review
the8472 Apr 3, 2021
d6a8e6f
Rollup merge of #82726 - ssomers:btree_node_rearange, r=Mark-Simulacrum
GuillaumeGomez Apr 4, 2021
eac7f2e
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
GuillaumeGomez Apr 4, 2021
4a50ec0
Rollup merge of #83451 - GuillaumeGomez:fix-error-code-tidy-check, r=…
GuillaumeGomez Apr 4, 2021
097fe43
Rollup merge of #83532 - asomers:gdb-fbsd, r=Mark-Simulacrum
GuillaumeGomez Apr 4, 2021
b60f497
Rollup merge of #83793 - notriddle:single-span-macro-highlight, r=Gui…
GuillaumeGomez Apr 4, 2021
91ec0c4
Rollup merge of #83809 - GuillaumeGomez:remove-initial-ids, r=camelid
GuillaumeGomez Apr 4, 2021
038cb1e
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shu…
GuillaumeGomez Apr 4, 2021
bd77c13
Rollup merge of #83827 - the8472:fix-inplace-panic-on-drop, r=RalfJung
GuillaumeGomez Apr 4, 2021
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
Prev Previous commit
Next Next commit
Remove unneeded INITIAL_IDS const
  • Loading branch information
GuillaumeGomez committed Apr 3, 2021
commit 13e482bf8384062eb0360603a895ffdbfe2cc95a
1 change: 0 additions & 1 deletion src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ impl Options {
let edition = config::parse_crate_edition(&matches);

let mut id_map = html::markdown::IdMap::new();
id_map.populate(&html::render::INITIAL_IDS);
let external_html = match ExternalHtml::load(
&matches.opt_strs("html-in-header"),
&matches.opt_strs("html-before-content"),
Expand Down
15 changes: 9 additions & 6 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,9 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("rustdoc-vars".to_owned(), 1);
map.insert("sidebar-vars".to_owned(), 1);
map.insert("copy-path".to_owned(), 1);
map.insert("help".to_owned(), 1);
map.insert("TOC".to_owned(), 1);
map.insert("render-detail".to_owned(), 1);
// This is the list of IDs used by rustdoc sections.
map.insert("fields".to_owned(), 1);
map.insert("variants".to_owned(), 1);
Expand All @@ -1365,6 +1368,12 @@ fn init_id_map() -> FxHashMap<String, usize> {
map.insert("trait-implementations".to_owned(), 1);
map.insert("synthetic-implementations".to_owned(), 1);
map.insert("blanket-implementations".to_owned(), 1);
map.insert("associated-types".to_owned(), 1);
map.insert("associated-const".to_owned(), 1);
map.insert("required-methods".to_owned(), 1);
map.insert("provided-methods".to_owned(), 1);
map.insert("implementors".to_owned(), 1);
map.insert("synthetic-implementors".to_owned(), 1);
map
}

Expand All @@ -1373,12 +1382,6 @@ impl IdMap {
IdMap { map: init_id_map() }
}

crate fn populate<I: IntoIterator<Item = S>, S: AsRef<str> + ToString>(&mut self, ids: I) {
for id in ids {
let _ = self.derive(id);
}
}

crate fn derive<S: AsRef<str> + ToString>(&mut self, candidate: S) -> String {
let id = match self.map.get_mut(candidate.as_ref()) {
None => candidate.to_string(),
Expand Down
7 changes: 2 additions & 5 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::print_item::{full_path, item_path, print_item};
use super::write_shared::write_shared;
use super::{
print_sidebar, settings, AllTypes, NameDoc, SharedContext, StylePath, BASIC_KEYWORDS,
CURRENT_DEPTH, INITIAL_IDS,
CURRENT_DEPTH,
};

use crate::clean::{self, AttributesExt};
Expand Down Expand Up @@ -423,14 +423,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
}

fn make_child_renderer(&self) -> Self {
let mut id_map = IdMap::new();
id_map.populate(&INITIAL_IDS);

Self {
current: self.current.clone(),
dst: self.dst.clone(),
render_redirect_pages: self.render_redirect_pages,
id_map: RefCell::new(id_map),
id_map: RefCell::new(IdMap::new()),
deref_id_map: RefCell::new(FxHashMap::default()),
shared: Rc::clone(&self.shared),
cache: Rc::clone(&self.cache),
Expand Down
18 changes: 0 additions & 18 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,24 +283,6 @@ crate struct StylePath {

thread_local!(crate static CURRENT_DEPTH: Cell<usize> = Cell::new(0));

crate const INITIAL_IDS: [&'static str; 15] = [
"main",
"search",
"help",
"TOC",
"render-detail",
"associated-types",
"associated-const",
"required-methods",
"provided-methods",
"implementors",
"synthetic-implementors",
"implementors-list",
"synthetic-implementors-list",
"methods",
"implementations",
];

fn write_srclink(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer) {
if let Some(l) = cx.src_href(item) {
write!(buf, "<a class=\"srclink\" href=\"{}\" title=\"goto source code\">[src]</a>", l)
Expand Down