1
Fork 0

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
This commit is contained in:
Aaron Hill 2019-10-03 00:31:21 -04:00
parent 7870050796
commit dd403e4ab0
No known key found for this signature in database
GPG key ID: B4087E510E98B164

View file

@ -58,6 +58,7 @@ use std::{cmp, fmt, iter, ptr};
use std::collections::BTreeSet; use std::collections::BTreeSet;
use rustc_data_structures::ptr_key::PtrKey; use rustc_data_structures::ptr_key::PtrKey;
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use rustc_data_structures::fx::FxIndexMap;
use diagnostics::{Suggestion, ImportSuggestion}; use diagnostics::{Suggestion, ImportSuggestion};
use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding}; use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding};
@ -431,7 +432,7 @@ impl ModuleKind {
} }
} }
type Resolutions<'a> = RefCell<FxHashMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>; type Resolutions<'a> = RefCell<FxIndexMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>;
/// One node in the tree of modules. /// One node in the tree of modules.
pub struct ModuleData<'a> { pub struct ModuleData<'a> {