Skip to content

Commit

Permalink
Make re-export collection deterministic
Browse files Browse the repository at this point in the history
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 rust-lang#64906) due to pretty-printing
implicitly depending on the order of re-exports when computing the
proper path to show to the user.

See rust-lang#65042 for a long-term strategy to detect this kind of issue
  • Loading branch information
Aaron1011 committed Oct 5, 2019
1 parent 7870050 commit dd403e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ use std::{cmp, fmt, iter, ptr};
use std::collections::BTreeSet;
use rustc_data_structures::ptr_key::PtrKey;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::fx::FxIndexMap;

use diagnostics::{Suggestion, ImportSuggestion};
use diagnostics::{find_span_of_binding_until_next_binding, extend_span_to_previous_binding};
Expand Down Expand Up @@ -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.
pub struct ModuleData<'a> {
Expand Down

0 comments on commit dd403e4

Please sign in to comment.