Skip to content

Commit dd403e4

Browse files
committed
Make re-export collection deterministic
Previously, we were using an `FxHashMap` to collect module re-exports. However, re-exports end up getting serialized into crate metadata, which means that metadata generation was non-deterministic. This resulted in spurious error messages changes (e.g. PR #64906) due to pretty-printing implicitly depending on the order of re-exports when computing the proper path to show to the user. See #65042 for a long-term strategy to detect this kind of issue
1 parent 7870050 commit dd403e4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/librustc_resolve/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use std::{cmp, fmt, iter, ptr};
5858
use std::collections::BTreeSet;
5959
use rustc_data_structures::ptr_key::PtrKey;
6060
use rustc_data_structures::sync::Lrc;
61+
use rustc_data_structures::fx::FxIndexMap;
6162

6263
use diagnostics::{Suggestion, ImportSuggestion};
6364
use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding};
@@ -431,7 +432,7 @@ impl ModuleKind {
431432
}
432433
}
433434

434-
type Resolutions<'a> = RefCell<FxHashMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>;
435+
type Resolutions<'a> = RefCell<FxIndexMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>;
435436

436437
/// One node in the tree of modules.
437438
pub struct ModuleData<'a> {

0 commit comments

Comments
 (0)