Skip to content

Commit 5438004

Browse files
committed
Change Cfg<T> to an FxIndexSet.
Despite what I claimed in an earlier commit, the ordering does matter to some degree. Using `FxIndexSet` prevents changes to the error message order in `tests/ui/check-cfg/mix.rs`.
1 parent 5e54997 commit 5438004

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/rustc_session/src/config.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
99
use crate::{lint, HashStableContext};
1010
use crate::{EarlyErrorHandler, Session};
1111

12-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
12+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
1313
use rustc_data_structures::stable_hasher::{StableOrd, ToStableHashKey};
1414
use rustc_target::abi::Align;
1515
use rustc_target::spec::LinkSelfContainedComponents;
@@ -1361,7 +1361,10 @@ fn default_configuration(sess: &Session) -> Cfg<Symbol> {
13611361
/// crate, used to drive conditional compilation. `T` is always `String` or
13621362
/// `Symbol`. Strings are used temporarily very early on. Once the the main
13631363
/// symbol interner is running, they are converted to symbols.
1364-
pub type Cfg<T> = FxHashSet<(T, Option<T>)>;
1364+
///
1365+
/// An `FxIndexSet` is used to ensure deterministic ordering of error messages
1366+
/// relating to `--cfg`.
1367+
pub type Cfg<T> = FxIndexSet<(T, Option<T>)>;
13651368

13661369
/// The parsed `--check-cfg` options. The `<T>` structure is similar to `Cfg`.
13671370
pub struct CheckCfg<T> {

0 commit comments

Comments
 (0)