Skip to content

Commit 1e32922

Browse files
committed
use BTreeMap
1 parent dd327f5 commit 1e32922

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

compiler/rustc_borrowck/src/region_infer/values.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1+
use rustc_data_structures::fx::FxHashSet;
2+
use rustc_data_structures::fx::FxIndexSet;
23
use rustc_index::bit_set::SparseBitMatrix;
34
use rustc_index::interval::IntervalSet;
45
use rustc_index::interval::SparseIntervalMatrix;

compiler/rustc_codegen_llvm/src/back/lto.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ use rustc_codegen_ssa::traits::*;
1414
use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind};
1515
use rustc_data_structures::fx::FxHashMap;
1616
use rustc_data_structures::memmap::Mmap;
17-
use rustc_data_structures::unord::UnordMap;
1817
use rustc_errors::{DiagCtxt, FatalError};
1918
use rustc_hir::def_id::LOCAL_CRATE;
2019
use rustc_middle::bug;
2120
use rustc_middle::dep_graph::WorkProduct;
2221
use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
2322
use rustc_session::config::{self, CrateType, Lto};
2423

24+
use std::collections::BTreeMap;
2525
use std::ffi::{CStr, CString};
2626
use std::fs::File;
2727
use std::io;
@@ -788,7 +788,7 @@ pub unsafe fn optimize_thin_module(
788788
#[derive(Debug, Default)]
789789
pub struct ThinLTOKeysMap {
790790
// key = llvm name of importing module, value = LLVM cache key
791-
keys: UnordMap<String, String>,
791+
keys: BTreeMap<String, String>,
792792
}
793793

794794
impl ThinLTOKeysMap {
@@ -798,15 +798,15 @@ impl ThinLTOKeysMap {
798798
let mut writer = io::BufWriter::new(file);
799799
// The entries are loaded back into a hash map in `load_from_file()`, so
800800
// the order in which we write them to file here does not matter.
801-
for (module, key) in self.keys.items().into_sorted_stable_ord() {
801+
for (module, key) in &self.keys {
802802
writeln!(writer, "{module} {key}")?;
803803
}
804804
Ok(())
805805
}
806806

807807
fn load_from_file(path: &Path) -> io::Result<Self> {
808808
use std::io::BufRead;
809-
let mut keys = UnordMap::default();
809+
let mut keys = BTreeMap::default();
810810
let file = File::open(path)?;
811811
for line in io::BufReader::new(file).lines() {
812812
let line = line?;

compiler/rustc_codegen_ssa/src/base.rs

+2
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,8 @@ impl CrateInfo {
912912
.collect();
913913
let prefix = if target.is_like_windows && target.arch == "x86" { "_" } else { "" };
914914

915+
// This loop only adds new items to values of the hash map, so the order in which we
916+
// iterate over the values is not important.
915917
#[allow(rustc::potential_query_instability)]
916918
info.linked_symbols
917919
.iter_mut()

0 commit comments

Comments
 (0)