Skip to content

Commit 61ad9fe

Browse files
committed
Use BTreeMap in build_sidebar_items
This ensures that later when generating HTML, the JSON will be sorted aswell. We now have a deterministic build of sidebar-items.js
1 parent 798fa22 commit 61ad9fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustdoc/html/render.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub use self::ExternalLocation::*;
3737
use std::ascii::OwnedAsciiExt;
3838
use std::cell::RefCell;
3939
use std::cmp::Ordering;
40-
use std::collections::{HashMap, HashSet};
40+
use std::collections::{BTreeMap, HashMap, HashSet};
4141
use std::default::Default;
4242
use std::fmt;
4343
use std::fs::{self, File};
@@ -1319,8 +1319,9 @@ impl Context {
13191319
}
13201320
}
13211321

1322-
fn build_sidebar_items(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
1323-
let mut map = HashMap::new();
1322+
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<NameDoc>> {
1323+
// BTreeMap instead of HashMap to get a sorted output
1324+
let mut map = BTreeMap::new();
13241325
for item in &m.items {
13251326
if self.ignore_private_item(item) { continue }
13261327

0 commit comments

Comments
 (0)