Skip to content

Commit 758519c

Browse files
Index IDs already used by rustdoc template
1 parent 4ade6eb commit 758519c

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/librustdoc/html/markdown.rs

+29-2
Original file line numberDiff line numberDiff line change
@@ -1129,9 +1129,36 @@ pub struct IdMap {
11291129
map: FxHashMap<String, usize>,
11301130
}
11311131

1132+
fn init_id_map() -> FxHashMap<String, usize> {
1133+
let mut map = FxHashMap::default();
1134+
// This is the list of IDs used by rustdoc templates.
1135+
map.insert("mainThemeStyle".to_owned(), 1);
1136+
map.insert("themeStyle".to_owned(), 1);
1137+
map.insert("theme-picker".to_owned(), 1);
1138+
map.insert("theme-choices".to_owned(), 1);
1139+
map.insert("settings-menu".to_owned(), 1);
1140+
map.insert("main".to_owned(), 1);
1141+
map.insert("search".to_owned(), 1);
1142+
map.insert("crate-search".to_owned(), 1);
1143+
map.insert("render-detail".to_owned(), 1);
1144+
map.insert("toggle-all-docs".to_owned(), 1);
1145+
map.insert("all-types".to_owned(), 1);
1146+
// This is the list of IDs used by rustdoc sections.
1147+
map.insert("fields".to_owned(), 1);
1148+
map.insert("variants".to_owned(), 1);
1149+
map.insert("implementors-list".to_owned(), 1);
1150+
map.insert("synthetic-implementors-list".to_owned(), 1);
1151+
map.insert("implementations".to_owned(), 1);
1152+
map.insert("trait-implementations".to_owned(), 1);
1153+
map.insert("synthetic-implementations".to_owned(), 1);
1154+
map.insert("blanket-implementations".to_owned(), 1);
1155+
map.insert("deref-methods".to_owned(), 1);
1156+
map
1157+
}
1158+
11321159
impl IdMap {
11331160
pub fn new() -> Self {
1134-
IdMap::default()
1161+
IdMap { map: init_id_map() }
11351162
}
11361163

11371164
pub fn populate<I: IntoIterator<Item = String>>(&mut self, ids: I) {
@@ -1141,7 +1168,7 @@ impl IdMap {
11411168
}
11421169

11431170
pub fn reset(&mut self) {
1144-
self.map = FxHashMap::default();
1171+
self.map = init_id_map();
11451172
}
11461173

11471174
pub fn derive(&mut self, candidate: String) -> String {

0 commit comments

Comments
 (0)