Skip to content

Commit

Permalink
Change Cfg<T> to an FxIndexSet.
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
nnethercote committed Oct 27, 2023
1 parent 5e54997 commit 5438004
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
use crate::{lint, HashStableContext};
use crate::{EarlyErrorHandler, Session};

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

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

0 comments on commit 5438004

Please sign in to comment.