Skip to content

Commit 32956cb

Browse files
mvdnessteveklabnik
authored andcommitted
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 e12671b commit 32956cb

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};
@@ -1298,8 +1298,9 @@ impl Context {
12981298
}
12991299
}
13001300

1301-
fn build_sidebar_items(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
1302-
let mut map = HashMap::new();
1301+
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<NameDoc>> {
1302+
// BTreeMap instead of HashMap to get a sorted output
1303+
let mut map = BTreeMap::new();
13031304
for item in &m.items {
13041305
if self.ignore_private_item(item) { continue }
13051306

0 commit comments

Comments
 (0)