diff --git a/Cargo.lock b/Cargo.lock index e977964b72c01..82f70c1e9e837 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1382,7 +1382,7 @@ dependencies = [ "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rustc-hash", + "rustc-hash 1.1.0", "self_cell 0.10.3", "smallvec", "unic-langid", @@ -1646,6 +1646,15 @@ dependencies = [ "serde", ] +[[package]] +name = "gxhash" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a197c9b654827513cf53842c5c6d3da2b4b35a785f8e0eff78bdf8e445aba1bb" +dependencies = [ + "rustversion", +] + [[package]] name = "handlebars" version = "5.1.2" @@ -2074,7 +2083,7 @@ dependencies = [ "anyhow", "clap", "fs-err", - "rustc-hash", + "rustc-hash 1.1.0", "rustdoc-json-types", "serde", "serde_json", @@ -2406,7 +2415,7 @@ dependencies = [ "memmap2", "parking_lot", "perf-event-open-sys", - "rustc-hash", + "rustc-hash 1.1.0", "smallvec", ] @@ -3016,7 +3025,7 @@ checksum = "c4e8e505342045d397d0b6674dcb82d6faf5cf40484d30eeb88fc82ef14e903f" dependencies = [ "datafrog", "log", - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] @@ -3448,6 +3457,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-main" version = "0.0.0" @@ -3817,6 +3832,7 @@ dependencies = [ "either", "elsa", "ena", + "gxhash", "indexmap", "jobserver", "libc", @@ -3824,7 +3840,7 @@ dependencies = [ "memmap2", "parking_lot", "portable-atomic", - "rustc-hash", + "rustc-hash 2.0.0", "rustc-rayon", "rustc_arena", "rustc_graphviz", @@ -4512,7 +4528,7 @@ dependencies = [ name = "rustc_pattern_analysis" version = "0.0.0" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", "rustc_apfloat", "rustc_arena", "rustc_data_structures", @@ -4904,7 +4920,7 @@ name = "rustdoc-json-types" version = "0.1.0" dependencies = [ "bincode", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "serde_json", ] @@ -5632,7 +5648,7 @@ dependencies = [ "ignore", "miropt-test-tools", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "semver", "similar", "termcolor", @@ -5886,7 +5902,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] diff --git a/blah.txt b/blah.txt new file mode 100644 index 0000000000000..e1113e5feba56 --- /dev/null +++ b/blah.txt @@ -0,0 +1 @@ +hola1 \ No newline at end of file diff --git a/compiler/rustc_ast/src/format.rs b/compiler/rustc_ast/src/format.rs index 49910e2283dda..15674ec1359d5 100644 --- a/compiler/rustc_ast/src/format.rs +++ b/compiler/rustc_ast/src/format.rs @@ -1,6 +1,6 @@ use crate::ptr::P; use crate::Expr; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_macros::{Decodable, Encodable}; use rustc_span::symbol::{Ident, Symbol}; use rustc_span::Span; @@ -65,14 +65,14 @@ pub struct FormatArguments { arguments: Vec, num_unnamed_args: usize, num_explicit_args: usize, - names: FxHashMap, + names: GxHashMap, } impl FormatArguments { pub fn new() -> Self { Self { arguments: Vec::new(), - names: FxHashMap::default(), + names: GxHashMap::default(), num_unnamed_args: 0, num_explicit_args: 0, } diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index 666e7763e6276..8a0df9c13fca2 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -11,7 +11,7 @@ use super::LoweringContext; use rustc_ast::ptr::P; use rustc_ast::*; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_session::parse::feature_err; @@ -68,7 +68,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { .emit(); } - let mut clobber_abis = FxIndexMap::default(); + let mut clobber_abis = GxIndexMap::default(); if let Some(asm_arch) = asm_arch { for (abi_name, abi_span) in &asm.clobber_abis { match asm::InlineAsmClobberAbi::parse(asm_arch, &self.tcx.sess.target, *abi_name) { @@ -318,8 +318,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } - let mut used_input_regs = FxHashMap::default(); - let mut used_output_regs = FxHashMap::default(); + let mut used_input_regs = GxHashMap::default(); + let mut used_output_regs = GxHashMap::default(); for (idx, &(ref op, op_sp)) in operands.iter().enumerate() { if let Some(reg) = op.reg() { @@ -362,7 +362,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // Flag to output the error only once per operand let mut skip = false; - let mut check = |used_regs: &mut FxHashMap, + let mut check = |used_regs: &mut GxHashMap, input, r: asm::InlineAsmReg| { match used_regs.entry(r) { @@ -436,7 +436,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // If a clobber_abi is specified, add the necessary clobbers to the // operands list. - let mut clobbered = FxHashSet::default(); + let mut clobbered = GxHashSet::default(); for (abi, (_, abi_span)) in clobber_abis { for &clobber in abi.clobbered_regs() { // Don't emit a clobber for a register already clobbered diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs index ca4604c60c580..72104577718e7 100644 --- a/compiler/rustc_ast_lowering/src/format.rs +++ b/compiler/rustc_ast_lowering/src/format.rs @@ -3,7 +3,7 @@ use core::ops::ControlFlow; use rustc_ast as ast; use rustc_ast::visit::Visitor; use rustc_ast::*; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir as hir; use rustc_span::{ sym, @@ -282,7 +282,7 @@ fn make_count<'hir>( ctx: &mut LoweringContext<'_, 'hir>, sp: Span, count: &Option, - argmap: &mut FxIndexMap<(usize, ArgumentType), Option>, + argmap: &mut GxIndexMap<(usize, ArgumentType), Option>, ) -> hir::Expr<'hir> { match count { Some(FormatCount::Literal(n)) => { @@ -335,7 +335,7 @@ fn make_format_spec<'hir>( ctx: &mut LoweringContext<'_, 'hir>, sp: Span, placeholder: &FormatPlaceholder, - argmap: &mut FxIndexMap<(usize, ArgumentType), Option>, + argmap: &mut GxIndexMap<(usize, ArgumentType), Option>, ) -> hir::Expr<'hir> { let position = match placeholder.argument.index { Ok(arg_index) => { @@ -432,7 +432,7 @@ fn expand_format_args<'hir>( // Create a list of all _unique_ (argument, format trait) combinations. // E.g. "{0} {0:x} {0} {1}" -> [(0, Display), (0, LowerHex), (1, Display)] - let mut argmap = FxIndexMap::default(); + let mut argmap = GxIndexMap::default(); for piece in &fmt.template { let FormatArgsPiece::Placeholder(placeholder) = piece else { continue }; if placeholder.format_options != Default::default() { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 0a06304fcecfa..ca0abcc565d04 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -46,7 +46,7 @@ use rustc_ast::{self as ast, *}; use rustc_ast_pretty::pprust; use rustc_data_structures::captures::Captures; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; @@ -1630,7 +1630,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { opaque_ty_node_id: NodeId, origin: hir::OpaqueTyOrigin, in_trait: bool, - captured_lifetimes_to_duplicate: FxIndexSet, + captured_lifetimes_to_duplicate: GxIndexSet, span: Span, opaque_ty_span: Span, lower_item_bounds: impl FnOnce(&mut Self) -> &'hir [hir::GenericBound<'hir>], diff --git a/compiler/rustc_ast_lowering/src/lifetime_collector.rs b/compiler/rustc_ast_lowering/src/lifetime_collector.rs index 5456abd489beb..958c8715f46c7 100644 --- a/compiler/rustc_ast_lowering/src/lifetime_collector.rs +++ b/compiler/rustc_ast_lowering/src/lifetime_collector.rs @@ -1,7 +1,7 @@ use super::ResolverAstLoweringExt; use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor}; use rustc_ast::{GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir::def::{DefKind, LifetimeRes, Res}; use rustc_middle::span_bug; use rustc_middle::ty::ResolverAstLowering; @@ -11,12 +11,12 @@ use rustc_span::Span; struct LifetimeCollectVisitor<'ast> { resolver: &'ast ResolverAstLowering, current_binders: Vec, - collected_lifetimes: FxIndexSet, + collected_lifetimes: GxIndexSet, } impl<'ast> LifetimeCollectVisitor<'ast> { fn new(resolver: &'ast ResolverAstLowering) -> Self { - Self { resolver, current_binders: Vec::new(), collected_lifetimes: FxIndexSet::default() } + Self { resolver, current_binders: Vec::new(), collected_lifetimes: GxIndexSet::default() } } fn record_lifetime_use(&mut self, lifetime: Lifetime) { @@ -108,7 +108,7 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> { pub(crate) fn lifetimes_in_bounds( resolver: &ResolverAstLowering, bounds: &GenericBounds, -) -> FxIndexSet { +) -> GxIndexSet { let mut visitor = LifetimeCollectVisitor::new(resolver); for bound in bounds { visitor.visit_param_bound(bound, BoundKind::Bound); diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index ba4b6130b60c8..7a3da2735113f 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -11,7 +11,7 @@ use rustc_ast::ptr::P; use rustc_ast::visit::{walk_list, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor}; use rustc_ast::*; use rustc_ast_pretty::pprust::{self, State}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::DiagCtxtHandle; use rustc_feature::Features; use rustc_parse::validate_attr; @@ -828,7 +828,7 @@ impl<'a> AstValidator<'a> { /// which is lifetimes, then types and then consts. (`<'a, T, const N: usize>`) fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericParam], span: Span) { let mut max_param: Option = None; - let mut out_of_order = FxIndexMap::default(); + let mut out_of_order = GxIndexMap::default(); let mut param_idents = Vec::with_capacity(generics.len()); for (idx, param) in generics.iter().enumerate() { diff --git a/compiler/rustc_borrowck/src/borrow_set.rs b/compiler/rustc_borrowck/src/borrow_set.rs index 0bae1bd07a298..7cca6341abc59 100644 --- a/compiler/rustc_borrowck/src/borrow_set.rs +++ b/compiler/rustc_borrowck/src/borrow_set.rs @@ -1,7 +1,7 @@ use crate::path_utils::allow_two_phase_borrow; use crate::place_ext::PlaceExt; use crate::BorrowIndex; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_index::bit_set::BitSet; use rustc_middle::mir::traversal; use rustc_middle::mir::visit::{MutatingUseContext, NonUseContext, PlaceContext, Visitor}; @@ -18,16 +18,16 @@ pub struct BorrowSet<'tcx> { /// by the `Location` of the assignment statement in which it /// appears on the right hand side. Thus the location is the map /// key, and its position in the map corresponds to `BorrowIndex`. - pub location_map: FxIndexMap>, + pub location_map: GxIndexMap>, /// Locations which activate borrows. /// NOTE: a given location may activate more than one borrow in the future /// when more general two-phase borrow support is introduced, but for now we /// only need to store one borrow index. - pub activation_map: FxIndexMap>, + pub activation_map: GxIndexMap>, /// Map from local to all the borrows on that local. - pub local_map: FxIndexMap>, + pub local_map: GxIndexMap>, pub locals_state_at_exit: LocalsStateAtExit, } @@ -174,9 +174,9 @@ impl<'tcx> BorrowSet<'tcx> { struct GatherBorrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, - location_map: FxIndexMap>, - activation_map: FxIndexMap>, - local_map: FxIndexMap>, + location_map: GxIndexMap>, + activation_map: GxIndexMap>, + local_map: GxIndexMap>, /// When we encounter a 2-phase borrow statement, it will always /// be assigning into a temporary TEMP: @@ -186,7 +186,7 @@ struct GatherBorrows<'a, 'tcx> { /// We add TEMP into this map with `b`, where `b` is the index of /// the borrow. When we find a later use of this activation, we /// remove from the map (and add to the "tombstone" set below). - pending_activations: FxIndexMap, + pending_activations: GxIndexMap, locals_state_at_exit: LocalsStateAtExit, } diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index f2b5ddcd7827c..93b11a3147c06 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -1,5 +1,5 @@ -use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::graph; +use rustc_data_structures::gx::GxIndexMap; use rustc_index::bit_set::BitSet; use rustc_middle::mir::{ self, BasicBlock, Body, CallReturnPlaces, Location, Place, TerminatorEdges, @@ -111,7 +111,7 @@ pub struct Borrows<'mir, 'tcx> { body: &'mir Body<'tcx>, borrow_set: &'mir BorrowSet<'tcx>, - borrows_out_of_scope_at_location: FxIndexMap>, + borrows_out_of_scope_at_location: GxIndexMap>, } struct OutOfScopePrecomputer<'mir, 'tcx> { @@ -119,7 +119,7 @@ struct OutOfScopePrecomputer<'mir, 'tcx> { visit_stack: Vec, body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>, - borrows_out_of_scope_at_location: FxIndexMap>, + borrows_out_of_scope_at_location: GxIndexMap>, } impl<'mir, 'tcx> OutOfScopePrecomputer<'mir, 'tcx> { @@ -129,7 +129,7 @@ impl<'mir, 'tcx> OutOfScopePrecomputer<'mir, 'tcx> { visit_stack: vec![], body, regioncx, - borrows_out_of_scope_at_location: FxIndexMap::default(), + borrows_out_of_scope_at_location: GxIndexMap::default(), } } } @@ -214,7 +214,7 @@ pub fn calculate_borrows_out_of_scope_at_location<'tcx>( body: &Body<'tcx>, regioncx: &RegionInferenceContext<'tcx>, borrow_set: &BorrowSet<'tcx>, -) -> FxIndexMap> { +) -> GxIndexMap> { let mut prec = OutOfScopePrecomputer::new(body, regioncx); for (borrow_index, borrow_data) in borrow_set.iter_enumerated() { let borrow_region = borrow_data.region; @@ -232,7 +232,7 @@ struct PoloniusOutOfScopePrecomputer<'mir, 'tcx> { body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>, - loans_out_of_scope_at_location: FxIndexMap>, + loans_out_of_scope_at_location: GxIndexMap>, } impl<'mir, 'tcx> PoloniusOutOfScopePrecomputer<'mir, 'tcx> { @@ -242,7 +242,7 @@ impl<'mir, 'tcx> PoloniusOutOfScopePrecomputer<'mir, 'tcx> { visit_stack: vec![], body, regioncx, - loans_out_of_scope_at_location: FxIndexMap::default(), + loans_out_of_scope_at_location: GxIndexMap::default(), } } } diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 1cc7fee718e87..4a5432b4a0929 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -6,7 +6,7 @@ use either::Either; use hir::ClosureKind; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{codes::*, struct_span_code_err, Applicability, Diag, MultiSpan}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -186,7 +186,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { let mut is_loop_move = false; let mut in_pattern = false; - let mut seen_spans = FxIndexSet::default(); + let mut seen_spans = GxIndexSet::default(); for move_site in &move_site_vec { let move_out = self.move_data.moves[(*move_site).moi]; @@ -1831,7 +1831,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { } } - let mut types_to_constrain = FxIndexSet::default(); + let mut types_to_constrain = GxIndexSet::default(); let local_ty = self.body.local_decls[place.local].ty; let typeck_results = tcx.typeck(self.mir_def_id()); @@ -3485,8 +3485,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { } } - let mut visited = FxIndexSet::default(); - let mut move_locations = FxIndexSet::default(); + let mut visited = GxIndexSet::default(); + let mut move_locations = GxIndexSet::default(); let mut reinits = vec![]; let mut result = vec![]; @@ -3613,7 +3613,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { let reinits_reachable = reinits .into_iter() .filter(|reinit| { - let mut visited = FxIndexSet::default(); + let mut visited = GxIndexSet::default(); let mut stack = vec![*reinit]; while let Some(location) = stack.pop() { if !visited.insert(location) { diff --git a/compiler/rustc_borrowck/src/diagnostics/find_use.rs b/compiler/rustc_borrowck/src/diagnostics/find_use.rs index 94b17e0a2f99c..3782c73a3ae02 100644 --- a/compiler/rustc_borrowck/src/diagnostics/find_use.rs +++ b/compiler/rustc_borrowck/src/diagnostics/find_use.rs @@ -5,7 +5,7 @@ use crate::{ def_use::{self, DefUse}, region_infer::{Cause, RegionInferenceContext}, }; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_middle::mir::visit::{MirVisitable, PlaceContext, Visitor}; use rustc_middle::mir::{self, Body, Local, Location}; use rustc_middle::ty::{RegionVid, TyCtxt}; @@ -33,7 +33,7 @@ struct UseFinder<'cx, 'tcx> { impl<'cx, 'tcx> UseFinder<'cx, 'tcx> { fn find(&mut self) -> Option { let mut queue = VecDeque::new(); - let mut visited = FxIndexSet::default(); + let mut visited = GxIndexSet::default(); queue.push_back(self.start_point); while let Some(p) = queue.pop_front() { diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index 082111a642c22..f1a6d34e3e35b 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -4,7 +4,7 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::Diag; use rustc_middle::ty::RegionVid; use smallvec::SmallVec; @@ -90,7 +90,7 @@ impl OutlivesSuggestionBuilder { // Keep track of variables that we have already suggested unifying so that we don't print // out silly duplicate messages. - let mut unified_already = FxIndexSet::default(); + let mut unified_already = GxIndexSet::default(); for (fr, outlived) in &self.constraints_to_add { let Some(fr_name) = self.region_vid_to_name(mbcx, *fr) else { diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index db78edc45b9de..8f4fafdc05375 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -1,6 +1,6 @@ //! Error reporting machinery for lifetime errors. -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan}; use rustc_hir as hir; use rustc_hir::def::Res::Def; @@ -968,7 +968,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { }; debug!(?param); - let mut visitor = TraitObjectVisitor(FxIndexSet::default()); + let mut visitor = TraitObjectVisitor(GxIndexSet::default()); visitor.visit_ty(param.param_ty); let Some((ident, self_ty)) = NiceRegionError::get_impl_ident_and_self_ty_from_trait( @@ -988,7 +988,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { fn suggest_constrain_dyn_trait_in_impl( &self, err: &mut Diag<'_>, - found_dids: &FxIndexSet, + found_dids: &GxIndexSet, ident: Ident, self_ty: &hir::Ty<'_>, ) -> bool { diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index 356416d1a7563..2d67c5f1b41e0 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -4,7 +4,7 @@ use std::fmt::{self, Display}; use std::iter; -use rustc_data_structures::fx::IndexEntry; +use rustc_data_structures::gx::IndexEntry; use rustc_errors::Diag; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 69efee2fbdc14..8b62691316e52 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -18,8 +18,8 @@ #[macro_use] extern crate tracing; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::graph::dominators::Dominators; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_errors::Diag; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; @@ -116,7 +116,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> { debug!("Skipping borrowck because of injected body or tainted body"); // Let's make up a borrowck result! Fun times! let result = BorrowCheckResult { - concrete_opaque_types: FxIndexMap::default(), + concrete_opaque_types: GxIndexMap::default(), closure_requirements: None, used_mut_upvars: SmallVec::new(), tainted_by_errors: input_body.tainted_by_errors, @@ -371,7 +371,7 @@ fn do_mir_borrowck<'tcx>( // Note that this set is expected to be small - only upvars from closures // would have a chance of erroneously adding non-user-defined mutable vars // to the set. - let temporary_used_locals: FxIndexSet = mbcx + let temporary_used_locals: GxIndexSet = mbcx .used_mut .iter() .filter(|&local| !mbcx.body.local_decls[*local].is_user_variable()) @@ -445,7 +445,7 @@ fn do_mir_borrowck<'tcx>( pub struct BorrowckInferCtxt<'tcx> { pub(crate) infcx: InferCtxt<'tcx>, - pub(crate) reg_var_to_origin: RefCell>, + pub(crate) reg_var_to_origin: RefCell>, } impl<'tcx> BorrowckInferCtxt<'tcx> { @@ -551,7 +551,7 @@ struct MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx> { /// borrow errors that is handled by the `reservation_error_reported` field as the inclusion /// of the `Span` type (while required to mute some errors) stops the muting of the reservation /// errors. - access_place_error_reported: FxIndexSet<(Place<'tcx>, Span)>, + access_place_error_reported: GxIndexSet<(Place<'tcx>, Span)>, /// This field keeps track of when borrow conflict errors are reported /// for reservations, so that we don't report seemingly duplicate /// errors for corresponding activations. @@ -559,17 +559,17 @@ struct MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx> { // FIXME: ideally this would be a set of `BorrowIndex`, not `Place`s, // but it is currently inconvenient to track down the `BorrowIndex` // at the time we detect and report a reservation error. - reservation_error_reported: FxIndexSet>, + reservation_error_reported: GxIndexSet>, /// This fields keeps track of the `Span`s that we have /// used to report extra information for `FnSelfUse`, to avoid /// unnecessarily verbose errors. - fn_self_span_reported: FxIndexSet, + fn_self_span_reported: GxIndexSet, /// This field keeps track of errors reported in the checking of uninitialized variables, /// so that we don't report seemingly duplicate errors. - uninitialized_error_reported: FxIndexSet, + uninitialized_error_reported: GxIndexSet, /// This field keeps track of all the local variables that are declared mut and are mutated. /// Used for the warning issued by an unused mutable local variable. - used_mut: FxIndexSet, + used_mut: GxIndexSet, /// If the function we're checking is a closure, then we'll need to report back the list of /// mutable upvars that have been used. This field keeps track of them. used_mut_upvars: SmallVec<[FieldIdx; 8]>, @@ -588,7 +588,7 @@ struct MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx> { /// Record the region names generated for each region in the given /// MIR def so that we can reuse them later in help/error messages. - region_names: RefCell>, + region_names: RefCell>, /// The counter for generating new region names. next_region_name: RefCell, @@ -2459,7 +2459,7 @@ mod diags { /// same primary span come out in a consistent order. buffered_move_errors: BTreeMap, (PlaceRef<'tcx>, Diag<'tcx>)>, - buffered_mut_errors: FxIndexMap, usize)>, + buffered_mut_errors: GxIndexMap, usize)>, /// Buffer of diagnostics to be reported. A mixture of error and non-error diagnostics. buffered_diags: Vec>, diff --git a/compiler/rustc_borrowck/src/member_constraints.rs b/compiler/rustc_borrowck/src/member_constraints.rs index 5129b32d492dd..0dc044ff07d6b 100644 --- a/compiler/rustc_borrowck/src/member_constraints.rs +++ b/compiler/rustc_borrowck/src/member_constraints.rs @@ -1,5 +1,5 @@ use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::infer::MemberConstraint; use rustc_middle::ty::{self, Ty}; @@ -16,7 +16,7 @@ where { /// Stores the first "member" constraint for a given `R0`. This is an /// index into the `constraints` vector below. - first_constraints: FxIndexMap, + first_constraints: GxIndexMap, /// Stores the data about each `R0 member of [R1..Rn]` constraint. /// These are organized into a linked list, so each constraint @@ -130,7 +130,7 @@ where let MemberConstraintSet { first_constraints, mut constraints, choice_regions } = self; - let mut first_constraints2 = FxIndexMap::default(); + let mut first_constraints2 = GxIndexMap::default(); first_constraints2.reserve(first_constraints.len()); for (r1, start1) in first_constraints { diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index 923cf7e940573..343aa6cdbbbce 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -1,7 +1,7 @@ //! The entry point of the NLL borrow checker. use polonius_engine::{Algorithm, Output}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir::def_id::LocalDefId; use rustc_index::IndexSlice; use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere}; @@ -39,7 +39,7 @@ pub type PoloniusOutput = Output; /// closure requirements to propagate, and any generated errors. pub(crate) struct NllOutput<'tcx> { pub regioncx: RegionInferenceContext<'tcx>, - pub opaque_type_values: FxIndexMap>, + pub opaque_type_values: GxIndexMap>, pub polonius_input: Option>, pub polonius_output: Option>, pub opt_closure_req: Option>, @@ -267,7 +267,7 @@ pub(super) fn dump_annotation<'tcx>( body: &Body<'tcx>, regioncx: &RegionInferenceContext<'tcx>, closure_region_requirements: &Option>, - opaque_type_values: &FxIndexMap>, + opaque_type_values: &GxIndexMap>, diags: &mut crate::diags::BorrowckDiags<'tcx>, ) { let tcx = infcx.tcx; diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index c56eaaff076ce..4ba651ca16c04 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -3,8 +3,8 @@ use std::rc::Rc; use rustc_data_structures::binary_search_util; use rustc_data_structures::frozen::Frozen; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::graph::scc::{self, Sccs}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_errors::Diag; use rustc_hir::def_id::CRATE_DEF_ID; use rustc_index::IndexVec; @@ -180,7 +180,7 @@ pub struct RegionInferenceContext<'tcx> { member_constraints_applied: Vec, /// Map universe indexes to information on why we created it. - universe_causes: FxIndexMap>, + universe_causes: GxIndexMap>, /// The final inferred values of the region variables; we compute /// one value per SCC. To get the value for any given *region*, @@ -340,7 +340,7 @@ fn sccs_info<'tcx>(infcx: &BorrowckInferCtxt<'tcx>, sccs: &ConstraintSccs) { debug!("{}", reg_vars_to_origins_str); let num_components = sccs.num_sccs(); - let mut components = vec![FxIndexSet::default(); num_components]; + let mut components = vec![GxIndexSet::default(); num_components]; for (reg_var_idx, scc_idx) in sccs.scc_indices().iter().enumerate() { let reg_var = ty::RegionVid::from_usize(reg_var_idx); @@ -372,9 +372,9 @@ fn sccs_info<'tcx>(infcx: &BorrowckInferCtxt<'tcx>, sccs: &ConstraintSccs) { (ConstraintSccIndex::from_usize(scc_idx), repr) }) - .collect::>(); + .collect::>(); - let mut scc_node_to_edges = FxIndexMap::default(); + let mut scc_node_to_edges = GxIndexMap::default(); for (scc_idx, repr) in components_representatives.iter() { let edge_representatives = sccs .successors(*scc_idx) @@ -403,7 +403,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { universal_region_relations: Frozen>, outlives_constraints: OutlivesConstraintSet<'tcx>, member_constraints_in: MemberConstraintSet<'tcx, RegionVid>, - universe_causes: FxIndexMap>, + universe_causes: GxIndexMap>, type_tests: Vec>, liveness_constraints: LivenessValues, elements: &Rc, @@ -932,7 +932,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Sometimes we register equivalent type-tests that would // result in basically the exact same error being reported to // the user. Avoid that. - let mut deduplicate_errors = FxIndexSet::default(); + let mut deduplicate_errors = GxIndexSet::default(); for type_test in &self.type_tests { debug!("check_type_test: {:?}", type_test); diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 67e5c8352df0f..fb191a2d88544 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; @@ -68,11 +68,11 @@ impl<'tcx> RegionInferenceContext<'tcx> { pub(crate) fn infer_opaque_types( &self, infcx: &InferCtxt<'tcx>, - opaque_ty_decls: FxIndexMap, OpaqueHiddenType<'tcx>>, - ) -> FxIndexMap> { - let mut result: FxIndexMap> = FxIndexMap::default(); - let mut decls_modulo_regions: FxIndexMap, (OpaqueTypeKey<'tcx>, Span)> = - FxIndexMap::default(); + opaque_ty_decls: GxIndexMap, OpaqueHiddenType<'tcx>>, + ) -> GxIndexMap> { + let mut result: GxIndexMap> = GxIndexMap::default(); + let mut decls_modulo_regions: GxIndexMap, (OpaqueTypeKey<'tcx>, Span)> = + GxIndexMap::default(); for (opaque_type_key, concrete_type) in opaque_ty_decls { debug!(?opaque_type_key, ?concrete_type); @@ -393,7 +393,7 @@ fn check_opaque_type_parameter_valid<'tcx>( ) -> Result<(), ErrorGuaranteed> { let opaque_generics = tcx.generics_of(opaque_type_key.def_id); let opaque_env = LazyOpaqueTyEnv::new(tcx, opaque_type_key.def_id); - let mut seen_params: FxIndexMap<_, Vec<_>> = FxIndexMap::default(); + let mut seen_params: GxIndexMap<_, Vec<_>> = GxIndexMap::default(); for (i, arg) in opaque_type_key.iter_captured_args(tcx) { let arg_is_param = match arg.unpack() { diff --git a/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs b/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs index 97ddc45ee476d..4b62393293663 100644 --- a/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs +++ b/compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs @@ -1,8 +1,8 @@ use crate::constraints::ConstraintSccIndex; use crate::RegionInferenceContext; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::graph; use rustc_data_structures::graph::vec_graph::VecGraph; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_middle::ty::RegionVid; use std::ops::Range; @@ -10,7 +10,7 @@ pub(crate) struct ReverseSccGraph { graph: VecGraph, /// For each SCC, the range of `universal_regions` that use that SCC as /// their value. - scc_regions: FxIndexMap>, + scc_regions: GxIndexMap>, /// All of the universal regions, in grouped so that `scc_regions` can /// index into here. universal_regions: Vec, @@ -22,7 +22,7 @@ impl ReverseSccGraph { &'a self, scc0: ConstraintSccIndex, ) -> impl Iterator + 'a { - let mut duplicates = FxIndexSet::default(); + let mut duplicates = GxIndexSet::default(); graph::depth_first_search(&self.graph, scc0) .flat_map(move |scc1| { self.scc_regions @@ -50,7 +50,7 @@ impl RegionInferenceContext<'_> { paired_scc_regions.sort(); let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect(); - let mut scc_regions = FxIndexMap::default(); + let mut scc_regions = GxIndexMap::default(); let mut start = 0; for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) { let (scc, _) = chunk[0]; diff --git a/compiler/rustc_borrowck/src/region_infer/values.rs b/compiler/rustc_borrowck/src/region_infer/values.rs index b1caaa6388186..6a69045637cf2 100644 --- a/compiler/rustc_borrowck/src/region_infer/values.rs +++ b/compiler/rustc_borrowck/src/region_infer/values.rs @@ -1,5 +1,5 @@ -use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxHashSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_index::bit_set::SparseBitMatrix; use rustc_index::interval::IntervalSet; use rustc_index::interval::SparseIntervalMatrix; @@ -42,7 +42,7 @@ pub(crate) struct LivenessValues { /// Which regions are live. This is exclusive with the fine-grained tracking in `points`, and /// currently only used for validating promoteds (which don't care about more precise tracking). - live_regions: Option>, + live_regions: Option>, /// For each region: the points where it is live. /// @@ -218,7 +218,7 @@ impl LivenessValues { /// NLL. #[derive(Debug, Default)] pub(crate) struct PlaceholderIndices { - indices: FxIndexSet, + indices: GxIndexSet, } impl PlaceholderIndices { diff --git a/compiler/rustc_borrowck/src/type_check/input_output.rs b/compiler/rustc_borrowck/src/type_check/input_output.rs index 741ec05dc9a16..096489d2fb35d 100644 --- a/compiler/rustc_borrowck/src/type_check/input_output.rs +++ b/compiler/rustc_borrowck/src/type_check/input_output.rs @@ -23,7 +23,7 @@ use super::{Locations, TypeChecker}; impl<'a, 'tcx> TypeChecker<'a, 'tcx> { /// Check explicit closure signature annotation, - /// e.g., `|x: FxIndexMap<_, &'static u32>| ...`. + /// e.g., `|x: GxIndexMap<_, &'static u32>| ...`. #[instrument(skip(self, body), level = "debug")] pub(super) fn check_signature_annotation(&mut self, body: &Body<'tcx>) { let mir_def_id = body.source.def_id().expect_local(); diff --git a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs index b777e01f7a6c2..fb52af37e10e2 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/mod.rs @@ -1,5 +1,5 @@ use itertools::{Either, Itertools}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::mir::visit::{TyContext, Visitor}; use rustc_middle::mir::{Body, Local, Location, SourceInfo}; use rustc_middle::span_bug; @@ -75,7 +75,7 @@ pub(super) fn generate<'mir, 'tcx>( // region (i.e., where `R` may be valid for just a subset of the fn body). fn compute_relevant_live_locals<'tcx>( tcx: TyCtxt<'tcx>, - free_regions: &FxHashSet, + free_regions: &GxHashSet, body: &Body<'tcx>, ) -> (Vec, Vec) { let (boring_locals, relevant_live_locals): (Vec<_>, Vec<_>) = @@ -102,7 +102,7 @@ fn regions_that_outlive_free_regions<'tcx>( num_region_vars: usize, universal_regions: &UniversalRegions<'tcx>, constraint_set: &OutlivesConstraintSet<'tcx>, -) -> FxHashSet { +) -> GxHashSet { // Build a graph of the outlives constraints thus far. This is // a reverse graph, so for each constraint `R1: R2` we have an // edge `R2 -> R1`. Therefore, if we find all regions @@ -117,7 +117,7 @@ fn regions_that_outlive_free_regions<'tcx>( // Set of all free regions, plus anything that outlives them. Initially // just contains the free regions. - let mut outlives_free_region: FxHashSet<_> = stack.iter().cloned().collect(); + let mut outlives_free_region: GxHashSet<_> = stack.iter().cloned().collect(); // Do the DFS -- for each thing in the stack, find all things // that outlive it and add them to the set. If they are not, diff --git a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs index 359c4ea0eb1e2..aa564df3c20a9 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_index::bit_set::BitSet; use rustc_index::interval::IntervalSet; use rustc_infer::infer::canonical::QueryRegionConstraints; @@ -88,7 +88,7 @@ pub(super) fn trace<'mir, 'tcx>( elements, local_use_map, move_data, - drop_data: FxIndexMap::default(), + drop_data: GxIndexMap::default(), }; let mut results = LivenessResults::new(cx); @@ -115,7 +115,7 @@ struct LivenessContext<'me, 'typeck, 'flow, 'tcx> { move_data: &'me MoveData<'tcx>, /// Cache for the results of `dropck_outlives` query. - drop_data: FxIndexMap, DropData<'tcx>>, + drop_data: GxIndexMap, DropData<'tcx>>, /// Results of dataflow tracking which variables (and paths) have been /// initialized. @@ -229,7 +229,7 @@ impl<'me, 'typeck, 'flow, 'tcx> LivenessResults<'me, 'typeck, 'flow, 'tcx> { let facts_to_add: Vec<_> = { let drop_used = &self.cx.typeck.borrowck_context.all_facts.as_ref()?.var_dropped_at; - let relevant_live_locals: FxIndexSet<_> = + let relevant_live_locals: GxIndexSet<_> = relevant_live_locals.iter().copied().collect(); drop_used diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 81bde14a82f4e..4129bc1cfd219 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -6,7 +6,7 @@ use std::{fmt, iter, mem}; use either::Either; use rustc_data_structures::frozen::Frozen; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_errors::ErrorGuaranteed; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -142,7 +142,7 @@ pub(crate) fn type_check<'mir, 'tcx>( outlives_constraints: OutlivesConstraintSet::default(), member_constraints: MemberConstraintSet::default(), type_tests: Vec::default(), - universe_causes: FxIndexMap::default(), + universe_causes: GxIndexMap::default(), }; let CreateResult { @@ -866,7 +866,7 @@ struct TypeChecker<'a, 'tcx> { region_bound_pairs: &'a RegionBoundPairs<'tcx>, known_type_outlives_obligations: &'tcx [ty::PolyTypeOutlivesPredicate<'tcx>], implicit_region_bound: ty::Region<'tcx>, - reported_errors: FxIndexSet<(Ty<'tcx>, Span)>, + reported_errors: GxIndexSet<(Ty<'tcx>, Span)>, borrowck_context: &'a mut BorrowCheckContext<'a, 'tcx>, } @@ -884,7 +884,7 @@ struct BorrowCheckContext<'a, 'tcx> { pub(crate) struct MirTypeckResults<'tcx> { pub(crate) constraints: MirTypeckRegionConstraints<'tcx>, pub(crate) universal_region_relations: Frozen>, - pub(crate) opaque_type_values: FxIndexMap, OpaqueHiddenType<'tcx>>, + pub(crate) opaque_type_values: GxIndexMap, OpaqueHiddenType<'tcx>>, } /// A collection of region constraints that must be satisfied for the @@ -917,7 +917,7 @@ pub(crate) struct MirTypeckRegionConstraints<'tcx> { pub(crate) member_constraints: MemberConstraintSet<'tcx, RegionVid>, - pub(crate) universe_causes: FxIndexMap>, + pub(crate) universe_causes: GxIndexMap>, pub(crate) type_tests: Vec>, } diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index b9a82046e59ad..cece026cf0857 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::ErrorGuaranteed; use rustc_infer::infer::relate::{PredicateEmittingRelation, StructurallyRelateAliases}; use rustc_infer::infer::relate::{Relate, RelateResult, TypeRelation}; @@ -208,7 +208,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelating<'me, 'bccx, 'tcx> { } let infcx = self.type_checker.infcx; - let mut reg_map = FxHashMap::default(); + let mut reg_map = GxHashMap::default(); let delegate = FnMutDelegate { regions: &mut |br: ty::BoundRegion| { if let Some(ex_reg_var) = reg_map.get(&br) { diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index 9f5fb59e46c55..ff3f8a196d71c 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -15,7 +15,7 @@ #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::Diag; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::lang_items::LangItem; @@ -183,7 +183,7 @@ struct UniversalRegionIndices<'tcx> { /// basically equivalent to an `GenericArgs`, except that it also /// contains an entry for `ReStatic` -- it might be nice to just /// use an args, and then handle `ReStatic` another way. - indices: FxIndexMap, RegionVid>, + indices: GxIndexMap, RegionVid>, /// The vid assigned to `'static`. Used only for diagnostics. pub fr_static: RegionVid, diff --git a/compiler/rustc_borrowck/src/used_muts.rs b/compiler/rustc_borrowck/src/used_muts.rs index 25e1f6268e062..07a1f668ee00c 100644 --- a/compiler/rustc_borrowck/src/used_muts.rs +++ b/compiler/rustc_borrowck/src/used_muts.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::{ Local, Location, Place, Statement, StatementKind, Terminator, TerminatorKind, @@ -24,8 +24,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { /// See #55344 for context. pub(crate) fn gather_used_muts( &mut self, - temporary_used_locals: FxIndexSet, - mut never_initialized_mut_locals: FxIndexSet, + temporary_used_locals: GxIndexSet, + mut never_initialized_mut_locals: GxIndexSet, ) { { let mut visitor = GatherUsedMutsVisitor { @@ -46,8 +46,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> { /// MIR visitor for collecting used mutable variables. /// The 'visit lifetime represents the duration of the MIR walk. struct GatherUsedMutsVisitor<'visit, 'a, 'mir, 'cx, 'tcx> { - temporary_used_locals: FxIndexSet, - never_initialized_mut_locals: &'visit mut FxIndexSet, + temporary_used_locals: GxIndexSet, + never_initialized_mut_locals: &'visit mut GxIndexSet, mbcx: &'visit mut MirBorrowckCtxt<'a, 'mir, 'cx, 'tcx>, } diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 64238e81b2666..20f73ef566d22 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -6,7 +6,7 @@ use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, Delimiter}; use rustc_ast::tokenstream::TokenStream; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_errors::PResult; use rustc_expand::base::*; use rustc_index::bit_set::GrowableBitSet; @@ -22,7 +22,7 @@ use smallvec::smallvec; pub struct AsmArgs { pub templates: Vec>, pub operands: Vec<(ast::InlineAsmOperand, Span)>, - named_args: FxIndexMap, + named_args: GxIndexMap, reg_args: GrowableBitSet, pub clobber_abis: Vec<(Symbol, Span)>, options: ast::InlineAsmOptions, @@ -452,7 +452,7 @@ fn expand_preparsed_asm( for pos in args.reg_args.iter() { used[pos] = true; } - let named_pos: FxHashMap = + let named_pos: GxHashMap = args.named_args.iter().map(|(&sym, &idx)| (idx, sym)).collect(); let mut line_spans = Vec::with_capacity(args.templates.len()); let mut curarg = 0; diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs index a98cb6f0f760c..e7ec81fc917d5 100644 --- a/compiler/rustc_builtin_macros/src/assert/context.rs +++ b/compiler/rustc_builtin_macros/src/assert/context.rs @@ -6,7 +6,7 @@ use rustc_ast::{ Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind, DUMMY_NODE_ID, }; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_expand::base::ExtCtxt; use rustc_span::{ symbol::{sym, Ident, Symbol}, @@ -36,7 +36,7 @@ pub(super) struct Context<'cx, 'a> { // let a = 1i32; // assert!(add(a, a) == 3); // ``` - paths: FxHashSet, + paths: GxHashSet, span: Span, } diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index abcb402a46f8e..fcd270f563df2 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -2,7 +2,7 @@ use crate::deriving::generic::ty::*; use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_ast::{self as ast, Generics, ItemKind, MetaItem, VariantData}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::{kw, sym, Ident}; use rustc_span::Span; @@ -100,7 +100,7 @@ fn cs_clone_simple( is_union: bool, ) -> BlockOrExpr { let mut stmts = ThinVec::new(); - let mut seen_type_names = FxHashSet::default(); + let mut seen_type_names = GxHashSet::default(); let mut process_variant = |variant: &VariantData| { for field in variant.fields() { // This basic redundancy checking only prevents duplication of diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs index 53a1513160542..83e26bd1345ae 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs @@ -3,7 +3,7 @@ use crate::deriving::generic::*; use crate::deriving::path_std; use rustc_ast::{self as ast, MetaItem}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_span::symbol::sym; use rustc_span::Span; @@ -54,7 +54,7 @@ fn cs_total_eq_assert( substr: &Substructure<'_>, ) -> BlockOrExpr { let mut stmts = ThinVec::new(); - let mut seen_type_names = FxHashSet::default(); + let mut seen_type_names = GxHashSet::default(); let mut process_variant = |variant: &ast::VariantData| { for field in variant.fields() { // This basic redundancy checking only prevents duplication of diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 5cb0407bd59e6..66b78e1a3209b 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -9,7 +9,7 @@ use rustc_ast::{ FormatArgsPiece, FormatArgument, FormatArgumentKind, FormatArguments, FormatCount, FormatDebugHex, FormatOptions, FormatPlaceholder, FormatSign, FormatTrait, Recovered, }; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{Applicability, Diag, MultiSpan, PResult, SingleLabelManySpans}; use rustc_expand::base::*; use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY; @@ -658,7 +658,7 @@ fn report_missing_placeholders( // The set of foreign substitutions we've explained. This prevents spamming the user // with `%d should be written as {}` over and over again. - let mut explained = FxHashSet::default(); + let mut explained = GxHashSet::default(); macro_rules! check_foreign { ($kind:ident) => {{ diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index 87c5da3b7c3ed..8ec36ff6d3da5 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use cranelift_module::*; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mir::interpret::{read_target_uint, AllocId, GlobalAlloc, Scalar}; use rustc_middle::ty::{Binder, ExistentialTraitRef, ScalarInt}; @@ -12,7 +12,7 @@ use crate::prelude::*; pub(crate) struct ConstantCx { todo: Vec, - anon_allocs: FxHashMap, + anon_allocs: GxHashMap, } #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] @@ -23,7 +23,7 @@ enum TodoItem { impl ConstantCx { pub(crate) fn new() -> Self { - ConstantCx { todo: vec![], anon_allocs: FxHashMap::default() } + ConstantCx { todo: vec![], anon_allocs: GxHashMap::default() } } pub(crate) fn finalize(mut self, tcx: TyCtxt<'_>, module: &mut dyn Module) { @@ -341,7 +341,7 @@ fn data_id_for_static( } fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut ConstantCx) { - let mut done = FxHashSet::default(); + let mut done = GxHashSet::default(); while let Some(todo_item) = cx.todo.pop() { if !done.insert(todo_item) { continue; diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs index 36af7d4450d04..2f09938835e68 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs @@ -4,7 +4,7 @@ use cranelift_module::{DataId, FuncId}; use cranelift_object::ObjectProduct; use gimli::write::{Address, AttributeValue, EndianVec, Result, Sections, Writer}; use gimli::{RunTimeEndian, SectionId}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use super::object::WriteDebugInfo; use super::DebugContext; @@ -31,7 +31,7 @@ impl DebugContext { let mut sections = Sections::new(WriterRelocate::new(self.endian)); self.dwarf.write(&mut sections).unwrap(); - let mut section_map = FxHashMap::default(); + let mut section_map = GxHashMap::default(); let _: Result<()> = sections.for_each_mut(|id, section| { if !section.writer.slice().is_empty() { let section_id = product.add_debug_section(id, section.writer.take()); diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs index f0b78e5d7c674..86369b391026e 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs @@ -37,7 +37,7 @@ pub(crate) struct DebugContext { dwarf: DwarfUnit, unit_range_list: RangeList, - created_files: FxHashMap<(StableSourceFileId, SourceFileHash), FileId>, + created_files: GxHashMap<(StableSourceFileId, SourceFileHash), FileId>, stack_pointer_register: Register, namespace_map: DefIdMap, array_size_type: UnitEntryId, @@ -148,7 +148,7 @@ impl DebugContext { endian, dwarf, unit_range_list: RangeList(Vec::new()), - created_files: FxHashMap::default(), + created_files: GxHashMap::default(), stack_pointer_register, namespace_map: DefIdMap::default(), array_size_type, diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs index 65f4c67b21f13..fc076b24a94b9 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs @@ -3,7 +3,7 @@ use cranelift_object::ObjectProduct; use gimli::SectionId; use object::write::{Relocation, StandardSegment}; use object::{RelocationEncoding, RelocationFlags, SectionKind}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use crate::debuginfo::{DebugReloc, DebugRelocName}; @@ -13,7 +13,7 @@ pub(super) trait WriteDebugInfo { fn add_debug_section(&mut self, name: SectionId, data: Vec) -> Self::SectionId; fn add_debug_reloc( &mut self, - section_map: &FxHashMap, + section_map: &GxHashMap, from: &Self::SectionId, reloc: &DebugReloc, ); @@ -50,7 +50,7 @@ impl WriteDebugInfo for ObjectProduct { fn add_debug_reloc( &mut self, - section_map: &FxHashMap, + section_map: &GxHashMap, from: &Self::SectionId, reloc: &DebugReloc, ) { diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs index 7baf0a3868d2c..a0115ad2ccb5e 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/types.rs @@ -2,7 +2,7 @@ use gimli::write::{AttributeValue, UnitEntryId}; use rustc_codegen_ssa::debuginfo::type_names; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -10,7 +10,7 @@ use crate::{has_ptr_meta, DebugContext, RevealAllLayoutCx}; #[derive(Default)] pub(crate) struct TypeDebugContext<'tcx> { - type_map: FxHashMap, UnitEntryId>, + type_map: GxHashMap, UnitEntryId>, } /// Returns from the enclosing function if the type debuginfo node with the given diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs index eebd181341d08..f596dd9603520 100644 --- a/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs +++ b/compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs @@ -73,7 +73,7 @@ impl UnwindContext { if !eh_frame.0.writer.slice().is_empty() { let id = eh_frame.id(); let section_id = product.add_debug_section(id, eh_frame.0.writer.into_vec()); - let mut section_map = FxHashMap::default(); + let mut section_map = GxHashMap::default(); section_map.insert(id, section_id); for reloc in &eh_frame.0.relocs { diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index dcafac21bc742..ab61158cef22c 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -60,8 +60,8 @@ impl OngoingCodegen { sess: &Session, outputs: &OutputFilenames, backend_config: &BackendConfig, - ) -> (CodegenResults, FxIndexMap) { - let mut work_products = FxIndexMap::default(); + ) -> (CodegenResults, GxIndexMap) { + let mut work_products = GxIndexMap::default(); let mut modules = vec![]; for module_codegen in self.modules { diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs index 4b149131b61aa..3af1a3d148e70 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs @@ -108,7 +108,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! { .iter() .map(|cgu| cgu.items_in_deterministic_order(tcx).into_iter()) .flatten() - .collect::>() + .collect::>() .into_iter() .collect::>(); diff --git a/compiler/rustc_codegen_cranelift/src/inline_asm.rs b/compiler/rustc_codegen_cranelift/src/inline_asm.rs index c6b26dd873bdc..3da020e370689 100644 --- a/compiler/rustc_codegen_cranelift/src/inline_asm.rs +++ b/compiler/rustc_codegen_cranelift/src/inline_asm.rs @@ -352,7 +352,7 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> { self.tcx.asm_target_features(self.enclosing_def_id), &sess.target, ); - let mut allocated = FxHashMap::<_, (bool, bool)>::default(); + let mut allocated = GxHashMap::<_, (bool, bool)>::default(); let mut regs = vec![None; self.operands.len()]; // Add explicit registers to the allocated set. diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index 06ca52b390320..01824ca516367 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -92,7 +92,7 @@ mod prelude { }; pub(crate) use cranelift_codegen::Context; pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module}; - pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; + pub(crate) use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE}; pub(crate) use rustc_index::Idx; pub(crate) use rustc_middle::mir::{self, *}; @@ -233,7 +233,7 @@ impl CodegenBackend for CraneliftCodegenBackend { ongoing_codegen: Box, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CodegenResults, GxIndexMap) { ongoing_codegen.downcast::().unwrap().join( sess, outputs, diff --git a/compiler/rustc_codegen_cranelift/src/pretty_clif.rs b/compiler/rustc_codegen_cranelift/src/pretty_clif.rs index 196418023d920..8fe9b64bb4024 100644 --- a/compiler/rustc_codegen_cranelift/src/pretty_clif.rs +++ b/compiler/rustc_codegen_cranelift/src/pretty_clif.rs @@ -72,7 +72,7 @@ use crate::prelude::*; pub(crate) struct CommentWriter { enabled: bool, global_comments: Vec, - entity_comments: FxHashMap, + entity_comments: GxHashMap, } impl CommentWriter { @@ -94,7 +94,7 @@ impl CommentWriter { vec![] }; - CommentWriter { enabled, global_comments, entity_comments: FxHashMap::default() } + CommentWriter { enabled, global_comments, entity_comments: GxHashMap::default() } } } diff --git a/compiler/rustc_codegen_gcc/src/abi.rs b/compiler/rustc_codegen_gcc/src/abi.rs index b098594dbcc35..f000596126333 100644 --- a/compiler/rustc_codegen_gcc/src/abi.rs +++ b/compiler/rustc_codegen_gcc/src/abi.rs @@ -2,7 +2,7 @@ use gccjit::FnAttribute; use gccjit::{ToLValue, ToRValue, Type}; use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeMethods}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::bug; use rustc_middle::ty::Ty; #[cfg(feature = "master")] @@ -98,7 +98,7 @@ pub struct FnAbiGcc<'gcc> { pub return_type: Type<'gcc>, pub arguments_type: Vec>, pub is_c_variadic: bool, - pub on_stack_param_indices: FxHashSet, + pub on_stack_param_indices: GxHashSet, #[cfg(feature = "master")] pub fn_attributes: Vec>, } @@ -111,7 +111,7 @@ pub trait FnAbiGccExt<'gcc, 'tcx> { impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { fn gcc_type(&self, cx: &CodegenCx<'gcc, 'tcx>) -> FnAbiGcc<'gcc> { - let mut on_stack_param_indices = FxHashSet::default(); + let mut on_stack_param_indices = GxHashSet::default(); // This capacity calculation is approximate. let mut argument_tys = Vec::with_capacity( diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 4a3b6f678c444..a70d9e95ad76a 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -18,7 +18,7 @@ use rustc_codegen_ssa::traits::{ OverflowOp, StaticBuilderMethods, }; use rustc_codegen_ssa::MemFlags; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::ty::layout::{ @@ -223,7 +223,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { param_types.push(param); } - let mut on_stack_param_indices = FxHashSet::default(); + let mut on_stack_param_indices = GxHashSet::default(); if let Some(indices) = self.on_stack_params.borrow().get(&gcc_func) { on_stack_param_indices = indices.clone(); } diff --git a/compiler/rustc_codegen_gcc/src/context.rs b/compiler/rustc_codegen_gcc/src/context.rs index 4a1f5188a8013..2b4af38b3adfa 100644 --- a/compiler/rustc_codegen_gcc/src/context.rs +++ b/compiler/rustc_codegen_gcc/src/context.rs @@ -8,7 +8,7 @@ use rustc_codegen_ssa::errors as ssa_errors; use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, MiscMethods}; use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::ALPHANUMERIC_ONLY; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_middle::mir::mono::CodegenUnit; use rustc_middle::span_bug; use rustc_middle::ty::layout::{ @@ -33,11 +33,11 @@ pub struct CodegenCx<'gcc, 'tcx> { // TODO(bjorn3): Can this field be removed? pub current_func: RefCell>>, - pub normal_function_addresses: RefCell>>, - pub function_address_names: RefCell, String>>, + pub normal_function_addresses: RefCell>>, + pub function_address_names: RefCell, String>>, - pub functions: RefCell>>, - pub intrinsics: RefCell>>, + pub functions: RefCell>>, + pub intrinsics: RefCell>>, pub tls_model: gccjit::TlsModel, @@ -74,38 +74,38 @@ pub struct CodegenCx<'gcc, 'tcx> { pub double_type: Type<'gcc>, pub linkage: Cell, - pub scalar_types: RefCell, Type<'gcc>>>, - pub types: RefCell, Option), Type<'gcc>>>, + pub scalar_types: RefCell, Type<'gcc>>>, + pub types: RefCell, Option), Type<'gcc>>>, pub tcx: TyCtxt<'tcx>, - pub struct_types: RefCell>, Type<'gcc>>>, + pub struct_types: RefCell>, Type<'gcc>>>, /// Cache instances of monomorphic and polymorphic items - pub instances: RefCell, LValue<'gcc>>>, + pub instances: RefCell, LValue<'gcc>>>, /// Cache function instances of monomorphic and polymorphic items - pub function_instances: RefCell, Function<'gcc>>>, + pub function_instances: RefCell, Function<'gcc>>>, /// Cache generated vtables pub vtables: - RefCell, Option>), RValue<'gcc>>>, + RefCell, Option>), RValue<'gcc>>>, // TODO(antoyo): improve the SSA API to not require those. /// Mapping from function pointer type to indexes of on stack parameters. - pub on_stack_params: RefCell, FxHashSet>>, + pub on_stack_params: RefCell, GxHashSet>>, /// Mapping from function to indexes of on stack parameters. - pub on_stack_function_params: RefCell, FxHashSet>>, + pub on_stack_function_params: RefCell, GxHashSet>>, /// Cache of emitted const globals (value -> global) - pub const_globals: RefCell, RValue<'gcc>>>, + pub const_globals: RefCell, RValue<'gcc>>>, /// Map from the address of a global variable (rvalue) to the global variable itself (lvalue). /// TODO(antoyo): remove when the rustc API is fixed. - pub global_lvalues: RefCell, LValue<'gcc>>>, + pub global_lvalues: RefCell, LValue<'gcc>>>, /// Cache of constant strings, - pub const_str_cache: RefCell>>, + pub const_str_cache: RefCell>>, /// Cache of globals. - pub globals: RefCell>>, + pub globals: RefCell>>, /// A counter that is used for generating local symbol names local_gen_sym_counter: Cell, @@ -114,17 +114,17 @@ pub struct CodegenCx<'gcc, 'tcx> { #[cfg(feature="master")] pub rust_try_fn: Cell, Function<'gcc>)>>, - pub pointee_infos: RefCell, Size), Option>>, + pub pointee_infos: RefCell, Size), Option>>, /// NOTE: a hack is used because the rustc API is not suitable to libgccjit and as such, /// `const_undef()` returns struct as pointer so that they can later be assigned a value. /// As such, this set remembers which of these pointers were returned by this function so that /// they can be dereferenced later. /// FIXME(antoyo): fix the rustc API to avoid having this hack. - pub structs_as_pointer: RefCell>>, + pub structs_as_pointer: RefCell>>, #[cfg(feature="master")] - pub cleanup_blocks: RefCell>>, + pub cleanup_blocks: RefCell>>, } impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { @@ -203,7 +203,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { let isize_type = usize_type; let bool_type = context.new_type::(); - let mut functions = FxHashMap::default(); + let mut functions = GxHashMap::default(); let builtins = [ "__builtin_unreachable", "abort", @@ -278,7 +278,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { normal_function_addresses: Default::default(), function_address_names: Default::default(), functions: RefCell::new(functions), - intrinsics: RefCell::new(FxHashMap::default()), + intrinsics: RefCell::new(GxHashMap::default()), tls_model, @@ -421,7 +421,7 @@ impl<'gcc, 'tcx> BackendTypes for CodegenCx<'gcc, 'tcx> { impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> { fn vtables( &self, - ) -> &RefCell, Option>), RValue<'gcc>>> { + ) -> &RefCell, Option>), RValue<'gcc>>> { &self.vtables } diff --git a/compiler/rustc_codegen_gcc/src/gcc_util.rs b/compiler/rustc_codegen_gcc/src/gcc_util.rs index 53877e8ff7fad..ea5be7a890ad9 100644 --- a/compiler/rustc_codegen_gcc/src/gcc_util.rs +++ b/compiler/rustc_codegen_gcc/src/gcc_util.rs @@ -2,7 +2,7 @@ use gccjit::Context; use smallvec::{smallvec, SmallVec}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::bug; use rustc_session::Session; use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES; @@ -46,7 +46,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> // ensure only valid combinations are allowed. pub fn check_tied_features( sess: &Session, - features: &FxHashMap<&str, bool>, + features: &GxHashMap<&str, bool>, ) -> Option<&'static [&'static str]> { for tied in sess.target.tied_target_features() { // Tied features must be set to the same value, or not set at all diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index 24856506c4644..c77b790008752 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -96,7 +96,7 @@ use rustc_codegen_ssa::traits::{ CodegenBackend, ExtraBackendMethods, ThinBufferMethods, WriteBackendMethods, }; use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::IntoDynSyncSend; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed}; use rustc_metadata::EncodedMetadata; @@ -240,7 +240,7 @@ impl CodegenBackend for GccCodegenBackend { ongoing_codegen: Box, sess: &Session, _outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CodegenResults, GxIndexMap) { ongoing_codegen .downcast::>() .expect("Expected GccCodegenBackend's OngoingCodegen, found Box") diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index 597ebd9736561..ea7b532e056b3 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -10,7 +10,7 @@ use crate::value::Value; use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::traits::*; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::{bug, span_bug, ty::Instance}; use rustc_span::{sym, Pos, Span, Symbol}; @@ -38,7 +38,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { let mut constraints = vec![]; let mut clobbers = vec![]; let mut output_types = vec![]; - let mut op_idx = FxHashMap::default(); + let mut op_idx = GxHashMap::default(); let mut clobbered_x87 = false; for (idx, op) in operands.iter().enumerate() { match *op { diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index aff3e3d707608..c645e82d8a83e 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -12,7 +12,7 @@ use rustc_codegen_ssa::back::symbol_export; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, TargetMachineFactoryConfig}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::memmap::Mmap; use rustc_errors::{DiagCtxtHandle, FatalError}; use rustc_hir::def_id::LOCAL_CRATE; @@ -448,7 +448,7 @@ fn thin_lto( unsafe { info!("going for that thin, thin LTO"); - let green_modules: FxHashMap<_, _> = + let green_modules: GxHashMap<_, _> = cached_modules.iter().map(|(_, wp)| (wp.cgu_name.clone(), wp.clone())).collect(); let full_scope_len = modules.len() + serialized_modules.len() + cached_modules.len(); diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 7d92888feeed4..dd029c1f71066 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -13,7 +13,7 @@ use rustc_codegen_ssa::errors as ssa_errors; use rustc_codegen_ssa::traits::*; use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::ALPHANUMERIC_ONLY; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::small_c_str::SmallCStr; use rustc_hir::def_id::DefId; use rustc_middle::mir::mono::CodegenUnit; @@ -52,15 +52,15 @@ pub struct CodegenCx<'ll, 'tcx> { pub codegen_unit: &'tcx CodegenUnit<'tcx>, /// Cache instances of monomorphic and polymorphic items - pub instances: RefCell, &'ll Value>>, + pub instances: RefCell, &'ll Value>>, /// Cache generated vtables pub vtables: - RefCell, Option>), &'ll Value>>, + RefCell, Option>), &'ll Value>>, /// Cache of constant strings, - pub const_str_cache: RefCell>, + pub const_str_cache: RefCell>, /// Cache of emitted const globals (value -> global) - pub const_globals: RefCell>, + pub const_globals: RefCell>, /// List of globals for static variables which need to be passed to the /// LLVM function ReplaceAllUsesWith (RAUW) when codegen is complete. @@ -77,10 +77,10 @@ pub struct CodegenCx<'ll, 'tcx> { pub compiler_used_statics: RefCell>, /// Mapping of non-scalar types to llvm types. - pub type_lowering: RefCell, Option), &'ll Type>>, + pub type_lowering: RefCell, Option), &'ll Type>>, /// Mapping of scalar types to llvm types. - pub scalar_lltypes: RefCell, &'ll Type>>, + pub scalar_lltypes: RefCell, &'ll Type>>, pub isize_ty: &'ll Type, @@ -91,7 +91,7 @@ pub struct CodegenCx<'ll, 'tcx> { eh_catch_typeinfo: Cell>, pub rust_try_fn: Cell>, - intrinsics: RefCell>, + intrinsics: RefCell>, /// A counter that is used for generating local symbol names local_gen_sym_counter: Cell, @@ -100,7 +100,7 @@ pub struct CodegenCx<'ll, 'tcx> { /// different type and clear the symbol name of the original global. /// `global_asm!` needs to be able to find this new global so that it can /// compute the correct mangled symbol name to insert into the asm. - pub renamed_statics: RefCell>, + pub renamed_statics: RefCell>, } fn to_llvm_tls_model(tls_model: TlsModel) -> llvm::ThreadLocalMode { @@ -517,7 +517,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn vtables( &self, - ) -> &RefCell, Option>), &'ll Value>> + ) -> &RefCell, Option>), &'ll Value>> { &self.vtables } diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs index b969fe27a99be..8458426f7e2af 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs @@ -1,7 +1,7 @@ use crate::coverageinfo::ffi::{Counter, CounterExpression, ExprKind}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_index::bit_set::BitSet; use rustc_middle::mir::coverage::{ CodeRegion, CounterId, CovTerm, Expression, ExpressionId, FunctionCoverageInfo, Mapping, @@ -245,7 +245,7 @@ impl<'tcx> FunctionCoverage<'tcx> { /// Any mapping or expression operand that refers to these expressions can have /// that reference replaced with a constant zero value. #[derive(Default)] -struct ZeroExpressions(FxIndexSet); +struct ZeroExpressions(GxIndexSet); impl ZeroExpressions { fn insert(&mut self, id: ExpressionId) { diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index d2c0f20c285b4..abe55723abc9d 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -6,7 +6,7 @@ use crate::llvm; use itertools::Itertools as _; use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods}; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_index::IndexVec; use rustc_middle::bug; @@ -154,14 +154,14 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) { struct GlobalFileTable { /// This "raw" table doesn't include the working dir, so a filename's /// global ID is its index in this set **plus one**. - raw_file_table: FxIndexSet, + raw_file_table: GxIndexSet, } impl GlobalFileTable { fn new(all_file_names: impl IntoIterator) -> Self { // Collect all of the filenames into a set. Filenames usually come in // contiguous runs, so we can dedup adjacent ones to save work. - let mut raw_file_table = all_file_names.into_iter().dedup().collect::>(); + let mut raw_file_table = all_file_names.into_iter().dedup().collect::>(); // Sort the file table by its actual string values, not the arbitrary // ordering of its symbols. @@ -213,7 +213,7 @@ rustc_index::newtype_index! { #[derive(Default)] struct VirtualFileMapping { local_to_global: IndexVec, - global_to_local: FxIndexMap, + global_to_local: GxIndexMap, } impl VirtualFileMapping { @@ -397,8 +397,8 @@ fn add_unused_functions(cx: &CodegenCx<'_, '_>) { struct UsageSets<'tcx> { all_mono_items: &'tcx DefIdSet, - used_via_inlining: FxHashSet, - missing_own_coverage: FxHashSet, + used_via_inlining: GxHashSet, + missing_own_coverage: GxHashSet, } /// Prepare sets of definitions that are relevant to deciding whether something @@ -408,7 +408,7 @@ fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> { // Obtain a MIR body for each function participating in codegen, via an // arbitrary instance. - let mut def_ids_seen = FxHashSet::default(); + let mut def_ids_seen = GxHashSet::default(); let def_and_mir_for_all_mono_fns = cgus .iter() .flat_map(|cgu| cgu.items().keys()) @@ -425,10 +425,10 @@ fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> { }); // Functions whose coverage statments were found inlined into other functions. - let mut used_via_inlining = FxHashSet::default(); + let mut used_via_inlining = GxHashSet::default(); // Functions that were instrumented, but had all of their coverage statements // removed by later MIR transforms (e.g. UnreachablePropagation). - let mut missing_own_coverage = FxHashSet::default(); + let mut missing_own_coverage = GxHashSet::default(); for (def_id, body) in def_and_mir_for_all_mono_fns { let mut saw_own_coverage = false; diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index 7b7f8c885bbb1..6872d8e48701b 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -10,7 +10,7 @@ use rustc_codegen_ssa::traits::{ BaseTypeMethods, BuilderMethods, ConstMethods, CoverageInfoBuilderMethods, MiscMethods, StaticMethods, }; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_llvm::RustString; use rustc_middle::bug; use rustc_middle::mir::coverage::CoverageKind; @@ -29,9 +29,9 @@ pub mod mapgen; pub struct CrateCoverageContext<'ll, 'tcx> { /// Coverage data for each instrumented function identified by DefId. pub(crate) function_coverage_map: - RefCell, FunctionCoverageCollector<'tcx>>>, - pub(crate) pgo_func_name_var_map: RefCell, &'ll llvm::Value>>, - pub(crate) mcdc_condition_bitmap_map: RefCell, Vec<&'ll llvm::Value>>>, + RefCell, FunctionCoverageCollector<'tcx>>>, + pub(crate) pgo_func_name_var_map: RefCell, &'ll llvm::Value>>, + pub(crate) mcdc_condition_bitmap_map: RefCell, Vec<&'ll llvm::Value>>>, } impl<'ll, 'tcx> CrateCoverageContext<'ll, 'tcx> { @@ -45,8 +45,8 @@ impl<'ll, 'tcx> CrateCoverageContext<'ll, 'tcx> { pub fn take_function_coverage_map( &self, - ) -> FxIndexMap, FunctionCoverageCollector<'tcx>> { - self.function_coverage_map.replace(FxIndexMap::default()) + ) -> GxIndexMap, FunctionCoverageCollector<'tcx>> { + self.function_coverage_map.replace(GxIndexMap::default()) } /// LLVM use a temp value to record evaluated mcdc test vector of each decision, which is called condition bitmap. diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs index e521d5e259caa..0057b120b9778 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs @@ -2,7 +2,7 @@ use std::cell::RefCell; use rustc_data_structures::{ fingerprint::Fingerprint, - fx::FxHashMap, + gx::GxHashMap, stable_hasher::{HashStable, StableHasher}, }; use rustc_macros::HashStable; @@ -125,7 +125,7 @@ impl<'tcx> UniqueTypeId<'tcx> { /// created so far. The debuginfo nodes are identified by `UniqueTypeId`. #[derive(Default)] pub(crate) struct TypeMap<'ll, 'tcx> { - pub(super) unique_id_to_di_node: RefCell, &'ll DIType>>, + pub(super) unique_id_to_di_node: RefCell, &'ll DIType>>, } impl<'ll, 'tcx> TypeMap<'ll, 'tcx> { diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index bf86d0e0569b1..93790e6e9d556 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -20,7 +20,7 @@ use crate::type_::Type; use crate::value::Value; use itertools::Itertools; use rustc_codegen_ssa::traits::TypeMembershipMethods; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_middle::ty::{Instance, Ty}; use rustc_sanitizers::{cfi, kcfi}; use smallvec::SmallVec; @@ -141,7 +141,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { if self.tcx.sess.is_sanitizer_cfi_enabled() { if let Some(instance) = instance { - let mut typeids = FxIndexSet::default(); + let mut typeids = GxIndexSet::default(); for options in [ cfi::TypeIdOptions::GENERALIZE_POINTERS, cfi::TypeIdOptions::NORMALIZE_INTEGERS, diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 4b7a264300711..d5469ceced512 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -30,7 +30,7 @@ use rustc_codegen_ssa::back::write::{ use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::ModuleCodegen; use rustc_codegen_ssa::{CodegenResults, CompiledModule}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError}; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; @@ -370,7 +370,7 @@ impl CodegenBackend for LlvmCodegenBackend { ongoing_codegen: Box, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CodegenResults, GxIndexMap) { let (codegen_results, work_products) = ongoing_codegen .downcast::>() .expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box") diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 7e0f264a4aedf..c4a944e6a7dce 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -7,7 +7,7 @@ use crate::llvm; use libc::c_int; use rustc_codegen_ssa::base::wants_wasm_eh; use rustc_codegen_ssa::traits::PrintBackendInfo; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; use rustc_fs_util::path_to_c_string; use rustc_middle::bug; @@ -65,7 +65,7 @@ unsafe fn configure_llvm(sess: &Session) { let tg_opts = sess.target.llvm_args.iter().map(AsRef::as_ref); let sess_args = cg_opts.chain(tg_opts); - let user_specified_args: FxHashSet<_> = + let user_specified_args: GxHashSet<_> = sess_args.clone().map(|s| llvm_arg_to_arg_name(s)).filter(|s| !s.is_empty()).collect(); { @@ -287,7 +287,7 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> { /// ensure only valid combinations are allowed. pub fn check_tied_features( sess: &Session, - features: &FxHashMap<&str, bool>, + features: &GxHashMap<&str, bool>, ) -> Option<&'static [&'static str]> { if !features.is_empty() { for tied in sess.target.tied_target_features() { @@ -374,7 +374,7 @@ fn llvm_target_features(tm: &llvm::TargetMachine) -> Vec<(&str, &str)> { fn print_target_features(out: &mut dyn PrintBackendInfo, sess: &Session, tm: &llvm::TargetMachine) { let mut llvm_target_features = llvm_target_features(tm); - let mut known_llvm_target_features = FxHashSet::<&'static str>::default(); + let mut known_llvm_target_features = GxHashSet::<&'static str>::default(); let mut rustc_target_features = sess .target .supported_target_features() @@ -540,7 +540,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec, + bundled_lib_file_names: &GxIndexSet, ) -> Result<(), ExtractBundledLibsError<'_>> { let archive_map = unsafe { Mmap::map( diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index d509e4ce56d5b..4240b7b3209d4 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1,6 +1,6 @@ use rustc_arena::TypedArena; use rustc_ast::CRATE_NODE_ID; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::temp_dir::MaybeTempDir; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError}; @@ -455,7 +455,7 @@ fn collate_raw_dylibs<'a>( used_libraries: impl IntoIterator, ) -> Result)>, ErrorGuaranteed> { // Use index maps to preserve original order of imports and libraries. - let mut dylib_table = FxIndexMap::>::default(); + let mut dylib_table = GxIndexMap::>::default(); for lib in used_libraries { if lib.kind == NativeLibKind::RawDylib { @@ -525,9 +525,9 @@ fn link_staticlib( let native_libs = codegen_results.crate_info.native_libraries[&cnum].iter(); let relevant = native_libs.clone().filter(|lib| relevant_lib(sess, lib)); - let relevant_libs: FxIndexSet<_> = relevant.filter_map(|lib| lib.filename).collect(); + let relevant_libs: GxIndexSet<_> = relevant.filter_map(|lib| lib.filename).collect(); - let bundled_libs: FxIndexSet<_> = native_libs.filter_map(|lib| lib.filename).collect(); + let bundled_libs: GxIndexSet<_> = native_libs.filter_map(|lib| lib.filename).collect(); ab.add_archive( path, Box::new(move |fname: &str| { @@ -2523,7 +2523,7 @@ fn add_native_libs_from_crate( archive_builder_builder: &dyn ArchiveBuilderBuilder, codegen_results: &CodegenResults, tmpdir: &Path, - bundled_libs: &FxIndexSet, + bundled_libs: &GxIndexSet, cnum: CrateNum, link_static: bool, link_dynamic: bool, @@ -2838,7 +2838,7 @@ fn add_static_crate( codegen_results: &CodegenResults, tmpdir: &Path, cnum: CrateNum, - bundled_lib_file_names: &FxIndexSet, + bundled_lib_file_names: &GxIndexSet, ) { let src = &codegen_results.crate_info.used_crate_source[&cnum]; let cratepath = &src.rlib.as_ref().unwrap().0; diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index f499bbcf85339..f28c94ded0600 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -1,5 +1,5 @@ use pathdiff::diff_paths; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_fs_util::try_canonicalize; use std::ffi::OsString; use std::path::{Path, PathBuf}; @@ -110,7 +110,7 @@ fn path_relative_from(path: &Path, base: &Path) -> Option { } fn minimize_rpaths(rpaths: &[OsString]) -> Vec { - let mut set = FxHashSet::default(); + let mut set = GxHashSet::default(); let mut minimized = Vec::new(); for rpath in rpaths { if set.insert(rpath) { diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 0e48eee3dd57b..c8aef7a9579a2 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -9,7 +9,7 @@ use crate::{ }; use jobserver::{Acquired, Client}; use rustc_ast::attr; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard}; use rustc_data_structures::sync::Lrc; @@ -335,7 +335,7 @@ pub type TargetMachineFactoryFn = Arc< + Sync, >; -pub type ExportedSymbols = FxHashMap>>; +pub type ExportedSymbols = GxHashMap>>; /// Additional resources used by optimize_and_codegen (not module specific) #[derive(Clone)] @@ -522,8 +522,8 @@ pub fn start_async_codegen( fn copy_all_cgu_workproducts_to_incr_comp_cache_dir( sess: &Session, compiled_modules: &CompiledModules, -) -> FxIndexMap { - let mut work_products = FxIndexMap::default(); +) -> GxIndexMap { + let mut work_products = GxIndexMap::default(); if sess.opts.incremental.is_none() { return work_products; @@ -1130,7 +1130,7 @@ fn start_executing_work( // Compute the set of symbols we need to retain when doing LTO (if we need to) let exported_symbols = { - let mut exported_symbols = FxHashMap::default(); + let mut exported_symbols = GxHashMap::default(); let copy_symbols = |cnum| { let symbols = tcx @@ -2043,7 +2043,7 @@ pub struct OngoingCodegen { } impl OngoingCodegen { - pub fn join(self, sess: &Session) -> (CodegenResults, FxIndexMap) { + pub fn join(self, sess: &Session) -> (CodegenResults, GxIndexMap) { let _timer = sess.timer("finish_ongoing_codegen"); self.shared_emitter_main.check(sess, true); diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index c18816533a2fb..c45b488f44a40 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -16,7 +16,7 @@ use crate::{CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, Modul use rustc_ast::expand::allocator::{global_fn_name, AllocatorKind, ALLOCATOR_METHODS}; use rustc_attr as attr; -use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexSet}; use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_data_structures::sync::par_map; use rustc_data_structures::unord::UnordMap; @@ -730,7 +730,7 @@ pub fn codegen_crate( pre_compiled_cgus }) } else { - FxHashMap::default() + GxHashMap::default() }; for (i, cgu) in codegen_units.iter().enumerate() { @@ -898,7 +898,7 @@ impl CrateInfo { // by the compiler, but that's ok because all this stuff is unstable anyway. let target = &tcx.sess.target; if !are_upstream_rust_objects_already_included(tcx.sess) { - let missing_weak_lang_items: FxIndexSet = info + let missing_weak_lang_items: GxIndexSet = info .used_crates .iter() .flat_map(|&cnum| tcx.missing_lang_items(cnum)) diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index c4e5c8582404b..3f12b7d0a06be 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -11,7 +11,7 @@ // within the brackets). // * `"` is treated as the start of a string. -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::stable_hasher::{Hash64, HashStable, StableHasher}; use rustc_hir::def_id::DefId; use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData}; @@ -40,7 +40,7 @@ pub fn compute_debuginfo_type_name<'tcx>( let _prof = tcx.prof.generic_activity("compute_debuginfo_type_name"); let mut result = String::with_capacity(64); - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); push_debuginfo_type_name(tcx, t, qualified, &mut result, &mut visited); result } @@ -52,7 +52,7 @@ fn push_debuginfo_type_name<'tcx>( t: Ty<'tcx>, qualified: bool, output: &mut String, - visited: &mut FxHashSet>, + visited: &mut GxHashSet>, ) { // When targeting MSVC, emit C++ style type names for compatibility with // .natvis visualizers (and perhaps other existing native debuggers?) @@ -455,9 +455,9 @@ fn push_debuginfo_type_name<'tcx>( // rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs. fn msvc_enum_fallback<'tcx>( ty_and_layout: TyAndLayout<'tcx>, - push_inner: &dyn Fn(/*output*/ &mut String, /*visited*/ &mut FxHashSet>), + push_inner: &dyn Fn(/*output*/ &mut String, /*visited*/ &mut GxHashSet>), output: &mut String, - visited: &mut FxHashSet>, + visited: &mut GxHashSet>, ) { debug_assert!(!wants_c_like_enum_debuginfo(ty_and_layout)); output.push_str("enum2$<"); @@ -520,7 +520,7 @@ pub fn compute_debuginfo_vtable_name<'tcx>( vtable_name.push('<'); } - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); push_debuginfo_type_name(tcx, t, true, &mut vtable_name, &mut visited); if cpp_like_debuginfo { @@ -658,7 +658,7 @@ fn push_generic_params_internal<'tcx>( args: GenericArgsRef<'tcx>, def_id: DefId, output: &mut String, - visited: &mut FxHashSet>, + visited: &mut GxHashSet>, ) -> bool { debug_assert_eq!(args, tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), args)); let mut args = args.non_erasable_generics(tcx, def_id).peekable(); @@ -744,7 +744,7 @@ pub fn push_generic_params<'tcx>( output: &mut String, ) { let _prof = tcx.prof.generic_activity("compute_debuginfo_type_name"); - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); push_generic_params_internal(tcx, args, def_id, output, &mut visited); } @@ -754,7 +754,7 @@ fn push_closure_or_coroutine_name<'tcx>( args: GenericArgsRef<'tcx>, qualified: bool, output: &mut String, - visited: &mut FxHashSet>, + visited: &mut GxHashSet>, ) { // Name will be "{closure_env#0}", "{coroutine_env#0}", or // "{async_fn_env#0}", etc. diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index e801af4001415..0d413c2411670 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -18,8 +18,8 @@ //! have to be implemented by each backend. use rustc_ast as ast; -use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxHashSet; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unord::UnordMap; use rustc_hir::def_id::CrateNum; @@ -183,12 +183,12 @@ pub struct CrateInfo { pub target_cpu: String, pub crate_types: Vec, pub exported_symbols: UnordMap>, - pub linked_symbols: FxIndexMap>, + pub linked_symbols: GxIndexMap>, pub local_crate_name: Symbol, pub compiler_builtins: Option, pub profiler_runtime: Option, - pub is_no_builtins: FxHashSet, - pub native_libraries: FxIndexMap>, + pub is_no_builtins: GxHashSet, + pub native_libraries: GxIndexMap>, pub crate_name: UnordMap, pub used_libraries: Vec, pub used_crate_source: UnordMap>, diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index 6b89636b6540c..de8c0662201fe 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -1,5 +1,5 @@ use crate::traits::*; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_index::IndexVec; use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; @@ -24,7 +24,7 @@ pub struct FunctionDebugContext<'tcx, S, L> { pub scopes: IndexVec>, /// Maps from an inlined function to its debug info declaration. - pub inlined_function_scopes: FxHashMap, S>, + pub inlined_function_scopes: GxHashMap, S>, } #[derive(Copy, Clone)] pub enum VariableKind { diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index bcddfe9fb9cb0..5c1e551e8a8f9 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -1,7 +1,7 @@ use crate::errors; use rustc_ast::ast; use rustc_attr::InstructionSetAttr; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::unord::UnordMap; use rustc_errors::Applicability; use rustc_hir::def::DefKind; @@ -99,7 +99,7 @@ pub fn from_target_feature( /// Computes the set of target features used in a function for the purposes of /// inline assembly. -fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxIndexSet { +fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &GxIndexSet { let mut target_features = tcx.sess.unstable_target_features.clone(); if tcx.def_kind(did).has_codegen_attrs() { let attrs = tcx.codegen_fn_attrs(did); diff --git a/compiler/rustc_codegen_ssa/src/traits/backend.rs b/compiler/rustc_codegen_ssa/src/traits/backend.rs index e8b9490d4010a..6c918ec53fd58 100644 --- a/compiler/rustc_codegen_ssa/src/traits/backend.rs +++ b/compiler/rustc_codegen_ssa/src/traits/backend.rs @@ -6,7 +6,7 @@ use crate::back::write::TargetMachineFactoryFn; use crate::{CodegenResults, ModuleCodegen}; use rustc_ast::expand::allocator::AllocatorKind; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::{DynSend, DynSync}; use rustc_errors::ErrorGuaranteed; use rustc_metadata::creader::MetadataLoaderDyn; @@ -95,7 +95,7 @@ pub trait CodegenBackend { ongoing_codegen: Box, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap); + ) -> (CodegenResults, GxIndexMap); /// This is called on the returned `CodegenResults` from `join_codegen` fn link( diff --git a/compiler/rustc_codegen_ssa/src/traits/misc.rs b/compiler/rustc_codegen_ssa/src/traits/misc.rs index 04e2b8796c46a..76cf7f5d3d431 100644 --- a/compiler/rustc_codegen_ssa/src/traits/misc.rs +++ b/compiler/rustc_codegen_ssa/src/traits/misc.rs @@ -1,5 +1,5 @@ use super::BackendTypes; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::mir::mono::CodegenUnit; use rustc_middle::ty::{self, Instance, Ty}; use rustc_session::Session; @@ -8,7 +8,7 @@ use std::cell::RefCell; pub trait MiscMethods<'tcx>: BackendTypes { fn vtables( &self, - ) -> &RefCell, Option>), Self::Value>>; + ) -> &RefCell, Option>), Self::Value>>; fn check_overflow(&self) -> bool; fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function; fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value; diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 99276bac03501..8b011607374b6 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -4,8 +4,8 @@ use std::hash::Hash; use std::ops::ControlFlow; use rustc_ast::Mutability; -use rustc_data_structures::fx::FxIndexMap; -use rustc_data_structures::fx::IndexEntry; +use rustc_data_structures::gx::GxIndexMap; +use rustc_data_structures::gx::IndexEntry; use rustc_hir::def_id::DefId; use rustc_hir::def_id::LocalDefId; use rustc_hir::LangItem; @@ -105,13 +105,13 @@ impl<'tcx> CompileTimeMachine<'tcx> { } } -impl interpret::AllocMap for FxIndexMap { +impl interpret::AllocMap for GxIndexMap { #[inline(always)] fn contains_key(&mut self, k: &Q) -> bool where K: Borrow, { - FxIndexMap::contains_key(self, k) + GxIndexMap::contains_key(self, k) } #[inline(always)] @@ -119,12 +119,12 @@ impl interpret::AllocMap for FxIndexMap { where K: Borrow, { - FxIndexMap::contains_key(self, k) + GxIndexMap::contains_key(self, k) } #[inline(always)] fn insert(&mut self, k: K, v: V) -> Option { - FxIndexMap::insert(self, k, v) + GxIndexMap::insert(self, k, v) } #[inline(always)] @@ -133,7 +133,7 @@ impl interpret::AllocMap for FxIndexMap { K: Borrow, { // FIXME(#120456) - is `swap_remove` correct? - FxIndexMap::swap_remove(self, k) + GxIndexMap::swap_remove(self, k) } #[inline(always)] diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 8b0a2afa4d669..c0b45ac68e274 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -15,7 +15,7 @@ use hir::def::DefKind; use rustc_ast::Mutability; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_hir as hir; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::mir::interpret::{ConstAllocation, CtfeProvenance, InterpResult}; @@ -36,7 +36,7 @@ pub trait CompileTimeMachine<'tcx, T> = Machine< ExtraFnVal = !, FrameExtra = (), AllocExtra = (), - MemoryMap = FxIndexMap, Allocation)>, + MemoryMap = GxIndexMap, Allocation)>, > + HasStaticRootDefId; pub trait HasStaticRootDefId { @@ -197,7 +197,7 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx, const_eval }; // We need to distinguish "has just been interned" from "was already in `tcx`", // so we track this in a separate set. - let mut just_interned: FxHashSet<_> = std::iter::once(base_alloc_id).collect(); + let mut just_interned: GxHashSet<_> = std::iter::once(base_alloc_id).collect(); // Whether we encountered a bad mutable pointer. // We want to first report "dangling" and then "mutable", so we need to delay reporting these // errors. diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index e91ab7c179163..3d5a66db144c6 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -570,7 +570,7 @@ pub macro compile_time_machine(<$tcx: lifetime>) { type ExtraFnVal = !; type MemoryMap = - rustc_data_structures::fx::FxIndexMap, Allocation)>; + rustc_data_structures::gx::GxIndexMap, Allocation)>; const GLOBAL_KIND: Option = None; // no copying of globals from `tcx` to machine memory type AllocExtra = (); diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 9d0c490822561..dedb9899d2a29 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -14,7 +14,7 @@ use std::fmt; use std::ptr; use rustc_ast::Mutability; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_hir::def::DefKind; use rustc_middle::bug; use rustc_middle::mir::display_allocation; @@ -110,13 +110,13 @@ pub struct Memory<'tcx, M: Machine<'tcx>> { pub(super) alloc_map: M::MemoryMap, /// Map for "extra" function pointers. - extra_fn_ptr_map: FxIndexMap, + extra_fn_ptr_map: GxIndexMap, /// To be able to compare pointers with null, and to check alignment for accesses /// to ZSTs (where pointers may dangle), we keep track of the size even for allocations /// that do not exist any more. // FIXME: this should not be public, but interning currently needs access to it - pub(super) dead_alloc_map: FxIndexMap, + pub(super) dead_alloc_map: GxIndexMap, /// This stores whether we are currently doing reads purely for the purpose of validation. /// Those reads do not trigger the machine's hooks for memory reads. @@ -146,8 +146,8 @@ impl<'tcx, M: Machine<'tcx>> Memory<'tcx, M> { pub fn new() -> Self { Memory { alloc_map: M::MemoryMap::default(), - extra_fn_ptr_map: FxIndexMap::default(), - dead_alloc_map: FxIndexMap::default(), + extra_fn_ptr_map: GxIndexMap::default(), + dead_alloc_map: GxIndexMap::default(), validation_in_progress: Cell::new(false), } } @@ -529,7 +529,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { /// This function is used by Miri's provenance GC to remove unreachable entries from the dead_alloc_map. - pub fn remove_unreachable_allocs(&mut self, reachable_allocs: &FxHashSet) { + pub fn remove_unreachable_allocs(&mut self, reachable_allocs: &GxHashSet) { // Unlike all the other GC helpers where we check if an `AllocId` is found in the interpreter or // is live, here all the IDs in the map are for dead allocations so we don't // need to check for liveness. @@ -951,7 +951,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { { // Collect the set of allocations that are *reachable* from `Global` allocations. let reachable = { - let mut reachable = FxHashSet::default(); + let mut reachable = GxHashSet::default(); let global_kind = M::GLOBAL_KIND.map(MemoryKind::Machine); let mut todo: Vec<_> = self.memory.alloc_map.filter_map_collect(move |&id, &(kind, _)| { @@ -1024,7 +1024,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> std::fmt::Debug for DumpAllocs<'a, 'tcx, M> { let mut allocs_to_print: VecDeque<_> = self.allocs.iter().copied().collect(); // `allocs_printed` contains all allocations that we have already printed. - let mut allocs_printed = FxHashSet::default(); + let mut allocs_printed = GxHashSet::default(); while let Some(id) = allocs_to_print.pop_front() { if !allocs_printed.insert(id) { diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index add48e1b186cb..648576016ce0a 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -13,7 +13,7 @@ use tracing::trace; use hir::def::DefKind; use rustc_ast::Mutability; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_middle::bug; use rustc_middle::mir::interpret::{ @@ -154,17 +154,17 @@ impl CtfeValidationMode { /// State for tracking recursive validation of references pub struct RefTracking { - pub seen: FxHashSet, + pub seen: GxHashSet, pub todo: Vec<(T, PATH)>, } impl RefTracking { pub fn empty() -> Self { - RefTracking { seen: FxHashSet::default(), todo: vec![] } + RefTracking { seen: GxHashSet::default(), todo: vec![] } } pub fn new(op: T) -> Self { let mut ref_tracking_for_consts = - RefTracking { seen: FxHashSet::default(), todo: vec![(op.clone(), PATH::default())] }; + RefTracking { seen: GxHashSet::default(), todo: vec![(op.clone(), PATH::default())] }; ref_tracking_for_consts.seen.insert(op); ref_tracking_for_consts } diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml index f525510030b4a..5bd57fc7d7bc9 100644 --- a/compiler/rustc_data_structures/Cargo.toml +++ b/compiler/rustc_data_structures/Cargo.toml @@ -13,7 +13,6 @@ ena = "0.14.3" indexmap = { version = "2.0.0" } jobserver_crate = { version = "0.1.28", package = "jobserver" } measureme = "11" -rustc-hash = "1.1.0" rustc-rayon = { version = "0.5.0", optional = true } rustc_arena = { path = "../rustc_arena" } rustc_graphviz = { path = "../rustc_graphviz" } @@ -53,6 +52,12 @@ memmap2 = "0.2.1" [target.'cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))'.dependencies] portable-atomic = "1.5.1" +[target.'cfg(not(all(target_feature = "sse2", target_feature = "aes")))'.dependencies] +rustc-hash = "2.0.0" + +[target.'cfg(all(target_feature = "sse2", target_feature = "aes"))'.dependencies] +gxhash = "3.4.1" + [features] # tidy-alphabetical-start rustc_use_parallel_compiler = ["indexmap/rustc-rayon", "rustc-rayon"] diff --git a/compiler/rustc_data_structures/src/fingerprint.rs b/compiler/rustc_data_structures/src/fingerprint.rs index 1bee159489dc7..603d8c5210bb6 100644 --- a/compiler/rustc_data_structures/src/fingerprint.rs +++ b/compiler/rustc_data_structures/src/fingerprint.rs @@ -149,7 +149,7 @@ impl FingerprintHasher for crate::unhash::Unhasher { // cheaper than the more robust Fingerprint::to_smaller_hash()). For // HashMaps we don't really care if Fingerprint(x,y) and // Fingerprint(y, x) result in the same hash value. Collision - // probability will still be much better than with FxHash. + // probability will still be much better than with GxHash. self.write_u64(fingerprint.0.wrapping_add(fingerprint.1)); } } diff --git a/compiler/rustc_data_structures/src/fx.rs b/compiler/rustc_data_structures/src/fx.rs deleted file mode 100644 index 80e72250470c0..0000000000000 --- a/compiler/rustc_data_structures/src/fx.rs +++ /dev/null @@ -1,28 +0,0 @@ -use std::hash::BuildHasherDefault; - -pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; - -pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>; - -pub type FxIndexMap = indexmap::IndexMap>; -pub type FxIndexSet = indexmap::IndexSet>; -pub type IndexEntry<'a, K, V> = indexmap::map::Entry<'a, K, V>; -pub type IndexOccupiedEntry<'a, K, V> = indexmap::map::OccupiedEntry<'a, K, V>; - -#[macro_export] -macro_rules! define_id_collections { - ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { - pub type $map_name = $crate::unord::UnordMap<$key, T>; - pub type $set_name = $crate::unord::UnordSet<$key>; - pub type $entry_name<'a, T> = $crate::fx::StdEntry<'a, $key, T>; - }; -} - -#[macro_export] -macro_rules! define_stable_id_collections { - ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { - pub type $map_name = $crate::fx::FxIndexMap<$key, T>; - pub type $set_name = $crate::fx::FxIndexSet<$key>; - pub type $entry_name<'a, T> = $crate::fx::IndexEntry<'a, $key, T>; - }; -} diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index 8b96b36a8512a..bca3dba161113 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -8,9 +8,9 @@ //! Typical examples would include: minimum element in SCC, maximum element //! reachable from it, etc. -use crate::fx::FxHashSet; use crate::graph::vec_graph::VecGraph; use crate::graph::{DirectedGraph, NumEdges, Successors}; +use crate::gx::GxHashSet; use rustc_index::{Idx, IndexSlice, IndexVec}; use std::fmt::Debug; use std::ops::Range; @@ -242,7 +242,7 @@ where /// into the successors_stack, we sometimes get duplicate entries. /// We use this set to remove those -- we also keep its storage /// around between successors to amortize memory allocation costs. - duplicate_set: FxHashSet, + duplicate_set: GxHashSet, scc_data: SccData, @@ -326,7 +326,7 @@ where node_stack: Vec::with_capacity(num_nodes), successors_stack: Vec::new(), scc_data: SccData { scc_details: IndexVec::new(), all_successors: Vec::new() }, - duplicate_set: FxHashSet::default(), + duplicate_set: GxHashSet::default(), to_annotation, }; diff --git a/compiler/rustc_data_structures/src/graph/tests.rs b/compiler/rustc_data_structures/src/graph/tests.rs index 85c2703cc2538..5752754298213 100644 --- a/compiler/rustc_data_structures/src/graph/tests.rs +++ b/compiler/rustc_data_structures/src/graph/tests.rs @@ -1,4 +1,4 @@ -use crate::fx::FxHashMap; +use crate::gx::GxHashMap; use std::cmp::max; use super::*; @@ -6,8 +6,8 @@ use super::*; pub struct TestGraph { num_nodes: usize, start_node: usize, - successors: FxHashMap>, - predecessors: FxHashMap>, + successors: GxHashMap>, + predecessors: GxHashMap>, } impl TestGraph { @@ -15,8 +15,8 @@ impl TestGraph { let mut graph = TestGraph { num_nodes: start_node + 1, start_node, - successors: FxHashMap::default(), - predecessors: FxHashMap::default(), + successors: GxHashMap::default(), + predecessors: GxHashMap::default(), }; for &(source, target) in edges { graph.num_nodes = max(graph.num_nodes, source + 1); diff --git a/compiler/rustc_data_structures/src/gx.rs b/compiler/rustc_data_structures/src/gx.rs new file mode 100644 index 0000000000000..3ea93283fda48 --- /dev/null +++ b/compiler/rustc_data_structures/src/gx.rs @@ -0,0 +1,37 @@ +use std::hash::BuildHasherDefault; + +#[cfg(not(all(target_feature = "sse2", target_feature = "aes")))] +pub use rustc_hash::{FxHashMap as GxHashMap, FxHashSet as GxHashSet, FxHasher as GxHasher}; + +#[cfg(all(target_feature = "sse2", target_feature = "aes"))] +pub use gxhash::GxHasher; + +pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>; + +#[cfg(all(target_feature = "sse2", target_feature = "aes"))] +pub type GxHashMap = std::collections::HashMap>; +#[cfg(all(target_feature = "sse2", target_feature = "aes"))] +pub type GxHashSet = std::collections::HashSet>; + +pub type GxIndexMap = indexmap::IndexMap>; +pub type GxIndexSet = indexmap::IndexSet>; +pub type IndexEntry<'a, K, V> = indexmap::map::Entry<'a, K, V>; +pub type IndexOccupiedEntry<'a, K, V> = indexmap::map::OccupiedEntry<'a, K, V>; + +#[macro_export] +macro_rules! define_id_collections { + ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { + pub type $map_name = $crate::unord::UnordMap<$key, T>; + pub type $set_name = $crate::unord::UnordSet<$key>; + pub type $entry_name<'a, T> = $crate::gx::StdEntry<'a, $key, T>; + }; +} + +#[macro_export] +macro_rules! define_stable_id_collections { + ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { + pub type $map_name = $crate::gx::GxIndexMap<$key, T>; + pub type $set_name = $crate::gx::GxIndexSet<$key>; + pub type $entry_name<'a, T> = $crate::gx::IndexEntry<'a, $key, T>; + }; +} diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index 356ddf014bee5..77b2583f59367 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -56,8 +56,8 @@ pub mod fingerprint; pub mod flat_map_in_place; pub mod flock; pub mod frozen; -pub mod fx; pub mod graph; +pub mod gx; pub mod intern; pub mod jobserver; pub mod marker; diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index 3883b0736db07..672208e268a6d 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -69,7 +69,7 @@ //! step, we compress the vector to remove completed and error nodes, which //! aren't needed anymore. -use crate::fx::{FxHashMap, FxHashSet}; +use crate::gx::{GxHashMap, GxHashSet}; use std::cell::Cell; use std::collections::hash_map::Entry; use std::fmt::Debug; @@ -157,12 +157,12 @@ pub struct ObligationForest { nodes: Vec>, /// A cache of predicates that have been successfully completed. - done_cache: FxHashSet, + done_cache: GxHashSet, /// A cache of the nodes in `nodes`, indexed by predicate. Unfortunately, /// its contents are not guaranteed to match those of `nodes`. See the /// comments in `Self::process_obligation` for details. - active_cache: FxHashMap, + active_cache: GxHashMap, /// A vector reused in [Self::compress()] and [Self::find_cycles_from_node()], /// to avoid allocating new vectors. @@ -177,7 +177,7 @@ pub struct ObligationForest { /// See [this][details] for details. /// /// [details]: https://github.com/rust-lang/rust/pull/53255#issuecomment-421184780 - error_cache: FxHashMap>, + error_cache: GxHashMap>, } #[derive(Debug)] diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 240f2671c3b2d..a212c7954eab3 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -81,7 +81,7 @@ //! //! [mm]: https://github.com/rust-lang/measureme/ -use crate::fx::FxHashMap; +use crate::gx::GxHashMap; use crate::outline; use std::borrow::Borrow; @@ -536,7 +536,7 @@ pub struct SelfProfiler { profiler: Profiler, event_filter_mask: EventFilter, - string_cache: RwLock>, + string_cache: RwLock>, query_event_kind: StringId, generic_activity_event_kind: StringId, @@ -611,7 +611,7 @@ impl SelfProfiler { Ok(SelfProfiler { profiler, event_filter_mask, - string_cache: RwLock::new(FxHashMap::default()), + string_cache: RwLock::new(GxHashMap::default()), query_event_kind, generic_activity_event_kind, incremental_load_result_event_kind, diff --git a/compiler/rustc_data_structures/src/sharded.rs b/compiler/rustc_data_structures/src/sharded.rs index 4b02b18346069..aa045718b2c69 100644 --- a/compiler/rustc_data_structures/src/sharded.rs +++ b/compiler/rustc_data_structures/src/sharded.rs @@ -1,4 +1,4 @@ -use crate::fx::{FxHashMap, FxHasher}; +use crate::gx::{GxHashMap, GxHasher}; #[cfg(parallel_compiler)] use crate::sync::{is_dyn_thread_safe, CacheAligned}; use crate::sync::{Lock, LockGuard, Mode}; @@ -46,7 +46,7 @@ impl Sharded { Sharded::Single(Lock::new(value())) } - /// The shard is selected by hashing `val` with `FxHasher`. + /// The shard is selected by hashing `val` with `GxHasher`. #[inline] pub fn get_shard_by_value(&self, _val: &K) -> &Lock { match self { @@ -73,7 +73,7 @@ impl Sharded { } } - /// The shard is selected by hashing `val` with `FxHasher`. + /// The shard is selected by hashing `val` with `GxHasher`. #[inline] #[track_caller] pub fn lock_shard_by_value(&self, _val: &K) -> LockGuard<'_, T> { @@ -158,7 +158,7 @@ pub fn shards() -> usize { 1 } -pub type ShardedHashMap = Sharded>; +pub type ShardedHashMap = Sharded>; impl ShardedHashMap { pub fn len(&self) -> usize { @@ -224,14 +224,14 @@ impl ShardedHashMap { #[inline] pub fn make_hash(val: &K) -> u64 { - let mut state = FxHasher::default(); + let mut state = GxHasher::default(); val.hash(&mut state); state.finish() } /// Get a shard with a pre-computed hash value. If `get_shard_by_value` is /// ever used in combination with `get_shard_by_hash` on a single `Sharded` -/// instance, then `hash` must be computed with `FxHasher`. Otherwise, +/// instance, then `hash` must be computed with `GxHasher`. Otherwise, /// `hash` can be computed with any hasher, so long as that hasher is used /// consistently for each `Sharded` instance. #[inline] diff --git a/compiler/rustc_data_structures/src/snapshot_map/mod.rs b/compiler/rustc_data_structures/src/snapshot_map/mod.rs index 8a50179cd3b64..72af48cd16146 100644 --- a/compiler/rustc_data_structures/src/snapshot_map/mod.rs +++ b/compiler/rustc_data_structures/src/snapshot_map/mod.rs @@ -1,4 +1,4 @@ -use crate::fx::FxHashMap; +use crate::gx::GxHashMap; use crate::undo_log::{Rollback, Snapshots, UndoLogs, VecLog}; use std::borrow::{Borrow, BorrowMut}; use std::hash::Hash; @@ -10,11 +10,11 @@ pub use crate::undo_log::Snapshot; #[cfg(test)] mod tests; -pub type SnapshotMapStorage = SnapshotMap, ()>; -pub type SnapshotMapRef<'a, K, V, L> = SnapshotMap, &'a mut L>; +pub type SnapshotMapStorage = SnapshotMap, ()>; +pub type SnapshotMapRef<'a, K, V, L> = SnapshotMap, &'a mut L>; #[derive(Clone)] -pub struct SnapshotMap, L = VecLog>> { +pub struct SnapshotMap, L = VecLog>> { map: M, undo_log: L, _marker: PhantomData<(K, V)>, @@ -48,7 +48,7 @@ impl SnapshotMap { impl SnapshotMap where K: Hash + Clone + Eq, - M: BorrowMut> + Borrow>, + M: BorrowMut> + Borrow>, L: UndoLogs>, { pub fn clear(&mut self) { @@ -105,7 +105,7 @@ where impl<'k, K, V, M, L> ops::Index<&'k K> for SnapshotMap where K: Hash + Clone + Eq, - M: Borrow>, + M: Borrow>, { type Output = V; fn index(&self, key: &'k K) -> &V { @@ -123,7 +123,7 @@ where } } -impl Rollback> for FxHashMap +impl Rollback> for GxHashMap where K: Eq + Hash, { diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs index 2ef4a2ccd8476..090b505c590b4 100644 --- a/compiler/rustc_data_structures/src/sso/map.rs +++ b/compiler/rustc_data_structures/src/sso/map.rs @@ -1,4 +1,4 @@ -use crate::fx::FxHashMap; +use crate::gx::GxHashMap; use arrayvec::ArrayVec; use either::Either; use std::fmt; @@ -67,7 +67,7 @@ const SSO_ARRAY_SIZE: usize = 8; #[derive(Clone)] pub enum SsoHashMap { Array(ArrayVec<(K, V), SSO_ARRAY_SIZE>), - Map(FxHashMap), + Map(GxHashMap), } impl SsoHashMap { @@ -82,7 +82,7 @@ impl SsoHashMap { if cap <= SSO_ARRAY_SIZE { Self::new() } else { - SsoHashMap::Map(FxHashMap::with_capacity_and_hasher(cap, Default::default())) + SsoHashMap::Map(GxHashMap::with_capacity_and_hasher(cap, Default::default())) } } @@ -189,7 +189,7 @@ impl SsoHashMap { match self { SsoHashMap::Array(array) => { if SSO_ARRAY_SIZE < (array.len() + additional) { - let mut map: FxHashMap = array.drain(..).collect(); + let mut map: GxHashMap = array.drain(..).collect(); map.reserve(additional); *self = SsoHashMap::Map(map); } @@ -240,7 +240,7 @@ impl SsoHashMap { } } if let Err(error) = array.try_push((key, value)) { - let mut map: FxHashMap = array.drain(..).collect(); + let mut map: GxHashMap = array.drain(..).collect(); let (key, value) = error.element(); map.insert(key, value); *self = SsoHashMap::Map(map); @@ -368,7 +368,7 @@ impl Extend<(K, V)> for SsoHashMap { match self { SsoHashMap::Array(array) => { if SSO_ARRAY_SIZE < (array.len() + additional) { - let mut map: FxHashMap = array.drain(..).collect(); + let mut map: GxHashMap = array.drain(..).collect(); map.extend_reserve(additional); *self = SsoHashMap::Map(map); } @@ -401,7 +401,7 @@ where impl IntoIterator for SsoHashMap { type IntoIter = Either< as IntoIterator>::IntoIter, - as IntoIterator>::IntoIter, + as IntoIterator>::IntoIter, >; type Item = ::Item; @@ -433,7 +433,7 @@ impl<'a, K, V> IntoIterator for &'a SsoHashMap { <&'a ArrayVec<(K, V), SSO_ARRAY_SIZE> as IntoIterator>::IntoIter, fn(&'a (K, V)) -> (&'a K, &'a V), >, - <&'a FxHashMap as IntoIterator>::IntoIter, + <&'a GxHashMap as IntoIterator>::IntoIter, >; type Item = ::Item; @@ -451,7 +451,7 @@ impl<'a, K, V> IntoIterator for &'a mut SsoHashMap { <&'a mut ArrayVec<(K, V), SSO_ARRAY_SIZE> as IntoIterator>::IntoIter, fn(&'a mut (K, V)) -> (&'a K, &'a mut V), >, - <&'a mut FxHashMap as IntoIterator>::IntoIter, + <&'a mut GxHashMap as IntoIterator>::IntoIter, >; type Item = ::Item; diff --git a/compiler/rustc_data_structures/src/transitive_relation.rs b/compiler/rustc_data_structures/src/transitive_relation.rs index cd391fe357a6f..53b1b1d8fd140 100644 --- a/compiler/rustc_data_structures/src/transitive_relation.rs +++ b/compiler/rustc_data_structures/src/transitive_relation.rs @@ -1,5 +1,5 @@ use crate::frozen::Frozen; -use crate::fx::{FxHashSet, FxIndexSet}; +use crate::gx::{GxHashSet, GxIndexSet}; use rustc_index::bit_set::BitMatrix; use std::fmt::Debug; use std::hash::Hash; @@ -12,11 +12,11 @@ mod tests; #[derive(Clone, Debug)] pub struct TransitiveRelationBuilder { // List of elements. This is used to map from a T to a usize. - elements: FxIndexSet, + elements: GxIndexSet, // List of base edges in the graph. Require to compute transitive // closure. - edges: FxHashSet, + edges: GxHashSet, } #[derive(Debug)] @@ -38,7 +38,7 @@ impl Deref for TransitiveRelation { impl Clone for TransitiveRelation { fn clone(&self) -> Self { - TransitiveRelation { + TransitiveRelation:: { builder: Frozen::freeze(self.builder.deref().clone()), closure: Frozen::freeze(self.closure.deref().clone()), } diff --git a/compiler/rustc_data_structures/src/unord.rs b/compiler/rustc_data_structures/src/unord.rs index 1ccd22a56c959..ab142569433d2 100644 --- a/compiler/rustc_data_structures/src/unord.rs +++ b/compiler/rustc_data_structures/src/unord.rs @@ -2,7 +2,7 @@ //! ordering. This is a useful property for deterministic computations, such //! as required by the query system. -use rustc_hash::{FxHashMap, FxHashSet}; +use crate::gx::{GxHashMap, GxHashSet}; use rustc_macros::{Decodable_Generic, Encodable_Generic}; use std::collections::hash_map::OccupiedError; use std::{ @@ -230,7 +230,7 @@ trait UnordCollection {} /// for more information. #[derive(Debug, Eq, PartialEq, Clone, Encodable_Generic, Decodable_Generic)] pub struct UnordSet { - inner: FxHashSet, + inner: GxHashSet, } impl UnordCollection for UnordSet {} @@ -238,7 +238,7 @@ impl UnordCollection for UnordSet {} impl Default for UnordSet { #[inline] fn default() -> Self { - Self { inner: FxHashSet::default() } + Self { inner: GxHashSet::default() } } } @@ -250,7 +250,7 @@ impl UnordSet { #[inline] pub fn with_capacity(capacity: usize) -> Self { - Self { inner: FxHashSet::with_capacity_and_hasher(capacity, Default::default()) } + Self { inner: GxHashSet::with_capacity_and_hasher(capacity, Default::default()) } } #[inline] @@ -387,19 +387,19 @@ impl Extend for UnordSet { impl FromIterator for UnordSet { #[inline] fn from_iter>(iter: T) -> Self { - UnordSet { inner: FxHashSet::from_iter(iter) } + UnordSet { inner: GxHashSet::from_iter(iter) } } } -impl From> for UnordSet { - fn from(value: FxHashSet) -> Self { +impl From> for UnordSet { + fn from(value: GxHashSet) -> Self { UnordSet { inner: value } } } impl> From> for UnordSet { fn from(value: UnordItems) -> Self { - UnordSet { inner: FxHashSet::from_iter(value.0) } + UnordSet { inner: GxHashSet::from_iter(value.0) } } } @@ -421,7 +421,7 @@ impl> HashStable for UnordSet { /// for more information. #[derive(Debug, Eq, PartialEq, Clone, Encodable_Generic, Decodable_Generic)] pub struct UnordMap { - inner: FxHashMap, + inner: GxHashMap, } impl UnordCollection for UnordMap {} @@ -429,7 +429,7 @@ impl UnordCollection for UnordMap {} impl Default for UnordMap { #[inline] fn default() -> Self { - Self { inner: FxHashMap::default() } + Self { inner: GxHashMap::default() } } } @@ -443,21 +443,21 @@ impl Extend<(K, V)> for UnordMap { impl FromIterator<(K, V)> for UnordMap { #[inline] fn from_iter>(iter: T) -> Self { - UnordMap { inner: FxHashMap::from_iter(iter) } + UnordMap { inner: GxHashMap::from_iter(iter) } } } impl> From> for UnordMap { #[inline] fn from(items: UnordItems<(K, V), I>) -> Self { - UnordMap { inner: FxHashMap::from_iter(items.0) } + UnordMap { inner: GxHashMap::from_iter(items.0) } } } impl UnordMap { #[inline] pub fn with_capacity(capacity: usize) -> Self { - Self { inner: FxHashMap::with_capacity_and_hasher(capacity, Default::default()) } + Self { inner: GxHashMap::with_capacity_and_hasher(capacity, Default::default()) } } #[inline] diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index e580910af7799..761cba420aaca 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -3,7 +3,7 @@ use crate::{ CodeSuggestion, DiagCtxtHandle, DiagMessage, ErrCode, ErrorGuaranteed, ExplicitBug, Level, MultiSpan, StashKey, SubdiagMessage, Substitution, SubstitutionPart, SuggestionStyle, }; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_error_messages::fluent_value_from_str_list_sep_by_and; use rustc_error_messages::FluentValue; use rustc_lint_defs::{Applicability, LintExpectationId}; @@ -45,7 +45,7 @@ pub enum DiagArgValue { StrListSepByAnd(Vec>), } -pub type DiagArgMap = FxIndexMap; +pub type DiagArgMap = GxIndexMap; /// Trait for types that `Diag::emit` can return as a "guarantee" (or "proof") /// token that the emission happened. @@ -355,7 +355,7 @@ impl DiagInner { pub(crate) fn update_unstable_expectation_id( &mut self, - unstable_to_stable: &FxIndexMap, + unstable_to_stable: &GxIndexMap, ) { if let Level::Expect(expectation_id) | Level::ForceWarning(Some(expectation_id)) = &mut self.level diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 45118bcc58abe..31a5c7f47b5cd 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -21,7 +21,7 @@ use crate::{ SuggestionStyle, TerminalUrl, }; use derive_setters::Setters; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap, GxIndexSet}; use rustc_data_structures::sync::{DynSend, IntoDynSyncSend, Lrc}; use rustc_error_messages::{FluentArgs, SpanLabel}; use rustc_lint_defs::pluralize; @@ -358,7 +358,7 @@ pub trait Emitter: Translate { } fn render_multispan_macro_backtrace(&self, span: &mut MultiSpan, always_backtrace: bool) { - let mut new_labels = FxIndexSet::default(); + let mut new_labels = GxIndexSet::default(); for &sp in span.primary_spans() { if sp.is_dummy() { @@ -1532,7 +1532,7 @@ impl HumanEmitter { ); // Contains the vertical lines' positions for active multiline annotations - let mut multilines = FxIndexMap::default(); + let mut multilines = GxIndexMap::default(); // Get the left-side margin to remove it let mut whitespace_margin = usize::MAX; @@ -1635,7 +1635,7 @@ impl HumanEmitter { margin, ); - let mut to_add = FxHashMap::default(); + let mut to_add = GxHashMap::default(); for (depth, style) in depths { // FIXME(#120456) - is `swap_remove` correct? diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 91112a572770e..e9be0ea6b9ec4 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -53,7 +53,7 @@ pub use termcolor::{Color, ColorSpec, WriteColor}; use emitter::{is_case_difference, DynEmitter, Emitter}; use registry::Registry; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_data_structures::stable_hasher::{Hash128, StableHasher}; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_data_structures::AtomicRef; @@ -463,22 +463,22 @@ struct DiagCtxtInner { /// This set contains the code of all emitted diagnostics to avoid /// emitting the same diagnostic with extended help (`--teach`) twice, which /// would be unnecessary repetition. - taught_diagnostics: FxHashSet, + taught_diagnostics: GxHashSet, /// Used to suggest rustc --explain `` - emitted_diagnostic_codes: FxIndexSet, + emitted_diagnostic_codes: GxIndexSet, /// This set contains a hash of every diagnostic that has been emitted by /// this `DiagCtxt`. These hashes is used to avoid emitting the same error /// twice. - emitted_diagnostics: FxHashSet, + emitted_diagnostics: GxHashSet, /// Stashed diagnostics emitted in one stage of the compiler that may be /// stolen and emitted/cancelled by other stages (e.g. to improve them and /// add more information). All stashed diagnostics must be emitted with /// `emit_stashed_diagnostics` by the time the `DiagCtxtInner` is dropped, /// otherwise an assertion failure will occur. - stashed_diagnostics: FxIndexMap<(Span, StashKey), (DiagInner, Option)>, + stashed_diagnostics: GxIndexMap<(Span, StashKey), (DiagInner, Option)>, future_breakage_diagnostics: Vec, @@ -503,7 +503,7 @@ struct DiagCtxtInner { /// that have been marked as fulfilled this way. /// /// [RFC-2383]: https://rust-lang.github.io/rfcs/2383-lint-reasons.html - fulfilled_expectations: FxHashSet, + fulfilled_expectations: GxHashSet, /// The file where the ICE information is stored. This allows delayed_span_bug backtraces to be /// stored along side the main panic backtrace. @@ -1066,7 +1066,7 @@ impl<'a> DiagCtxtHandle<'a> { pub fn update_unstable_expectation_id( &self, - unstable_to_stable: &FxIndexMap, + unstable_to_stable: &GxIndexMap, ) { let mut inner = self.inner.borrow_mut(); let diags = std::mem::take(&mut inner.unstable_expect_diagnostics); @@ -1097,7 +1097,7 @@ impl<'a> DiagCtxtHandle<'a> { /// This methods steals all [`LintExpectationId`]s that are stored inside /// [`DiagCtxtInner`] and indicate that the linked expectation has been fulfilled. #[must_use] - pub fn steal_fulfilled_expectation_ids(&self) -> FxHashSet { + pub fn steal_fulfilled_expectation_ids(&self) -> GxHashSet { assert!( self.inner.borrow().unstable_expect_diagnostics.is_empty(), "`DiagCtxtInner::unstable_expect_diagnostics` should be empty at this point", diff --git a/compiler/rustc_errors/src/registry.rs b/compiler/rustc_errors/src/registry.rs index 8834d04d9718b..9f5a7dce2b225 100644 --- a/compiler/rustc_errors/src/registry.rs +++ b/compiler/rustc_errors/src/registry.rs @@ -1,12 +1,12 @@ use crate::ErrCode; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; #[derive(Debug)] pub struct InvalidErrorCode; #[derive(Clone)] pub struct Registry { - long_descriptions: FxHashMap, + long_descriptions: GxHashMap, } impl Registry { diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index d8e6d3525da8a..4d8f74558d76e 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -10,7 +10,7 @@ use rustc_ast::tokenstream::TokenStream; use rustc_ast::visit::{AssocCtxt, Visitor}; use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, Item, NodeId, PatKind}; use rustc_attr::{self as attr, Deprecation, Stability}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::{self, Lrc}; use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, PResult}; use rustc_feature::Features; @@ -1139,7 +1139,7 @@ pub struct ExtCtxt<'a> { /// Error recovery mode entered when expansion is stuck /// (or during eager expansion, but that's a hack). pub force_mode: bool, - pub expansions: FxIndexMap>, + pub expansions: GxIndexMap>, /// Used for running pre-expansion lints on freshly loaded modules. pub(super) lint_store: LintStoreExpandDyn<'a>, /// Used for storing lints generated during expansion, like `NAMED_ARGUMENTS_USED_POSITIONALLY` @@ -1174,7 +1174,7 @@ impl<'a> ExtCtxt<'a> { is_trailing_mac: false, }, force_mode: false, - expansions: FxIndexMap::default(), + expansions: GxIndexMap::default(), expanded_inert_attrs: MarkedAttrs::new(), buffered_early_lint: vec![], } diff --git a/compiler/rustc_expand/src/mbe/macro_check.rs b/compiler/rustc_expand/src/mbe/macro_check.rs index 56ef609612ac0..b497e9ac2966d 100644 --- a/compiler/rustc_expand/src/mbe/macro_check.rs +++ b/compiler/rustc_expand/src/mbe/macro_check.rs @@ -110,7 +110,7 @@ use crate::mbe::{KleeneToken, TokenTree}; use rustc_ast::token::{Delimiter, IdentIsRaw, Token, TokenKind}; use rustc_ast::{NodeId, DUMMY_NODE_ID}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::MultiSpan; use rustc_lint_defs::BuiltinLintDiag; use rustc_session::lint::builtin::{META_VARIABLE_MISUSE, MISSING_FRAGMENT_SPECIFIER}; @@ -182,7 +182,7 @@ struct BinderInfo { } /// An environment of meta-variables to their binder information. -type Binders = FxHashMap; +type Binders = GxHashMap; /// The state at which we entered a macro definition in the RHS of another macro definition. struct MacroState<'a> { diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs index 2fbd09fd9ae20..67cbb701e2ae0 100644 --- a/compiler/rustc_expand/src/mbe/macro_parser.rs +++ b/compiler/rustc_expand/src/mbe/macro_parser.rs @@ -77,7 +77,7 @@ use crate::mbe::{macro_rules::Tracker, KleeneOp, TokenTree}; use rustc_ast::token::{self, DocComment, NonterminalKind, Token}; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::ErrorGuaranteed; use rustc_lint_defs::pluralize; use rustc_parse::parser::{ParseNtResult, Parser}; @@ -325,7 +325,7 @@ pub(crate) type NamedParseResult = ParseResult; /// Contains a mapping of `MacroRulesNormalizedIdent`s to `NamedMatch`es. /// This represents the mapping of metavars to the token trees they bind to. -pub(crate) type NamedMatches = FxHashMap; +pub(crate) type NamedMatches = GxHashMap; /// Count how many metavars declarations are in `matcher`. pub(super) fn count_metavar_decls(matcher: &[TokenTree]) -> usize { @@ -743,7 +743,7 @@ impl TtParser { ) -> NamedParseResult { // Make that each metavar has _exactly one_ binding. If so, insert the binding into the // `NamedParseResult`. Otherwise, it's an error. - let mut ret_val = FxHashMap::default(); + let mut ret_val = GxHashMap::default(); for loc in matcher { if let &MatcherLoc::MetaVarDecl { span, bind, kind, .. } = loc { if kind.is_some() { diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index e43ba7c3a5a8f..b7f77dec134c8 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -17,7 +17,7 @@ use rustc_ast::tokenstream::{DelimSpan, TokenStream}; use rustc_ast::{NodeId, DUMMY_NODE_ID}; use rustc_ast_pretty::pprust; use rustc_attr::{self as attr, TransparencyError}; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_errors::{Applicability, ErrorGuaranteed}; use rustc_feature::Features; use rustc_lint_defs::builtin::{ @@ -141,7 +141,7 @@ impl TTMacroExpander for DummyExpander { } } -fn trace_macros_note(cx_expansions: &mut FxIndexMap>, sp: Span, message: String) { +fn trace_macros_note(cx_expansions: &mut GxIndexMap>, sp: Span, message: String) { let sp = sp.macro_backtrace().last().map_or(sp, |trace| trace.call_site); cx_expansions.entry(sp).or_default().push(message); } @@ -739,14 +739,14 @@ struct FirstSets<'tt> { // If two sequences have the same span in a matcher, then map that // span to None (invalidating the mapping here and forcing the code to // use a slow path). - first: FxHashMap>>, + first: GxHashMap>>, } impl<'tt> FirstSets<'tt> { fn new(tts: &'tt [mbe::TokenTree]) -> FirstSets<'tt> { use mbe::TokenTree; - let mut sets = FirstSets { first: FxHashMap::default() }; + let mut sets = FirstSets { first: GxHashMap::default() }; build_recur(&mut sets, tts); return sets; diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs index f935f1b77e0b2..cd4b2958ecce0 100644 --- a/compiler/rustc_expand/src/mbe/transcribe.rs +++ b/compiler/rustc_expand/src/mbe/transcribe.rs @@ -9,7 +9,7 @@ use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast::token::IdentIsRaw; use rustc_ast::token::{self, Delimiter, Token, TokenKind}; use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{pluralize, Diag, DiagCtxtHandle, PResult}; use rustc_parse::parser::ParseNtResult; use rustc_session::parse::ParseSess; @@ -20,7 +20,7 @@ use smallvec::{smallvec, SmallVec}; use std::mem; // A Marker adds the given mark to the syntax context. -struct Marker(LocalExpnId, Transparency, FxHashMap); +struct Marker(LocalExpnId, Transparency, GxHashMap); impl MutVisitor for Marker { const VISIT_TOKENS: bool = true; @@ -101,7 +101,7 @@ impl<'a> Iterator for Frame<'a> { /// Along the way, we do some additional error checking. pub(super) fn transcribe<'a>( psess: &'a ParseSess, - interp: &FxHashMap, + interp: &GxHashMap, src: &mbe::Delimited, src_span: DelimSpan, transparency: Transparency, @@ -395,7 +395,7 @@ fn maybe_use_metavar_location( return orig_tt.clone(); } - let insert = |mspans: &mut FxHashMap<_, _>, s, ms| match mspans.try_insert(s, ms) { + let insert = |mspans: &mut GxHashMap<_, _>, s, ms| match mspans.try_insert(s, ms) { Ok(_) => true, Err(err) => *err.entry.get() == ms, // Tried to insert the same span, still success }; @@ -442,7 +442,7 @@ fn maybe_use_metavar_location( /// made a mistake, and we return `None`. fn lookup_cur_matched<'a>( ident: MacroRulesNormalizedIdent, - interpolations: &'a FxHashMap, + interpolations: &'a GxHashMap, repeats: &[(usize, usize)], ) -> Option<&'a NamedMatch> { interpolations.get(&ident).map(|mut matched| { @@ -519,7 +519,7 @@ impl LockstepIterSize { /// `y`; otherwise, we can't transcribe them both at the given depth. fn lockstep_iter_size( tree: &mbe::TokenTree, - interpolations: &FxHashMap, + interpolations: &GxHashMap, repeats: &[(usize, usize)], ) -> LockstepIterSize { use mbe::TokenTree; @@ -634,7 +634,7 @@ fn count_repetitions<'a>( fn matched_from_ident<'ctx, 'interp, 'rslt>( dcx: DiagCtxtHandle<'ctx>, ident: Ident, - interp: &'interp FxHashMap, + interp: &'interp GxHashMap, ) -> PResult<'ctx, &'rslt NamedMatch> where 'interp: 'rslt, @@ -664,7 +664,7 @@ fn out_of_bounds_err<'a>(dcx: DiagCtxtHandle<'a>, max: usize, span: Span, ty: &s fn transcribe_metavar_expr<'a>( dcx: DiagCtxtHandle<'a>, expr: &MetaVarExpr, - interp: &FxHashMap, + interp: &GxHashMap, marker: &mut Marker, repeats: &[(usize, usize)], result: &mut Vec, @@ -732,7 +732,7 @@ fn transcribe_metavar_expr<'a>( fn extract_ident<'a>( dcx: DiagCtxtHandle<'a>, ident: Ident, - interp: &FxHashMap, + interp: &GxHashMap, ) -> PResult<'a, String> { if let NamedMatch::MatchedSingle(pnr) = matched_from_ident(dcx, ident, interp)? { if let ParseNtResult::Ident(nt_ident, is_raw) = pnr { diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs index e21f041d69afd..0a97736fe5dd3 100644 --- a/compiler/rustc_expand/src/placeholders.rs +++ b/compiler/rustc_expand/src/placeholders.rs @@ -3,7 +3,7 @@ use rustc_ast as ast; use rustc_ast::mut_visit::*; use rustc_ast::ptr::P; use rustc_ast::token::Delimiter; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_span::symbol::Ident; use rustc_span::DUMMY_SP; use smallvec::{smallvec, SmallVec}; @@ -190,7 +190,7 @@ pub(crate) fn placeholder( #[derive(Default)] pub struct PlaceholderExpander { - expanded_fragments: FxHashMap, + expanded_fragments: GxHashMap, } impl PlaceholderExpander { diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 5508358f53bb2..98e11e13d7843 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -9,7 +9,7 @@ use rustc_ast::token; use rustc_ast::tokenstream::{self, DelimSpacing, Spacing, TokenStream}; use rustc_ast::util::literal::escape_byte_str_symbol; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lrc; use rustc_errors::{Diag, ErrorGuaranteed, MultiSpan, PResult}; use rustc_parse::lexer::nfc_normalize; @@ -420,7 +420,7 @@ pub(crate) struct Rustc<'a, 'b> { call_site: Span, mixed_site: Span, krate: CrateNum, - rebased_spans: FxHashMap, + rebased_spans: GxHashMap, } impl<'a, 'b> Rustc<'a, 'b> { @@ -431,7 +431,7 @@ impl<'a, 'b> Rustc<'a, 'b> { call_site: ecx.with_call_site_ctxt(expn_data.call_site), mixed_site: ecx.with_mixed_site_ctxt(expn_data.call_site), krate: expn_data.macro_def_id.unwrap().krate, - rebased_spans: FxHashMap::default(), + rebased_spans: GxHashMap::default(), ecx, } } diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 32a047a9363ed..5a4be582119e9 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -6,7 +6,7 @@ use AttributeType::*; use crate::{Features, Stability}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_span::symbol::{sym, Symbol}; use std::sync::LazyLock; @@ -1155,9 +1155,9 @@ pub fn is_valid_for_get_attr(name: Symbol) -> bool { }) } -pub static BUILTIN_ATTRIBUTE_MAP: LazyLock> = +pub static BUILTIN_ATTRIBUTE_MAP: LazyLock> = LazyLock::new(|| { - let mut map = FxHashMap::default(); + let mut map = GxHashMap::default(); for attr in BUILTIN_ATTRIBUTES.iter() { if map.insert(attr.name, attr).is_some() { panic!("duplicate builtin attribute `{}`", attr.name); diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index f4e20328814d7..faf780afa74fd 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -2,7 +2,7 @@ use super::{to_nonzero, Feature}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; @@ -60,7 +60,7 @@ macro_rules! declare_features { /// "declared" here means that the feature is actually enabled in the current crate. pub declared_lib_features: Vec<(Symbol, Span)>, /// `declared_lang_features` + `declared_lib_features`. - pub declared_features: FxHashSet, + pub declared_features: GxHashSet, /// Active state of individual features (unstable only). $( $(#[doc = $doc])* diff --git a/compiler/rustc_hir/src/diagnostic_items.rs b/compiler/rustc_hir/src/diagnostic_items.rs index d4d09f9a4e06b..a52a736fdc465 100644 --- a/compiler/rustc_hir/src/diagnostic_items.rs +++ b/compiler/rustc_hir/src/diagnostic_items.rs @@ -1,5 +1,5 @@ use crate::def_id::DefId; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_span::def_id::DefIdMap; use rustc_span::Symbol; @@ -7,7 +7,7 @@ use rustc_span::Symbol; #[derive(Debug, Default)] pub struct DiagnosticItems { pub id_to_name: DefIdMap, - pub name_to_id: FxIndexMap, + pub name_to_id: GxIndexMap, } impl HashStable for DiagnosticItems { diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index e13ea1a1935b4..1719d285f1701 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -1539,7 +1539,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD // `Sized` bounds. If they came last for example, this would break `Trait + /*elab*/Sized` // since it would overwrite the span of the user-written bound. This could be fixed by // folding the spans with `Span::to` which requires a bit of effort I think. - .collect::>() + .collect::>() }); let mut params_used = BitSet::new_empty(generics.own_params.len()); @@ -1621,7 +1621,7 @@ fn opaque_type_cycle_error( } err.help("this error will resolve once the item's body returns a concrete type"); } else { - let mut seen = FxHashSet::default(); + let mut seen = GxHashSet::default(); seen.insert(span); err.span_label(span, "recursive opaque type"); label = true; diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index 7fa5c96bc9ab4..12ee47c5c81af 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -2,7 +2,7 @@ use super::potentially_plural_count; use crate::errors::{LifetimesOrBoundsMismatchOnTrait, MethodShouldReturnFuture}; use core::ops::ControlFlow; use hir::def_id::{DefId, DefIdMap, LocalDefId}; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -260,7 +260,7 @@ fn compare_method_predicate_entailment<'tcx>( // type. // Compute placeholder form of impl and trait method tys. - let mut wf_tys = FxIndexSet::default(); + let mut wf_tys = GxIndexSet::default(); let unnormalized_impl_sig = infcx.instantiate_binder_with_fresh_vars( impl_m_span, @@ -332,7 +332,7 @@ fn compare_method_predicate_entailment<'tcx>( unnormalized_impl_sig.inputs_and_output.iter().map(|ty| ty.into()).collect(); // Annoyingly, asking for the WF predicates of an array (with an unevaluated const (only?)) // will give back the well-formed predicate of the same array. - let mut wf_args_seen: FxHashSet<_> = wf_args.iter().copied().collect(); + let mut wf_args_seen: GxHashSet<_> = wf_args.iter().copied().collect(); while let Some(arg) = wf_args.pop() { let Some(obligations) = rustc_trait_selection::traits::wf::obligations( infcx, @@ -393,7 +393,7 @@ fn compare_method_predicate_entailment<'tcx>( struct RemapLateBound<'a, 'tcx> { tcx: TyCtxt<'tcx>, - mapping: &'a FxIndexMap, + mapping: &'a GxIndexMap, } impl<'tcx> TypeFolder> for RemapLateBound<'_, 'tcx> { @@ -546,7 +546,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>( // prove below that the hidden types are well formed. let universe = infcx.create_next_universe(); let mut idx = 0; - let mapping: FxIndexMap<_, _> = collector + let mapping: GxIndexMap<_, _> = collector .types .iter() .map(|(_, &(ty, _))| { @@ -577,7 +577,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>( lt_op: |lt| lt, ct_op: |ct| ct, }; - let wf_tys = FxIndexSet::from_iter( + let wf_tys = GxIndexSet::from_iter( unnormalized_trait_sig .inputs_and_output .iter() @@ -689,7 +689,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>( // contains `def_id`'s early-bound regions. let id_args = GenericArgs::identity_for_item(tcx, def_id); debug!(?id_args, ?args); - let map: FxIndexMap<_, _> = std::iter::zip(args, id_args) + let map: GxIndexMap<_, _> = std::iter::zip(args, id_args) .skip(tcx.generics_of(trait_m.def_id).count()) .filter_map(|(a, b)| Some((a.as_region()?, b.as_region()?))) .collect(); @@ -766,7 +766,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>( struct ImplTraitInTraitCollector<'a, 'tcx, E> { ocx: &'a ObligationCtxt<'a, 'tcx, E>, - types: FxIndexMap, ty::GenericArgsRef<'tcx>)>, + types: GxIndexMap, ty::GenericArgsRef<'tcx>)>, span: Span, param_env: ty::ParamEnv<'tcx>, body_id: LocalDefId, @@ -782,7 +782,7 @@ where param_env: ty::ParamEnv<'tcx>, body_id: LocalDefId, ) -> Self { - ImplTraitInTraitCollector { ocx, types: FxIndexMap::default(), span, param_env, body_id } + ImplTraitInTraitCollector { ocx, types: GxIndexMap::default(), span, param_env, body_id } } } @@ -841,7 +841,7 @@ where struct RemapHiddenTyRegions<'tcx> { tcx: TyCtxt<'tcx>, - map: FxIndexMap, ty::Region<'tcx>>, + map: GxIndexMap, ty::Region<'tcx>>, num_trait_args: usize, num_impl_args: usize, def_id: DefId, diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs index ad3324f79e271..91b060135505e 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_infer::infer::{outlives::env::OutlivesEnvironment, TyCtxtInferExt}; @@ -63,7 +63,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( return; }; - let mut collector = ImplTraitInTraitCollector { tcx, types: FxIndexSet::default() }; + let mut collector = ImplTraitInTraitCollector { tcx, types: GxIndexSet::default() }; trait_m_sig.visit_with(&mut collector); // Bound that we find on RPITITs in the trait signature. @@ -149,7 +149,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( // possibly have introduced region vars during projection. We don't expect // this resolution to have incurred any region errors -- but if we do, then // just delay a bug. - let mut implied_wf_types = FxIndexSet::default(); + let mut implied_wf_types = GxIndexSet::default(); implied_wf_types.extend(trait_m_sig.inputs_and_output); implied_wf_types.extend(ocx.normalize( &ObligationCause::dummy(), @@ -182,7 +182,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( // Also, We have to anonymize binders in these types because they may contain // `BrNamed` bound vars, which contain unique `DefId`s which correspond to syntax // locations that we don't care about when checking bound equality. - let trait_bounds = FxIndexSet::from_iter(trait_bounds.fold_with(&mut Anonymize { tcx })); + let trait_bounds = GxIndexSet::from_iter(trait_bounds.fold_with(&mut Anonymize { tcx })); let impl_bounds = impl_bounds.fold_with(&mut Anonymize { tcx }); // Find any clauses that are present in the impl's RPITITs that are not @@ -207,7 +207,7 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>( struct ImplTraitInTraitCollector<'tcx> { tcx: TyCtxt<'tcx>, - types: FxIndexSet>, + types: GxIndexSet>, } impl<'tcx> TypeVisitor> for ImplTraitInTraitCollector<'tcx> { diff --git a/compiler/rustc_hir_analysis/src/check/dropck.rs b/compiler/rustc_hir_analysis/src/check/dropck.rs index 1937144802554..a2aeea37c95dc 100644 --- a/compiler/rustc_hir_analysis/src/check/dropck.rs +++ b/compiler/rustc_hir_analysis/src/check/dropck.rs @@ -2,7 +2,7 @@ // // We don't do any drop checking during hir typeck. -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed}; use rustc_infer::infer::outlives::env::OutlivesEnvironment; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; @@ -154,7 +154,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( let errors = ocx.select_all_or_error(); if !errors.is_empty() { let mut guar = None; - let mut root_predicates = FxHashSet::default(); + let mut root_predicates = GxHashSet::default(); for error in errors { let root_predicate = error.root_obligation.predicate; if root_predicates.insert(root_predicate) { diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs index 2e965c59ebb53..0f4597e053934 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs @@ -1,5 +1,5 @@ use rustc_ast::InlineAsmTemplatePiece; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir::{self as hir, LangItem}; use rustc_middle::bug; use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, UintTy}; @@ -127,7 +127,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { template: &[InlineAsmTemplatePiece], is_input: bool, tied_input: Option<(&'tcx hir::Expr<'tcx>, Option)>, - target_features: &FxIndexSet, + target_features: &GxIndexSet, ) -> Option { let ty = (self.get_operand_ty)(expr); if ty.has_non_region_infer() { diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 8469cbbbc7d61..be945a9719649 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -76,7 +76,7 @@ pub use check::check_abi; use std::num::NonZero; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_errors::ErrorGuaranteed; use rustc_errors::{pluralize, struct_span_code_err, Diag}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -325,7 +325,7 @@ fn bounds_from_generic_predicates<'tcx>( tcx: TyCtxt<'tcx>, predicates: impl IntoIterator, Span)>, ) -> (String, String) { - let mut types: FxIndexMap, Vec> = FxIndexMap::default(); + let mut types: GxIndexMap, Vec> = GxIndexMap::default(); let mut projections = vec![]; for (predicate, _) in predicates { debug!("predicate {:?}", predicate); diff --git a/compiler/rustc_hir_analysis/src/check/region.rs b/compiler/rustc_hir_analysis/src/check/region.rs index 2b5efd3b2f6f9..1b461818dc149 100644 --- a/compiler/rustc_hir_analysis/src/check/region.rs +++ b/compiler/rustc_hir_analysis/src/check/region.rs @@ -6,7 +6,7 @@ //! //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/borrow_check.html -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{self, Visitor}; @@ -67,7 +67,7 @@ struct RegionResolutionVisitor<'tcx> { /// arbitrary amounts of stack space. Terminating scopes end /// up being contained in a DestructionScope that contains the /// destructor's execution. - terminating_scopes: FxHashSet, + terminating_scopes: GxHashSet, } /// Records the lifetime of a local variable as `cx.var_parent` diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index a188c1b12aeb6..0390906518e25 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -6,7 +6,7 @@ use crate::fluent_generated as fluent; use hir::intravisit::Visitor; use rustc_ast as ast; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexSet}; use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -404,7 +404,7 @@ fn check_trait_item<'tcx>( /// ``` fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) { // Associates every GAT's def_id to a list of possibly missing bounds detected by this lint. - let mut required_bounds_by_item = FxHashMap::default(); + let mut required_bounds_by_item = GxHashMap::default(); let associated_items = tcx.associated_items(trait_def_id); // Loop over all GATs together, because if this lint suggests adding a where-clause bound @@ -430,7 +430,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) { // Gather the bounds with which all other items inside of this trait constrain the GAT. // This is calculated by taking the intersection of the bounds that each item // constrains the GAT with individually. - let mut new_required_bounds: Option>> = None; + let mut new_required_bounds: Option>> = None; for item in associated_items.in_definition_order() { let item_def_id = item.def_id.expect_local(); // Skip our own GAT, since it does not constrain itself at all. @@ -479,7 +479,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) { tcx.explicit_item_bounds(item_def_id) .instantiate_identity_iter_copied() .collect::>(), - &FxIndexSet::default(), + &GxIndexSet::default(), gat_def_id, gat_generics, ) @@ -537,13 +537,13 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) { tcx, gat_def_id, param_env, - &FxIndexSet::default(), + &GxIndexSet::default(), a, b, ) } ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(a, b)) => { - !ty_known_to_outlive(tcx, gat_def_id, param_env, &FxIndexSet::default(), a, b) + !ty_known_to_outlive(tcx, gat_def_id, param_env, &GxIndexSet::default(), a, b) } _ => bug!("Unexpected ClauseKind"), }) @@ -589,7 +589,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) { fn augment_param_env<'tcx>( tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, - new_predicates: Option<&FxHashSet>>, + new_predicates: Option<&GxHashSet>>, ) -> ty::ParamEnv<'tcx> { let Some(new_predicates) = new_predicates else { return param_env; @@ -622,12 +622,12 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable>>( param_env: ty::ParamEnv<'tcx>, item_def_id: LocalDefId, to_check: T, - wf_tys: &FxIndexSet>, + wf_tys: &GxIndexSet>, gat_def_id: LocalDefId, gat_generics: &'tcx ty::Generics, -) -> Option>> { +) -> Option>> { // The bounds we that we would require from `to_check` - let mut bounds = FxHashSet::default(); + let mut bounds = GxHashSet::default(); let (regions, types) = GATArgsCollector::visit(gat_def_id.to_def_id(), to_check); @@ -724,7 +724,7 @@ fn ty_known_to_outlive<'tcx>( tcx: TyCtxt<'tcx>, id: LocalDefId, param_env: ty::ParamEnv<'tcx>, - wf_tys: &FxIndexSet>, + wf_tys: &GxIndexSet>, ty: Ty<'tcx>, region: ty::Region<'tcx>, ) -> bool { @@ -743,7 +743,7 @@ fn region_known_to_outlive<'tcx>( tcx: TyCtxt<'tcx>, id: LocalDefId, param_env: ty::ParamEnv<'tcx>, - wf_tys: &FxIndexSet>, + wf_tys: &GxIndexSet>, region_a: ty::Region<'tcx>, region_b: ty::Region<'tcx>, ) -> bool { @@ -759,7 +759,7 @@ fn test_region_obligations<'tcx>( tcx: TyCtxt<'tcx>, id: LocalDefId, param_env: ty::ParamEnv<'tcx>, - wf_tys: &FxIndexSet>, + wf_tys: &GxIndexSet>, add_constraints: impl FnOnce(&InferCtxt<'tcx>), ) -> bool { // Unfortunately, we have to use a new `InferCtxt` each call, because @@ -789,18 +789,18 @@ fn test_region_obligations<'tcx>( struct GATArgsCollector<'tcx> { gat: DefId, // Which region appears and which parameter index its instantiated with - regions: FxHashSet<(ty::Region<'tcx>, usize)>, + regions: GxHashSet<(ty::Region<'tcx>, usize)>, // Which params appears and which parameter index its instantiated with - types: FxHashSet<(Ty<'tcx>, usize)>, + types: GxHashSet<(Ty<'tcx>, usize)>, } impl<'tcx> GATArgsCollector<'tcx> { fn visit>>( gat: DefId, t: T, - ) -> (FxHashSet<(ty::Region<'tcx>, usize)>, FxHashSet<(Ty<'tcx>, usize)>) { + ) -> (GxHashSet<(ty::Region<'tcx>, usize)>, GxHashSet<(Ty<'tcx>, usize)>) { let mut visitor = - GATArgsCollector { gat, regions: FxHashSet::default(), types: FxHashSet::default() }; + GATArgsCollector { gat, regions: GxHashSet::default(), types: GxHashSet::default() }; t.visit_with(&mut visitor); (visitor.regions, visitor.types) } @@ -1477,7 +1477,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id .flat_map(|&(pred, sp)| { #[derive(Default)] struct CountParams { - params: FxHashSet, + params: GxHashSet, } impl<'tcx> ty::visit::TypeVisitor> for CountParams { type Result = ControlFlow<()>; @@ -1831,7 +1831,7 @@ fn check_variances_for_type_defn<'tcx>( assert_eq!(ty_predicates.parent, None); let variances = tcx.variances_of(item.owner_id); - let mut constrained_parameters: FxHashSet<_> = variances + let mut constrained_parameters: GxHashSet<_> = variances .iter() .enumerate() .filter(|&(_, &variance)| variance != ty::Bivariant) @@ -1855,7 +1855,7 @@ fn check_variances_for_type_defn<'tcx>( } _ => None, }) - .collect::>() + .collect::>() }); let ty_generics = tcx.generics_of(item.owner_id); @@ -2068,7 +2068,7 @@ fn lint_redundant_lifetimes<'tcx>( // Keep track of lifetimes which have already been replaced with other lifetimes. // This makes sure that if `'a = 'b = 'c`, we don't say `'c` should be replaced by // both `'a` and `'b`. - let mut shadowed = FxHashSet::default(); + let mut shadowed = GxHashSet::default(); for (idx, &candidate) in lifetimes.iter().enumerate() { // Don't suggest removing a lifetime twice. We only need to check this diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 61adb7a3cbaeb..07ddc44facd31 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -3,7 +3,7 @@ use crate::errors; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{ErrorGuaranteed, MultiSpan}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -517,7 +517,7 @@ fn infringing_fields_error( let mut errors: BTreeMap<_, Vec<_>> = Default::default(); let mut bounds = vec![]; - let mut seen_tys = FxHashSet::default(); + let mut seen_tys = GxHashSet::default(); let mut label_spans = Vec::new(); diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs index 3aef29f4ae4dd..78ffa66d0ffe9 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs @@ -1,5 +1,5 @@ -use rustc_data_structures::fx::IndexEntry; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::IndexEntry; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -68,7 +68,7 @@ impl<'tcx> InherentOverlapChecker<'tcx> { fn check_for_duplicate_items_in_impl(&self, impl_: DefId) -> Result<(), ErrorGuaranteed> { let impl_items = self.tcx.associated_items(impl_); - let mut seen_items = FxIndexMap::default(); + let mut seen_items = GxIndexMap::default(); let mut res = Ok(()); for impl_item in impl_items.in_definition_order() { let span = self.tcx.def_span(impl_item.def_id); @@ -212,11 +212,11 @@ impl<'tcx> InherentOverlapChecker<'tcx> { struct ConnectedRegion { idents: SmallVec<[Symbol; 8]>, - impl_blocks: FxHashSet, + impl_blocks: GxHashSet, } let mut connected_regions: IndexVec = Default::default(); // Reverse map from the Symbol to the connected region id. - let mut connected_region_ids = FxIndexMap::default(); + let mut connected_region_ids = GxIndexMap::default(); for (i, &(&_impl_def_id, impl_items)) in impls_items.iter().enumerate() { if impl_items.len() == 0 { diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index 5cb91603fd067..f716e435a6647 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -3,7 +3,7 @@ use crate::errors; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::ErrorGuaranteed; use rustc_infer::infer::{InferCtxt, TyCtxtInferExt}; use rustc_lint_defs::builtin::UNCOVERED_PARAM_IN_PROJECTION; @@ -286,7 +286,7 @@ fn orphan_check<'tcx>( tcx: TyCtxt<'tcx>, impl_def_id: LocalDefId, mode: OrphanCheckMode, -) -> Result<(), OrphanCheckErr<'tcx, FxIndexSet>> { +) -> Result<(), OrphanCheckErr<'tcx, GxIndexSet>> { // We only accept this routine to be invoked on implementations // of a trait, not inherent implementations. let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); @@ -369,7 +369,7 @@ fn emit_orphan_check_error<'tcx>( tcx: TyCtxt<'tcx>, trait_ref: ty::TraitRef<'tcx>, impl_def_id: LocalDefId, - err: traits::OrphanCheckErr<'tcx, FxIndexSet>, + err: traits::OrphanCheckErr<'tcx, GxIndexSet>, ) -> ErrorGuaranteed { match err { traits::OrphanCheckErr::NonLocalInputType(tys) => { @@ -482,7 +482,7 @@ fn emit_orphan_check_error<'tcx>( fn lint_uncovered_ty_params<'tcx>( tcx: TyCtxt<'tcx>, - UncoveredTyParams { uncovered, local_ty }: UncoveredTyParams<'tcx, FxIndexSet>, + UncoveredTyParams { uncovered, local_ty }: UncoveredTyParams<'tcx, GxIndexSet>, impl_def_id: LocalDefId, ) { let hir_id = tcx.local_def_id_to_hir_id(impl_def_id); @@ -510,7 +510,7 @@ fn lint_uncovered_ty_params<'tcx>( struct UncoveredTyParamCollector<'cx, 'tcx> { infcx: &'cx InferCtxt<'tcx>, - uncovered_params: FxIndexSet, + uncovered_params: GxIndexSet, } impl<'tcx> TypeVisitor> for UncoveredTyParamCollector<'_, 'tcx> { diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index e7892f1766067..275f131e67bbf 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -16,7 +16,7 @@ use rustc_ast::Recovered; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_data_structures::unord::UnordMap; use rustc_errors::{struct_span_code_err, Applicability, Diag, ErrorGuaranteed, StashKey, E0228}; use rustc_hir::def::DefKind; @@ -620,7 +620,7 @@ fn get_new_lifetime_name<'tcx>( None } })) - .collect::>(); + .collect::>(); let a_to_z_repeat_n = |n| { (b'a'..=b'z').map(move |c| { @@ -929,12 +929,12 @@ impl From for FieldDeclSpan { struct FieldUniquenessCheckContext<'tcx> { tcx: TyCtxt<'tcx>, - seen_fields: FxIndexMap, + seen_fields: GxIndexMap, } impl<'tcx> FieldUniquenessCheckContext<'tcx> { fn new(tcx: TyCtxt<'tcx>) -> Self { - Self { tcx, seen_fields: FxIndexMap::default() } + Self { tcx, seen_fields: GxIndexMap::default() } } /// Check if a given field `ident` declared at `field_decl` has been declared elsewhere before. diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index d084d3aefeb17..6b8c119260b57 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -1,6 +1,6 @@ use super::ItemCtxt; use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir as hir; use rustc_infer::traits::util; use rustc_middle::ty::GenericArgs; @@ -187,8 +187,8 @@ pub(super) fn item_non_self_assumptions( tcx: TyCtxt<'_>, def_id: DefId, ) -> ty::EarlyBinder<'_, ty::Clauses<'_>> { - let all_bounds: FxIndexSet<_> = tcx.item_bounds(def_id).skip_binder().iter().collect(); - let own_bounds: FxIndexSet<_> = + let all_bounds: GxIndexSet<_> = tcx.item_bounds(def_id).skip_binder().iter().collect(); + let own_bounds: GxIndexSet<_> = tcx.item_super_predicates(def_id).skip_binder().iter().collect(); if all_bounds.len() == own_bounds.len() { ty::EarlyBinder::bind(ty::ListWithCachedTypeInfo::empty()) diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 3421c8da4e9f3..ebe97820946be 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -3,7 +3,7 @@ use crate::collect::ItemCtxt; use crate::constrained_generic_params as cgp; use crate::hir_ty_lowering::{HirTyLowerer, OnlySelfBounds, PredicateFilter, RegionInferReason}; use hir::{HirId, Node}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -123,7 +123,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen // We use an `IndexSet` to preserve order of insertion. // Preserving the order of insertion is important here so as not to break UI tests. - let mut predicates: FxIndexSet<(ty::Clause<'_>, Span)> = FxIndexSet::default(); + let mut predicates: GxIndexSet<(ty::Clause<'_>, Span)> = GxIndexSet::default(); let hir_generics = node.generics().unwrap_or(NO_GENERICS); if let Node::Item(item) = node { @@ -344,10 +344,10 @@ fn compute_bidirectional_outlives_predicates<'tcx>( fn const_evaluatable_predicates_of( tcx: TyCtxt<'_>, def_id: LocalDefId, -) -> FxIndexSet<(ty::Clause<'_>, Span)> { +) -> GxIndexSet<(ty::Clause<'_>, Span)> { struct ConstCollector<'tcx> { tcx: TyCtxt<'tcx>, - preds: FxIndexSet<(ty::Clause<'tcx>, Span)>, + preds: GxIndexSet<(ty::Clause<'tcx>, Span)>, } impl<'tcx> intravisit::Visitor<'tcx> for ConstCollector<'tcx> { @@ -373,7 +373,7 @@ fn const_evaluatable_predicates_of( let hir_id = tcx.local_def_id_to_hir_id(def_id); let node = tcx.hir_node(hir_id); - let mut collector = ConstCollector { tcx, preds: FxIndexSet::default() }; + let mut collector = ConstCollector { tcx, preds: GxIndexSet::default() }; if let hir::Node::Item(item) = node && let hir::ItemKind::Impl(impl_) = item.kind { diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index abc3bb838db3e..52753a62f32a3 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -8,7 +8,7 @@ use core::ops::ControlFlow; use rustc_ast::visit::walk_list; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::LocalDefId; @@ -99,7 +99,7 @@ enum Scope<'a> { Binder { /// We use an IndexMap here because we want these lifetimes in order /// for diagnostics. - bound_vars: FxIndexMap, + bound_vars: GxIndexMap, scope_type: BinderScopeType, @@ -356,7 +356,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { let (mut binders, scope_type) = self.poly_trait_ref_binder_info(); let initial_bound_vars = binders.len() as u32; - let mut bound_vars: FxIndexMap = FxIndexMap::default(); + let mut bound_vars: GxIndexMap = GxIndexMap::default(); let binders_iter = trait_ref.bound_generic_params.iter().enumerate().map(|(late_bound_idx, param)| { let pair = ResolvedArg::late(initial_bound_vars + late_bound_idx as u32, param); @@ -452,7 +452,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { } } - let (mut bound_vars, binders): (FxIndexMap, Vec<_>) = + let (mut bound_vars, binders): (GxIndexMap, Vec<_>) = bound_generic_params .iter() .enumerate() @@ -521,7 +521,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { }) => { // We want to start our early-bound indices at the end of the parent scope, // not including any parent `impl Trait`s. - let mut bound_vars = FxIndexMap::default(); + let mut bound_vars = GxIndexMap::default(); debug!(?generics.params); for param in generics.params { let (def_id, reg) = ResolvedArg::early(param); @@ -621,7 +621,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) { match ty.kind { hir::TyKind::BareFn(c) => { - let (mut bound_vars, binders): (FxIndexMap, Vec<_>) = c + let (mut bound_vars, binders): (GxIndexMap, Vec<_>) = c .generic_params .iter() .enumerate() @@ -880,7 +880,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { origin, .. }) => { - let (bound_vars, binders): (FxIndexMap, Vec<_>) = + let (bound_vars, binders): (GxIndexMap, Vec<_>) = bound_generic_params .iter() .enumerate() @@ -1059,7 +1059,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { F: for<'b, 'c> FnOnce(&'b mut BoundVarContext<'c, 'tcx>), { let mut named_late_bound_vars = 0; - let bound_vars: FxIndexMap = generics + let bound_vars: GxIndexMap = generics .params .iter() .map(|param| match param.kind { @@ -1745,7 +1745,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { use smallvec::{smallvec, SmallVec}; let mut stack: SmallVec<[(DefId, SmallVec<[ty::BoundVariableKind; 8]>); 8]> = smallvec![(def_id, smallvec![])]; - let mut visited: FxHashSet = FxHashSet::default(); + let mut visited: GxHashSet = GxHashSet::default(); loop { let Some((def_id, bound_vars)) = stack.pop() else { break None; @@ -1871,11 +1871,11 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { fn is_late_bound_map( tcx: TyCtxt<'_>, owner_id: hir::OwnerId, -) -> Option<&FxIndexSet> { +) -> Option<&GxIndexSet> { let decl = tcx.hir().fn_decl_by_hir_id(owner_id.into())?; let generics = tcx.hir().get_generics(owner_id.def_id)?; - let mut late_bound = FxIndexSet::default(); + let mut late_bound = GxIndexSet::default(); let mut constrained_by_input = ConstrainedCollector { regions: Default::default(), tcx }; for arg_ty in decl.inputs { @@ -1978,7 +1978,7 @@ fn is_late_bound_map( struct ConstrainedCollector<'tcx> { tcx: TyCtxt<'tcx>, - regions: FxHashSet, + regions: GxHashSet, } impl<'v> Visitor<'v> for ConstrainedCollector<'_> { @@ -2059,7 +2059,7 @@ fn is_late_bound_map( #[derive(Default)] struct AllCollector { - regions: FxHashSet, + regions: GxHashSet, } impl<'v> Visitor<'v> for AllCollector { @@ -2073,7 +2073,7 @@ fn is_late_bound_map( pub fn deny_non_region_late_bound( tcx: TyCtxt<'_>, - bound_vars: &mut FxIndexMap, + bound_vars: &mut GxIndexMap, where_: &str, ) { let mut first = true; diff --git a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs index 620170164f535..112b630c6511c 100644 --- a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs +++ b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::bug; use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitor}; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -31,7 +31,7 @@ pub fn parameters_for_impl<'tcx>( tcx: TyCtxt<'tcx>, impl_self_ty: Ty<'tcx>, impl_trait_ref: Option>, -) -> FxHashSet { +) -> GxHashSet { let vec = match impl_trait_ref { Some(tr) => parameters_for(tcx, tr, false), None => parameters_for(tcx, impl_self_ty, false), @@ -106,7 +106,7 @@ pub fn identify_constrained_generic_params<'tcx>( tcx: TyCtxt<'tcx>, predicates: ty::GenericPredicates<'tcx>, impl_trait_ref: Option>, - input_parameters: &mut FxHashSet, + input_parameters: &mut GxHashSet, ) { let mut predicates = predicates.predicates.to_vec(); setup_constraining_predicates(tcx, &mut predicates, impl_trait_ref, input_parameters); @@ -160,7 +160,7 @@ pub fn setup_constraining_predicates<'tcx>( tcx: TyCtxt<'tcx>, predicates: &mut [(ty::Clause<'tcx>, Span)], impl_trait_ref: Option>, - input_parameters: &mut FxHashSet, + input_parameters: &mut GxHashSet, ) { // The canonical way of doing the needed topological sort // would be a DFS, but getting the graph and its ownership diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs index 802215b2843ee..60bd615a40a23 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs @@ -1,6 +1,6 @@ use std::ops::ControlFlow; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -250,7 +250,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { trait_ref: ty::PolyTraitRef<'tcx>, constraint: &hir::AssocItemConstraint<'tcx>, bounds: &mut Bounds<'tcx>, - duplicates: &mut FxIndexMap, + duplicates: &mut GxIndexMap, path_span: Span, only_self_bounds: OnlySelfBounds, ) -> Result<(), ErrorGuaranteed> { @@ -592,8 +592,8 @@ fn check_assoc_const_binding_type<'tcx>( struct GenericParamAndBoundVarCollector<'tcx> { tcx: TyCtxt<'tcx>, - params: FxIndexSet, - vars: FxIndexSet<(DefId, Symbol)>, + params: GxIndexSet, + vars: GxIndexSet<(DefId, Symbol)>, depth: ty::DebruijnIndex, } diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index 2d240699105d6..a4ca2f2507118 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -5,7 +5,7 @@ use crate::errors::{ use crate::fluent_generated as fluent; use crate::hir_ty_lowering::HirTyLowerer; use crate::traits::error_reporting::report_object_safety_error; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::unord::UnordMap; use rustc_errors::MultiSpan; @@ -701,7 +701,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { /// emit a generic note suggesting using a `where` clause to constraint instead. pub(crate) fn complain_about_missing_assoc_tys( &self, - associated_types: FxIndexMap>, + associated_types: GxIndexMap>, potential_assoc_types: Vec, trait_bounds: &[hir::PolyTraitRef<'_>], ) { @@ -712,13 +712,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let tcx = self.tcx(); // FIXME: Marked `mut` so that we can replace the spans further below with a more // appropriate one, but this should be handled earlier in the span assignment. - let mut associated_types: FxIndexMap> = associated_types + let mut associated_types: GxIndexMap> = associated_types .into_iter() .map(|(span, def_ids)| { (span, def_ids.into_iter().map(|did| tcx.associated_item(did)).collect()) }) .collect(); - let mut names: FxIndexMap> = Default::default(); + let mut names: GxIndexMap> = Default::default(); let mut names_len = 0; // Account for things like `dyn Foo + 'a`, like in tests `issue-22434.rs` and @@ -922,7 +922,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { if suggestions.len() != 1 || already_has_generics_args_suggestion { // We don't need this label if there's an inline suggestion, show otherwise. for (span, assoc_items) in &associated_types { - let mut names: FxIndexMap<_, usize> = FxIndexMap::default(); + let mut names: GxIndexMap<_, usize> = GxIndexMap::default(); for item in assoc_items { types_count += 1; *names.entry(item.name).or_insert(0) += 1; @@ -1041,7 +1041,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { Infer, } - let mut prohibit_args = FxIndexSet::default(); + let mut prohibit_args = GxIndexSet::default(); args_visitors.for_each(|arg| { match arg { hir::GenericArg::Lifetime(_) => prohibit_args.insert(ProhibitGenericsArg::Lifetime), diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 24ea328889c6b..22d73978b4483 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -26,7 +26,7 @@ use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_ar use crate::middle::resolve_bound_vars as rbv; use crate::require_c_abi_if_c_variadic; use rustc_ast::TraitObjectSyntax; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_errors::{ codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, FatalError, }; @@ -700,7 +700,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { debug!(?poly_trait_ref); bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); - let mut dup_constraints = FxIndexMap::default(); + let mut dup_constraints = GxIndexMap::default(); for constraint in trait_segment.args().constraints { // Don't register any associated item constraints for negative bounds, // since we should have emitted an error for them earlier, and they @@ -1752,7 +1752,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let generic_segments = self.probe_generic_path_segments(path.segments, None, kind, def_id, span); - let indices: FxHashSet<_> = + let indices: GxHashSet<_> = generic_segments.iter().map(|GenericPathSegment(_, index)| index).collect(); let _ = self.prohibit_generic_args( path.segments.iter().enumerate().filter_map(|(index, seg)| { @@ -2408,8 +2408,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { #[instrument(level = "trace", skip(self, generate_err))] fn validate_late_bound_regions( &self, - constrained_regions: FxHashSet, - referenced_regions: FxHashSet, + constrained_regions: GxHashSet, + referenced_regions: GxHashSet, generate_err: impl Fn(&str) -> Diag<'tcx>, ) { for br in referenced_regions.difference(&constrained_regions) { diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs index 34924f09d09ed..44b42272d36c2 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs @@ -2,7 +2,7 @@ use crate::bounds::Bounds; use crate::hir_ty_lowering::{ GenericArgCountMismatch, GenericArgCountResult, OnlySelfBounds, RegionInferReason, }; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -114,7 +114,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } } - let mut associated_types: FxIndexMap> = FxIndexMap::default(); + let mut associated_types: GxIndexMap> = GxIndexMap::default(); let regular_traits_refs_spans = trait_bounds .into_iter() @@ -205,9 +205,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { // De-duplicate auto traits so that, e.g., `dyn Trait + Send + Send` is the same as // `dyn Trait + Send`. - // We remove duplicates by inserting into a `FxHashSet` to avoid re-ordering + // We remove duplicates by inserting into a `GxHashSet` to avoid re-ordering // the bounds - let mut duplicates = FxHashSet::default(); + let mut duplicates = GxHashSet::default(); auto_traits.retain(|i| duplicates.insert(i.trait_ref().def_id())); debug!(?regular_traits); debug!(?auto_traits); diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check.rs b/compiler/rustc_hir_analysis/src/impl_wf_check.rs index 5cc1ec71757be..f215a7213915b 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check.rs @@ -11,7 +11,7 @@ use crate::constrained_generic_params as cgp; use min_specialization::check_min_specialization; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{codes::*, struct_span_code_err}; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; @@ -97,7 +97,7 @@ fn enforce_impl_params_are_constrained( ); // Disallow unconstrained lifetimes, but only if they appear in assoc types. - let lifetimes_in_associated_types: FxHashSet<_> = tcx + let lifetimes_in_associated_types: GxHashSet<_> = tcx .associated_item_def_ids(impl_def_id) .iter() .flat_map(|def_id| { diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index f3ce3ab66553e..6b729b05e8aa2 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -68,7 +68,7 @@ use crate::errors::GenericArgsOnOverriddenImpl; use crate::{constrained_generic_params as cgp, errors}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_infer::infer::outlives::env::OutlivesEnvironment; @@ -248,8 +248,8 @@ fn unconstrained_parent_impl_args<'tcx>( impl_args: GenericArgsRef<'tcx>, ) -> Vec> { let impl_generic_predicates = tcx.predicates_of(impl_def_id); - let mut unconstrained_parameters = FxHashSet::default(); - let mut constrained_params = FxHashSet::default(); + let mut unconstrained_parameters = GxHashSet::default(); + let mut constrained_params = GxHashSet::default(); let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).map(ty::EarlyBinder::instantiate_identity); // Unfortunately the functions in `constrained_generic_parameters` don't do diff --git a/compiler/rustc_hir_analysis/src/outlives/explicit.rs b/compiler/rustc_hir_analysis/src/outlives/explicit.rs index bbfadbb5c3087..945b49448fef7 100644 --- a/compiler/rustc_hir_analysis/src/outlives/explicit.rs +++ b/compiler/rustc_hir_analysis/src/outlives/explicit.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir::def_id::DefId; use rustc_middle::ty::{self, OutlivesPredicate, TyCtxt}; @@ -6,12 +6,12 @@ use super::utils::*; #[derive(Debug)] pub struct ExplicitPredicatesMap<'tcx> { - map: FxIndexMap>>, + map: GxIndexMap>>, } impl<'tcx> ExplicitPredicatesMap<'tcx> { pub fn new() -> ExplicitPredicatesMap<'tcx> { - ExplicitPredicatesMap { map: FxIndexMap::default() } + ExplicitPredicatesMap { map: GxIndexMap::default() } } pub(crate) fn explicit_predicates_of( diff --git a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs index af08f50f65596..a9132fa4cc826 100644 --- a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs +++ b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -15,12 +15,12 @@ use super::utils::*; /// now be filled with inferred predicates. pub(super) fn infer_predicates( tcx: TyCtxt<'_>, -) -> FxIndexMap>> { +) -> GxIndexMap>> { debug!("infer_predicates"); let mut explicit_map = ExplicitPredicatesMap::new(); - let mut global_inferred_outlives = FxIndexMap::default(); + let mut global_inferred_outlives = GxIndexMap::default(); // If new predicates were added then we need to re-calculate // all crates since there could be new implied predicates. @@ -101,7 +101,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, span: Span, - global_inferred_outlives: &FxIndexMap>>, + global_inferred_outlives: &GxIndexMap>>, required_predicates: &mut RequiredPredicates<'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>, ) { @@ -322,7 +322,7 @@ fn check_inferred_predicates<'tcx>( tcx: TyCtxt<'tcx>, def_id: DefId, args: ty::GenericArgsRef<'tcx>, - global_inferred_outlives: &FxIndexMap>>, + global_inferred_outlives: &GxIndexMap>>, required_predicates: &mut RequiredPredicates<'tcx>, ) { // Load the current set of inferred and explicit predicates from `global_inferred_outlives` diff --git a/compiler/rustc_hir_analysis/src/outlives/utils.rs b/compiler/rustc_hir_analysis/src/outlives/utils.rs index 5086c2af3f658..170ba7bf8ef12 100644 --- a/compiler/rustc_hir_analysis/src/outlives/utils.rs +++ b/compiler/rustc_hir_analysis/src/outlives/utils.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_infer::infer::outlives::components::{push_outlives_components, Component}; use rustc_middle::ty::{self, Region, Ty, TyCtxt}; use rustc_middle::ty::{GenericArg, GenericArgKind}; @@ -9,7 +9,7 @@ use smallvec::smallvec; /// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred /// must be added to the struct header. pub(crate) type RequiredPredicates<'tcx> = - FxIndexMap>, Span>; + GxIndexMap>, Span>; /// Given a requirement `T: 'a` or `'b: 'a`, deduce the /// outlives_component and add it to `required_predicates` diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index f4e1e46195345..fe02c713cd6bf 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -21,7 +21,7 @@ use crate::{ TupleArgumentsFlag::DontTupleArguments, }; use rustc_ast as ast; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::unord::UnordMap; use rustc_errors::{ @@ -1684,7 +1684,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .map(|(i, field)| (field.ident(tcx).normalize_to_macros_2_0(), (i, field))) .collect::>(); - let mut seen_fields = FxHashMap::default(); + let mut seen_fields = GxHashMap::default(); let mut error_happened = false; @@ -3140,7 +3140,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } fn point_at_index(&self, errors: &mut Vec>, span: Span) { - let mut seen_preds = FxHashSet::default(); + let mut seen_preds = GxHashSet::default(); // We re-sort here so that the outer most root obligations comes first, as we have the // subsequent weird logic to identify *every* relevant obligation for proper deduplication // of diagnostics. diff --git a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs index 0ba4bd090f5e2..bb92d7ef7c29e 100644 --- a/compiler/rustc_hir_typeck/src/expr_use_visitor.rs +++ b/compiler/rustc_hir_typeck/src/expr_use_visitor.rs @@ -13,7 +13,7 @@ use rustc_lint::LateContext; // Export these here so that Clippy can use them. pub use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir as hir; use rustc_hir::def::{CtorOf, Res}; use rustc_hir::def_id::LocalDefId; @@ -247,7 +247,7 @@ pub struct ExprUseVisitor<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx> /// We use a `RefCell` here so that delegates can mutate themselves, but we can /// still have calls to our own helper functions. delegate: RefCell, - upvars: Option<&'tcx FxIndexMap>, + upvars: Option<&'tcx GxIndexMap>, } impl<'a, 'tcx, D: Delegate<'tcx>> ExprUseVisitor<'tcx, (&'a LateContext<'tcx>, LocalDefId), D> { @@ -953,7 +953,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx /// closure as the DefId. fn walk_captures(&self, closure_expr: &hir::Closure<'_>) -> Result<(), Cx::Error> { fn upvar_is_local_variable( - upvars: Option<&FxIndexMap>, + upvars: Option<&GxIndexMap>, upvar_id: HirId, body_owner_is_closure: bool, ) -> bool { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 061afd0306230..b04b023100d5c 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -3,7 +3,7 @@ use crate::errors::{self, CtorIsPrivate}; use crate::method::{self, MethodCallee}; use crate::rvalue_scopes; use crate::{BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey}; use rustc_hir as hir; use rustc_hir::def::{CtorOf, DefKind, Res}; @@ -1099,7 +1099,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // provided (if any) into their appropriate spaces. We'll also report // errors if type parameters are provided in an inappropriate place. - let indices: FxHashSet<_> = + let indices: GxHashSet<_> = generic_segments.iter().map(|GenericPathSegment(_, index)| index).collect(); let generics_err = self.lowerer().prohibit_generic_args( segments.iter().enumerate().filter_map(|(index, seg)| { @@ -1147,7 +1147,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Err(GenericArgCountMismatch { reported, .. }) = arg_count.correct { infer_args_for_err - .get_or_insert_with(|| (reported, FxHashSet::default())) + .get_or_insert_with(|| (reported, GxHashSet::default())) .1 .insert(index); self.set_tainted_by_errors(reported); // See issue #53251. @@ -1257,7 +1257,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fcx: &'a FnCtxt<'a, 'tcx>, span: Span, generic_segments: &'a [GenericPathSegment], - infer_args_for_err: &'a FxHashSet, + infer_args_for_err: &'a GxHashSet, segments: &'tcx [hir::PathSegment<'tcx>], } impl<'tcx, 'a> GenericArgsLowerer<'a, 'tcx> for CtorGenericArgsCtxt<'a, 'tcx> { diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 1138642c56d61..c56d89355e2ef 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -15,7 +15,7 @@ use crate::{ }; use itertools::Itertools; use rustc_ast as ast; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{ a_or_an, codes::*, display_list_with_comma_and, pluralize, Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, @@ -2068,7 +2068,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // even if their `ObligationCauseCode` isn't an `Expr*Obligation` kind. // This is important since if we adjust one span but not the other, then // we will have "duplicated" the error on the UI side. - let mut remap_cause = FxIndexSet::default(); + let mut remap_cause = GxIndexSet::default(); let mut not_adjusted = vec![]; for error in errors { diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 9747a91ccbfad..e0ade99425188 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -4,7 +4,7 @@ use super::MethodError; use super::NoMatchData; use crate::FnCtxt; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -71,7 +71,7 @@ pub(crate) struct ProbeContext<'a, 'tcx> { inherent_candidates: Vec>, extension_candidates: Vec>, - impl_dups: FxHashSet, + impl_dups: GxHashSet, /// When probing for names, include names that are close to the /// requested name (by edit distance) @@ -581,7 +581,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { return_type, inherent_candidates: Vec::new(), extension_candidates: Vec::new(), - impl_dups: FxHashSet::default(), + impl_dups: GxHashSet::default(), orig_steps_var_values, steps, allow_similar_names: false, @@ -826,7 +826,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { #[instrument(level = "debug", skip(self))] fn assemble_extension_candidates_for_traits_in_scope(&mut self) { - let mut duplicates = FxHashSet::default(); + let mut duplicates = GxHashSet::default(); let opt_applicable_traits = self.tcx.in_scope_traits(self.scope_expr_id); if let Some(applicable_traits) = opt_applicable_traits { for trait_candidate in applicable_traits.iter() { @@ -843,7 +843,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { #[instrument(level = "debug", skip(self))] fn assemble_extension_candidates_for_all_traits(&mut self) { - let mut duplicates = FxHashSet::default(); + let mut duplicates = GxHashSet::default(); for trait_info in suggest::all_traits(self.tcx) { if duplicates.insert(trait_info.def_id) { self.assemble_extension_candidates_for_trait(&smallvec![], trait_info.def_id); @@ -924,7 +924,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { &self, candidate_filter: impl Fn(&ty::AssocItem) -> bool, ) -> Vec { - let mut set = FxHashSet::default(); + let mut set = GxHashSet::default(); let mut names: Vec<_> = self .inherent_candidates .iter() diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index a385bc70e359b..346073b842c9e 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -10,7 +10,7 @@ use core::ops::ControlFlow; use hir::Expr; use rustc_ast::ast::Mutability; use rustc_attr::parse_confusables; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::unord::UnordSet; use rustc_errors::{ @@ -939,11 +939,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // `self.suggest_traits_to_import`, so we ignore the `unsatisfied_predicates` // suggestions. } else if !unsatisfied_predicates.is_empty() { - let mut type_params = FxIndexMap::default(); + let mut type_params = GxIndexMap::default(); // Pick out the list of unimplemented traits on the receiver. // This is used for custom error messages with the `#[rustc_on_unimplemented]` attribute. - let mut unimplemented_traits = FxIndexMap::default(); + let mut unimplemented_traits = GxIndexMap::default(); let mut unimplemented_traits_only = true; for (predicate, _parent_pred, cause) in unsatisfied_predicates { if let (ty::PredicateKind::Clause(ty::ClauseKind::Trait(p)), Some(cause)) = @@ -1082,7 +1082,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Find all the requirements that come from a local `impl` block. let mut skip_list: UnordSet<_> = Default::default(); - let mut spanned_predicates = FxIndexMap::default(); + let mut spanned_predicates = GxIndexMap::default(); for (p, parent_p, cause) in unsatisfied_predicates { // Extract the predicate span and parent def id of the cause, // if we have one. @@ -1124,7 +1124,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let span = self_ty.span.ctxt().outer_expn_data().call_site; let entry = spanned_predicates.entry(span); let entry = entry.or_insert_with(|| { - (FxIndexSet::default(), FxIndexSet::default(), Vec::new()) + (GxIndexSet::default(), GxIndexSet::default(), Vec::new()) }); entry.0.insert(span); entry.1.insert(( @@ -1172,7 +1172,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { skip_list.insert(p); let entry = spanned_predicates.entry(self_ty.span); let entry = entry.or_insert_with(|| { - (FxIndexSet::default(), FxIndexSet::default(), Vec::new()) + (GxIndexSet::default(), GxIndexSet::default(), Vec::new()) }); entry.2.push(p); if cause_span != *item_span { @@ -1212,7 +1212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { skip_list.insert(p); let entry = spanned_predicates.entry(ident.span); let entry = entry.or_insert_with(|| { - (FxIndexSet::default(), FxIndexSet::default(), Vec::new()) + (GxIndexSet::default(), GxIndexSet::default(), Vec::new()) }); entry.0.insert(cause_span); entry.1.insert((ident.span, "")); @@ -2861,7 +2861,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::Adt(def, _) => Some(def.did()), _ => None, }) - .collect::>(); + .collect::>(); let mut local_spans: MultiSpan = local_def_ids .iter() .filter_map(|def_id| { @@ -2907,7 +2907,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::Adt(def, _) => Some(def.did()), _ => None, }) - .collect::>(); + .collect::>(); let mut foreign_spans: MultiSpan = foreign_def_ids .iter() .filter_map(|def_id| { diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index aaf3d3ec34d01..c42444a215ae5 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1,7 +1,7 @@ use crate::gather_locals::DeclOrigin; use crate::{errors, FnCtxt, LoweredTy}; use rustc_ast as ast; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{ codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, }; @@ -1480,10 +1480,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .fields .iter_enumerated() .map(|(i, field)| (field.ident(self.tcx).normalize_to_macros_2_0(), (i, field))) - .collect::>(); + .collect::>(); // Keep track of which fields have already appeared in the pattern. - let mut used_fields = FxHashMap::default(); + let mut used_fields = GxHashMap::default(); let mut result = Ok(()); let mut inexistent_fields = vec![]; diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index 466397817dae1..bd1f595586efb 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -53,7 +53,7 @@ use rustc_span::sym; use rustc_span::{BytePos, Pos, Span, Symbol}; use rustc_trait_selection::infer::InferCtxtExt; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_target::abi::FIRST_VARIANT; use std::iter; @@ -1126,7 +1126,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>, var_hir_id: HirId, closure_clause: hir::CaptureBy, - ) -> Option>> { + ) -> Option>> { let auto_traits_def_id = [ self.tcx.lang_items().clone_trait(), self.tcx.lang_items().sync_trait(), @@ -1171,7 +1171,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { })); } - let mut problematic_captures = FxIndexMap::default(); + let mut problematic_captures = GxIndexMap::default(); // Check whether captured fields also implement the trait for capture in root_var_min_capture_list.iter() { let ty = apply_capture_kind_on_capture_ty( @@ -1237,7 +1237,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>, closure_clause: hir::CaptureBy, var_hir_id: HirId, - ) -> Option> { + ) -> Option> { let ty = self.resolve_vars_if_possible(self.node_ty(var_hir_id)); if !ty.has_significant_drop(self.tcx, self.tcx.param_env(closure_def_id)) { @@ -1259,7 +1259,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match closure_clause { // Only migrate if closure is a move closure hir::CaptureBy::Value { .. } => { - let mut diagnostics_info = FxIndexSet::default(); + let mut diagnostics_info = GxIndexSet::default(); let upvars = self.tcx.upvars_mentioned(closure_def_id).expect("must be an upvar"); let upvar = upvars[&var_hir_id]; @@ -1275,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { debug!(?root_var_min_capture_list); let mut projections_list = Vec::new(); - let mut diagnostics_info = FxIndexSet::default(); + let mut diagnostics_info = GxIndexSet::default(); for captured_place in root_var_min_capture_list.iter() { match captured_place.info.capture_kind { @@ -1357,7 +1357,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { diagnostics_info } else { - FxIndexMap::default() + GxIndexMap::default() }; let drop_reorder_diagnostic = if let Some(diagnostics_info) = self @@ -1371,7 +1371,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { drop_migration_needed = true; diagnostics_info } else { - FxIndexSet::default() + GxIndexSet::default() }; // Combine all the captures responsible for needing migrations into one HashSet diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs index 41caa5d4765bc..b555328f173d6 100644 --- a/compiler/rustc_incremental/src/assert_dep_graph.rs +++ b/compiler/rustc_incremental/src/assert_dep_graph.rs @@ -35,8 +35,8 @@ use crate::errors; use rustc_ast as ast; -use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; +use rustc_data_structures::gx::GxIndexSet; use rustc_graphviz as dot; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID}; @@ -261,7 +261,7 @@ fn dump_graph(query: &DepGraphQuery) { } #[allow(missing_docs)] -pub struct GraphvizDepGraph(FxIndexSet, Vec<(DepKind, DepKind)>); +pub struct GraphvizDepGraph(GxIndexSet, Vec<(DepKind, DepKind)>); impl<'a> dot::GraphWalk<'a> for GraphvizDepGraph { type Node = DepKind; @@ -306,7 +306,7 @@ impl<'a> dot::Labeller<'a> for GraphvizDepGraph { fn node_set<'q>( query: &'q DepGraphQuery, filter: &DepNodeFilter, -) -> Option> { +) -> Option> { debug!("node_set(filter={:?})", filter); if filter.accepts_all() { @@ -318,9 +318,9 @@ fn node_set<'q>( fn filter_nodes<'q>( query: &'q DepGraphQuery, - sources: &Option>, - targets: &Option>, -) -> FxIndexSet { + sources: &Option>, + targets: &Option>, +) -> GxIndexSet { if let Some(sources) = sources { if let Some(targets) = targets { walk_between(query, sources, targets) @@ -336,10 +336,10 @@ fn filter_nodes<'q>( fn walk_nodes<'q>( query: &'q DepGraphQuery, - starts: &FxIndexSet<&'q DepNode>, + starts: &GxIndexSet<&'q DepNode>, direction: Direction, -) -> FxIndexSet { - let mut set = FxIndexSet::default(); +) -> GxIndexSet { + let mut set = GxIndexSet::default(); for &start in starts { debug!("walk_nodes: start={:?} outgoing?={:?}", start, direction == OUTGOING); if set.insert(start.kind) { @@ -360,9 +360,9 @@ fn walk_nodes<'q>( fn walk_between<'q>( query: &'q DepGraphQuery, - sources: &FxIndexSet<&'q DepNode>, - targets: &FxIndexSet<&'q DepNode>, -) -> FxIndexSet { + sources: &GxIndexSet<&'q DepNode>, + targets: &GxIndexSet<&'q DepNode>, +) -> GxIndexSet { // This is a bit tricky. We want to include a node only if it is: // (a) reachable from a source and (b) will reach a target. And we // have to be careful about cycles etc. Luckily efficiency is not @@ -429,8 +429,8 @@ fn walk_between<'q>( } } -fn filter_edges(query: &DepGraphQuery, nodes: &FxIndexSet) -> Vec<(DepKind, DepKind)> { - let uniq: FxIndexSet<_> = query +fn filter_edges(query: &DepGraphQuery, nodes: &GxIndexSet) -> Vec<(DepKind, DepKind)> { + let uniq: GxIndexSet<_> = query .edges() .into_iter() .map(|(s, t)| (s.kind, t.kind)) diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 2a0d681fa37ed..ddbaa8ba1c564 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -21,7 +21,7 @@ use crate::errors; use rustc_ast::{self as ast, Attribute, NestedMetaItem}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::unord::UnordSet; use rustc_hir::def_id::LocalDefId; use rustc_hir::intravisit; @@ -177,7 +177,7 @@ pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) { pub struct DirtyCleanVisitor<'tcx> { tcx: TyCtxt<'tcx>, - checked_attrs: FxHashSet, + checked_attrs: GxHashSet, } impl<'tcx> DirtyCleanVisitor<'tcx> { @@ -444,7 +444,7 @@ impl<'tcx> FindAllAttrs<'tcx> { false } - fn report_unchecked_attrs(&self, mut checked_attrs: FxHashSet) { + fn report_unchecked_attrs(&self, mut checked_attrs: GxHashSet) { for attr in &self.found_attrs { if !checked_attrs.contains(&attr.id) { self.tcx.dcx().emit_err(errors::UncheckedClean { span: attr.span }); diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 9afea3d66b0de..a95f9a657739b 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -109,7 +109,7 @@ use rustc_data_structures::base_n::BaseNString; use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::CASE_INSENSITIVE; use rustc_data_structures::flock; -use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexSet}; use rustc_data_structures::svh::Svh; use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_errors::ErrorGuaranteed; @@ -240,7 +240,7 @@ pub(crate) fn prepare_session_directory(sess: &Session) -> Result<(), ErrorGuara } }; - let mut source_directories_already_tried = FxHashSet::default(); + let mut source_directories_already_tried = GxHashSet::default(); loop { // Generate a session directory of the form: @@ -510,7 +510,7 @@ fn delete_session_dir_lock_file(sess: &Session, lock_file_path: &Path) { /// ignore-list. fn find_source_directory( crate_dir: &Path, - source_directories_already_tried: &FxHashSet, + source_directories_already_tried: &GxHashSet, ) -> Option { let iter = crate_dir .read_dir() @@ -522,7 +522,7 @@ fn find_source_directory( fn find_source_directory_in_iter( iter: I, - source_directories_already_tried: &FxHashSet, + source_directories_already_tried: &GxHashSet, ) -> Option where I: Iterator, @@ -647,7 +647,7 @@ pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result< // First do a pass over the crate directory, collecting lock files and // session directories - let mut session_directories = FxIndexSet::default(); + let mut session_directories = GxIndexSet::default(); let mut lock_files = UnordSet::default(); for dir_entry in crate_directory.read_dir()? { diff --git a/compiler/rustc_incremental/src/persist/fs/tests.rs b/compiler/rustc_incremental/src/persist/fs/tests.rs index 644b8187621c9..b472084e6b301 100644 --- a/compiler/rustc_incremental/src/persist/fs/tests.rs +++ b/compiler/rustc_incremental/src/persist/fs/tests.rs @@ -28,7 +28,7 @@ fn test_timestamp_serialization() { #[test] fn test_find_source_directory_in_iter() { - let already_visited = FxHashSet::default(); + let already_visited = GxHashSet::default(); // Find newest assert_eq!( diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs index 3bf582bd26c61..1eede876edb93 100644 --- a/compiler/rustc_incremental/src/persist/save.rs +++ b/compiler/rustc_incremental/src/persist/save.rs @@ -1,6 +1,6 @@ use crate::assert_dep_graph::assert_dep_graph; use crate::errors; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::join; use rustc_middle::dep_graph::{ DepGraph, SerializedDepGraph, WorkProduct, WorkProductId, WorkProductMap, @@ -83,7 +83,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) { pub fn save_work_product_index( sess: &Session, dep_graph: &DepGraph, - new_work_products: FxIndexMap, + new_work_products: GxIndexMap, ) { if sess.opts.incremental.is_none() { return; @@ -123,7 +123,7 @@ pub fn save_work_product_index( } fn encode_work_product_index( - work_products: &FxIndexMap, + work_products: &GxIndexMap, encoder: &mut FileEncoder, ) { let serialized_products: Vec<_> = work_products diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index a801001eaf988..3b54a13522424 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -1,5 +1,5 @@ use hir::GenericParamKind; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{ codes::*, Applicability, Diag, DiagMessage, DiagStyledString, EmissionGuarantee, IntoDiagArg, MultiSpan, SubdiagMessageOp, Subdiagnostic, @@ -400,7 +400,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> { let mut default = "'a".to_string(); if let Some(parent_generics) = parent_generics { - let used: FxHashSet<_> = parent_generics + let used: GxHashSet<_> = parent_generics .params .iter() .filter(|p| matches!(p.kind, GenericParamKind::Lifetime { .. })) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 1659f3d049370..9fdb66fccc8d4 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -14,7 +14,7 @@ use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable}; use rustc_middle::ty::GenericArg; use rustc_middle::ty::{self, BoundVar, InferConst, List, Ty, TyCtxt, TypeFlags, TypeVisitableExt}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_index::Idx; use smallvec::SmallVec; @@ -296,7 +296,7 @@ struct Canonicalizer<'cx, 'tcx> { query_state: &'cx mut OriginalQueryValues<'tcx>, // Note that indices is only used once `var_values` is big enough to be // heap-allocated. - indices: FxHashMap, BoundVar>, + indices: GxHashMap, BoundVar>, canonicalize_mode: &'cx dyn CanonicalizeMode, needs_canonical_flags: TypeFlags, @@ -584,7 +584,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { needs_canonical_flags, variables: SmallVec::from_slice(base.variables), query_state, - indices: FxHashMap::default(), + indices: GxHashMap::default(), binder_index: ty::INNERMOST, }; if canonicalizer.query_state.var_values.spilled() { @@ -695,7 +695,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> { return self.variables; } - let reverse_universe_map: FxHashMap = self + let reverse_universe_map: GxHashMap = self .query_state .universe_map .iter() diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 227691d099434..d57591d55dfbd 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -59,7 +59,7 @@ use crate::traits::{ }; use crate::infer::relate::{self, RelateResult, TypeRelation}; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_errors::{ codes::*, pluralize, struct_span_code_err, Applicability, Diag, DiagCtxtHandle, DiagStyledString, ErrorGuaranteed, IntoDiagArg, StringPart, @@ -1571,9 +1571,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { values = None; } struct OpaqueTypesVisitor<'tcx> { - types: FxIndexMap>, - expected: FxIndexMap>, - found: FxIndexMap>, + types: GxIndexMap>, + expected: GxIndexMap>, + found: GxIndexMap>, ignore_span: Span, tcx: TyCtxt<'tcx>, } @@ -1611,7 +1611,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { &self, err: &mut Diag<'_>, target: &str, - types: &FxIndexMap>, + types: &GxIndexMap>, ) { for (kind, values) in types.iter() { let count = values.len(); diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs index 7996b4bf65b4f..746e3583ba802 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs @@ -9,7 +9,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError; use crate::infer::{SubregionOrigin, TypeTrace}; use crate::traits::ObligationCauseCode; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{ErrorGuaranteed, MultiSpan}; use rustc_hir as hir; use rustc_hir::intravisit::Visitor; @@ -80,7 +80,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { // Next, let's figure out the set of trait objects with implicit static bounds let ty = self.tcx().type_of(*impl_def_id).instantiate_identity(); - let mut v = super::static_impl_trait::TraitObjectVisitor(FxIndexSet::default()); + let mut v = super::static_impl_trait::TraitObjectVisitor(GxIndexSet::default()); v.visit_ty(ty); let mut traits = vec![]; for matching_def_id in v.0 { diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 71a86683c2123..4f4672c119d97 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -8,7 +8,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError; use crate::infer::{SubregionOrigin, TypeTrace}; use crate::traits::{ObligationCauseCode, UnifyReceiverContext}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, Subdiagnostic}; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{walk_ty, Visitor}; @@ -222,7 +222,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { // Same case of `impl Foo for dyn Bar { fn qux(&self) {} }` introducing a `'static` // lifetime as above, but called using a fully-qualified path to the method: // `Foo::qux(bar)`. - let mut v = TraitObjectVisitor(FxIndexSet::default()); + let mut v = TraitObjectVisitor(GxIndexSet::default()); v.visit_ty(param.param_ty); if let Some((ident, self_ty)) = NiceRegionError::get_impl_ident_and_self_ty_from_trait(tcx, item_def_id, &v.0) @@ -474,7 +474,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { pub fn get_impl_ident_and_self_ty_from_trait( tcx: TyCtxt<'tcx>, def_id: DefId, - trait_objects: &FxIndexSet, + trait_objects: &GxIndexSet, ) -> Option<(Ident, &'tcx hir::Ty<'tcx>)> { match tcx.hir().get_if_local(def_id)? { Node::ImplItem(impl_item) => { @@ -543,7 +543,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { return false; }; - let mut v = TraitObjectVisitor(FxIndexSet::default()); + let mut v = TraitObjectVisitor(GxIndexSet::default()); v.visit_ty(ty); // Get the `Ident` of the method being called and the corresponding `impl` (to point at @@ -561,7 +561,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { fn suggest_constrain_dyn_trait_in_impl( &self, err: &mut Diag<'_>, - found_dids: &FxIndexSet, + found_dids: &GxIndexSet, ident: Ident, self_ty: &hir::Ty<'_>, ) -> bool { @@ -581,7 +581,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } /// Collect all the trait objects in a type that could have received an implicit `'static` lifetime. -pub struct TraitObjectVisitor(pub FxIndexSet); +pub struct TraitObjectVisitor(pub GxIndexSet); impl<'tcx> TypeVisitor> for TraitObjectVisitor { fn visit_ty(&mut self, t: Ty<'tcx>) { diff --git a/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs b/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs index ef26a8ff7b863..27e797238989b 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/sub_relations.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::undo_log::NoUndo; use rustc_data_structures::unify as ut; use rustc_middle::ty; @@ -38,7 +38,7 @@ impl ut::UnifyKey for SubId { /// still want to suggest specifying the type of the argument. #[derive(Default)] pub struct SubRelations { - map: FxHashMap, + map: GxHashMap, table: ut::UnificationTableStorage, } diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs index 13b145296a7c9..817af177f45a5 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs @@ -3,7 +3,7 @@ use core::ops::ControlFlow; use hir::def::CtorKind; use hir::intravisit::{walk_expr, walk_stmt, Visitor}; use hir::{LetStmt, QPath}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{Applicability, Diag}; use rustc_hir as hir; use rustc_hir::def::Res; @@ -782,7 +782,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { if blk.expr.is_some() { return None; } - let mut shadowed = FxIndexSet::default(); + let mut shadowed = GxIndexSet::default(); let mut candidate_idents = vec![]; let mut find_compatible_candidates = |pat: &hir::Pat<'_>| { if let hir::PatKind::Binding(_, hir_id, ident, _) = &pat.kind diff --git a/compiler/rustc_infer/src/infer/freshen.rs b/compiler/rustc_infer/src/infer/freshen.rs index de4267f7ceadd..cd4d791d1b35d 100644 --- a/compiler/rustc_infer/src/infer/freshen.rs +++ b/compiler/rustc_infer/src/infer/freshen.rs @@ -32,7 +32,7 @@ //! inferencer knows "so far". use super::InferCtxt; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::bug; use rustc_middle::ty::fold::TypeFolder; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitableExt}; @@ -42,8 +42,8 @@ pub struct TypeFreshener<'a, 'tcx> { infcx: &'a InferCtxt<'tcx>, ty_freshen_count: u32, const_freshen_count: u32, - ty_freshen_map: FxHashMap>, - const_freshen_map: FxHashMap>, + ty_freshen_map: GxHashMap>, + const_freshen_map: GxHashMap>, } impl<'a, 'tcx> TypeFreshener<'a, 'tcx> { diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs index 72944c9c7de68..9000398e6af44 100644 --- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs +++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs @@ -8,10 +8,10 @@ use crate::infer::region_constraints::VerifyBound; use crate::infer::RegionRelations; use crate::infer::RegionVariableOrigin; use crate::infer::SubregionOrigin; -use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{ Direction, Graph, NodeIndex, INCOMING, OUTGOING, }; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::intern::Interned; use rustc_data_structures::unord::UnordSet; use rustc_index::{IndexSlice, IndexVec}; @@ -830,9 +830,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> { orig_node_idx: RegionVid, dir: Direction, mut dup_vec: Option<&mut IndexSlice>>, - ) -> (Vec>, FxHashSet, bool) { + ) -> (Vec>, GxHashSet, bool) { struct WalkState<'tcx> { - set: FxHashSet, + set: GxHashSet, stack: Vec, result: Vec>, dup_found: bool, diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index a3cf588da1c02..118723a6010f3 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -20,7 +20,7 @@ use opaque_types::OpaqueTypeStorage; use region_constraints::{GenericKind, VarInfos, VerifyBound}; use region_constraints::{RegionConstraintCollector, RegionConstraintStorage}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::undo_log::Rollback; use rustc_data_structures::unify as ut; @@ -273,9 +273,9 @@ pub struct InferCtxt<'tcx> { /// The set of predicates on which errors have been reported, to /// avoid reporting the same error twice. pub reported_trait_errors: - RefCell>, ErrorGuaranteed)>>, + RefCell>, ErrorGuaranteed)>>, - pub reported_signature_mismatch: RefCell)>>, + pub reported_signature_mismatch: RefCell)>>, /// When an error occurs, we want to avoid reporting "derived" /// errors that are due to this original failure. Normally, we @@ -1365,7 +1365,7 @@ impl<'tcx> InferCtxt<'tcx> { infcx: &'a InferCtxt<'tcx>, span: Span, lbrct: BoundRegionConversionTime, - map: FxHashMap>, + map: GxHashMap>, } impl<'tcx> BoundVarReplacerDelegate<'tcx> for ToFreshVars<'_, 'tcx> { diff --git a/compiler/rustc_infer/src/infer/opaque_types/mod.rs b/compiler/rustc_infer/src/infer/opaque_types/mod.rs index b8dd501a721b5..069d1d64020b3 100644 --- a/compiler/rustc_infer/src/infer/opaque_types/mod.rs +++ b/compiler/rustc_infer/src/infer/opaque_types/mod.rs @@ -2,7 +2,7 @@ use crate::errors::OpaqueHiddenTypeDiag; use crate::infer::{InferCtxt, InferOk}; use crate::traits::{self, Obligation}; use hir::def_id::{DefId, LocalDefId}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync::Lrc; use rustc_hir as hir; use rustc_middle::traits::solve::Goal; @@ -18,7 +18,7 @@ use rustc_span::Span; mod table; -pub type OpaqueTypeMap<'tcx> = FxIndexMap, OpaqueTypeDecl<'tcx>>; +pub type OpaqueTypeMap<'tcx> = GxIndexMap, OpaqueTypeDecl<'tcx>>; pub use table::{OpaqueTypeStorage, OpaqueTypeTable}; use super::DefineOpaqueTypes; diff --git a/compiler/rustc_infer/src/infer/outlives/env.rs b/compiler/rustc_infer/src/infer/outlives/env.rs index 5bcb4f29364d7..79098c2a59b63 100644 --- a/compiler/rustc_infer/src/infer/outlives/env.rs +++ b/compiler/rustc_infer/src/infer/outlives/env.rs @@ -1,7 +1,7 @@ use crate::infer::free_regions::FreeRegionMap; use crate::infer::GenericKind; use crate::traits::query::OutlivesBound; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::transitive_relation::TransitiveRelationBuilder; use rustc_middle::bug; use rustc_middle::ty::{self, Region}; @@ -64,7 +64,7 @@ struct OutlivesEnvironmentBuilder<'tcx> { /// "Region-bound pairs" tracks outlives relations that are known to /// be true, either because of explicit where-clauses like `T: 'a` or /// because of implied bounds. -pub type RegionBoundPairs<'tcx> = FxIndexSet>>; +pub type RegionBoundPairs<'tcx> = GxIndexSet>>; impl<'tcx> OutlivesEnvironment<'tcx> { /// Create a builder using `ParamEnv` and add explicit outlives bounds into it. diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index 978b92fd8980d..93a55f60bb40f 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -1,6 +1,6 @@ use std::collections::hash_map::Entry; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::ty::error::TypeError; use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -89,7 +89,7 @@ pub(super) fn can_match_erased_ty<'tcx>( struct MatchAgainstHigherRankedOutlives<'tcx> { tcx: TyCtxt<'tcx>, pattern_depth: ty::DebruijnIndex, - map: FxHashMap>, + map: GxHashMap>, } impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> { @@ -97,7 +97,7 @@ impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> { MatchAgainstHigherRankedOutlives { tcx, pattern_depth: ty::INNERMOST, - map: FxHashMap::default(), + map: GxHashMap::default(), } } } diff --git a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs index 5b159d6273121..35fbcf51da497 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs @@ -1,8 +1,8 @@ use super::*; use crate::infer::relate::RelateResult; use crate::infer::snapshot::CombinedSnapshot; -use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::graph::{scc::Sccs, vec_graph::VecGraph}; +use rustc_data_structures::gx::GxIndexMap; use rustc_index::Idx; use rustc_middle::span_bug; use rustc_middle::ty::error::TypeError; @@ -355,7 +355,7 @@ rustc_index::newtype_index! { /// an edge `R1 -> R2` in the graph. struct MiniGraph<'tcx> { /// Map from a region to the index of the node in the graph. - nodes: FxIndexMap, LeakCheckNode>, + nodes: GxIndexMap, LeakCheckNode>, /// Map from node index to SCC, and stores the successors of each SCC. All /// the regions in the same SCC are equal to one another, and if `S1 -> S2`, @@ -369,7 +369,7 @@ impl<'tcx> MiniGraph<'tcx> { region_constraints: &RegionConstraintCollector<'_, 'tcx>, only_consider_snapshot: Option<&CombinedSnapshot<'tcx>>, ) -> Self { - let mut nodes = FxIndexMap::default(); + let mut nodes = GxIndexMap::default(); let mut edges = Vec::new(); // Note that if `R2: R1`, we get a callback `r1, r2`, so `target` is first parameter. @@ -435,7 +435,7 @@ impl<'tcx> MiniGraph<'tcx> { } fn add_node( - nodes: &mut FxIndexMap, LeakCheckNode>, + nodes: &mut GxIndexMap, LeakCheckNode>, r: ty::Region<'tcx>, ) -> LeakCheckNode { let l = nodes.len(); diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index 6f755e07ff17d..28ee575d6ae86 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -6,7 +6,7 @@ use self::UndoLog::*; use super::{MiscVariable, RegionVariableOrigin, Rollback, SubregionOrigin}; use crate::infer::snapshot::undo_log::{InferCtxtUndoLogs, Snapshot}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lrc; use rustc_data_structures::undo_log::UndoLogs; use rustc_data_structures::unify as ut; @@ -287,7 +287,7 @@ pub(crate) enum CombineMapType { Glb, } -type CombineMap<'tcx> = FxHashMap, RegionVid>; +type CombineMap<'tcx> = GxHashMap, RegionVid>; #[derive(Debug, Clone, Copy)] pub struct RegionVariableInfo { diff --git a/compiler/rustc_infer/src/traits/error_reporting/mod.rs b/compiler/rustc_infer/src/traits/error_reporting/mod.rs index 890e25368bc75..389c5b7ae5132 100644 --- a/compiler/rustc_infer/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/traits/error_reporting/mod.rs @@ -1,7 +1,7 @@ use super::ObjectSafetyViolation; use crate::infer::InferCtxt; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{codes::*, struct_span_code_err, Applicability, Diag, MultiSpan}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -78,7 +78,7 @@ pub fn report_object_safety_error<'tcx>( ); } } - let mut reported_violations = FxIndexSet::default(); + let mut reported_violations = GxIndexSet::default(); let mut multi_span = vec![]; let mut messages = vec![]; for violation in violations { diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index ab4148faaab63..8026a8d6fbbc2 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -2,7 +2,7 @@ use smallvec::smallvec; use crate::infer::outlives::components::{push_outlives_components, Component}; use crate::traits::{self, Obligation, ObligationCauseCode, PredicateObligation}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::ty::{self, Ty, TyCtxt, Upcast}; use rustc_span::symbol::Ident; use rustc_span::Span; @@ -17,7 +17,7 @@ pub fn anonymize_predicate<'tcx>( pub struct PredicateSet<'tcx> { tcx: TyCtxt<'tcx>, - set: FxHashSet>, + set: GxHashSet>, } impl<'tcx> PredicateSet<'tcx> { diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index dba20e4a3355c..bb1d8f9901f59 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -4,7 +4,7 @@ use rustc_ast::token; use rustc_ast::{LitKind, MetaItemKind}; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::defer; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::jobserver; use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::Lrc; @@ -192,7 +192,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec) -> Ch } let mut names = Vec::new(); - let mut values: FxHashSet<_> = Default::default(); + let mut values: GxHashSet<_> = Default::default(); let mut any_specified = false; let mut values_specified = false; @@ -313,7 +313,7 @@ pub struct Config { pub file_loader: Option>, pub locale_resources: &'static [&'static str], - pub lint_caps: FxHashMap, + pub lint_caps: GxHashMap, /// This is a callback from the driver that is called when [`ParseSess`] is created. pub psess_created: Option>, diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 46cf87d1e3c17..1b3471a2ede2b 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -208,7 +208,7 @@ lint_cstring_ptr = getting the inner pointer of a temporary `CString` lint_custom_inner_attribute_unstable = custom inner attributes are unstable lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better performance - .note = a `use rustc_data_structures::fx::{$preferred}` may be necessary + .note = a `use rustc_data_structures::gx::{$preferred}` may be necessary lint_default_source = `forbid` lint level is the default for {$id} diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 9f0f116cbd030..b011ed8748cd6 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -18,7 +18,7 @@ use self::TargetLint::*; use crate::levels::LintLevelsBuilder; use crate::passes::{EarlyLintPassObject, LateLintPassObject}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sync; use rustc_data_structures::unord::UnordMap; use rustc_errors::{Diag, LintDiagnostic, MultiSpan}; @@ -74,7 +74,7 @@ pub struct LintStore { by_name: UnordMap, /// Map of registered lint groups to what lints they expand to. - lint_groups: FxIndexMap<&'static str, LintGroup>, + lint_groups: GxIndexMap<&'static str, LintGroup>, } impl LintStoreMarker for LintStore {} diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs index d4f6d388d9fe3..b36a6132c871d 100644 --- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs +++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::unord::UnordSet; use rustc_errors::{Applicability, LintDiagnostic}; use rustc_hir as hir; @@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplTraitOvercaptures { fn check_fn(tcx: TyCtxt<'_>, parent_def_id: LocalDefId) { let sig = tcx.fn_sig(parent_def_id).instantiate_identity(); - let mut in_scope_parameters = FxIndexSet::default(); + let mut in_scope_parameters = GxIndexSet::default(); // Populate the in_scope_parameters list first with all of the generics in scope let mut current_def_id = Some(parent_def_id.to_def_id()); while let Some(def_id) = current_def_id { @@ -150,8 +150,8 @@ fn check_fn(tcx: TyCtxt<'_>, parent_def_id: LocalDefId) { struct VisitOpaqueTypes<'tcx> { tcx: TyCtxt<'tcx>, parent_def_id: LocalDefId, - in_scope_parameters: FxIndexSet, - seen: FxIndexSet, + in_scope_parameters: GxIndexSet, + seen: GxIndexSet, } impl<'tcx> TypeVisitor> for VisitOpaqueTypes<'tcx> { @@ -212,7 +212,7 @@ impl<'tcx> TypeVisitor> for VisitOpaqueTypes<'tcx> { && parent_def_id == self.parent_def_id { // Compute the set of args that are captured by the opaque... - let mut captured = FxIndexSet::default(); + let mut captured = GxIndexSet::default(); let variances = self.tcx.variances_of(opaque_def_id); let mut current_def_id = Some(opaque_def_id.to_def_id()); while let Some(def_id) = current_def_id { diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 9110cccdc46f0..047fbc1276038 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -19,13 +19,13 @@ use tracing::debug; declare_tool_lint! { /// The `default_hash_type` lint detects use of [`std::collections::HashMap`] and - /// [`std::collections::HashSet`], suggesting the use of `FxHashMap`/`FxHashSet`. + /// [`std::collections::HashSet`], suggesting the use of `GxHashMap`/`GxHashSet`. /// - /// This can help as `FxHasher` can perform better than the default hasher. DOS protection is + /// This can help as `GxHasher` can perform better than the default hasher. DOS protection is /// not required as input is assumed to be trusted. pub rustc::DEFAULT_HASH_TYPES, Allow, - "forbid HashMap and HashSet and suggest the FxHash* variants", + "forbid HashMap and HashSet and suggest the GxHash* variants", report_in_external_macro: true } @@ -39,8 +39,8 @@ impl LateLintPass<'_> for DefaultHashTypes { return; } let preferred = match cx.tcx.get_diagnostic_name(def_id) { - Some(sym::HashMap) => "FxHashMap", - Some(sym::HashSet) => "FxHashSet", + Some(sym::HashMap) => "GxHashMap", + Some(sym::HashSet) => "GxHashSet", _ => return, }; cx.emit_span_lint( diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 0df34c32e385b..ba277c34b1fbf 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -15,7 +15,7 @@ use crate::{ }; use rustc_ast as ast; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::{Diag, LintDiagnostic, MultiSpan}; use rustc_feature::{Features, GateIssue}; use rustc_hir as hir; @@ -74,7 +74,7 @@ rustc_index::newtype_index! { struct LintSet { // -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which // flag. - specs: FxIndexMap, + specs: GxIndexMap, parent: LintStackIndex, } @@ -87,7 +87,7 @@ impl LintLevelSets { &self, lint: &'static Lint, idx: LintStackIndex, - aux: Option<&FxIndexMap>, + aux: Option<&GxIndexMap>, sess: &Session, ) -> LevelAndSource { let lint = LintId::of(lint); @@ -102,7 +102,7 @@ impl LintLevelSets { &self, id: LintId, mut idx: LintStackIndex, - aux: Option<&FxIndexMap>, + aux: Option<&GxIndexMap>, ) -> (Option, LintLevelSource) { if let Some(specs) = aux && let Some(&(level, src)) = specs.get(&id) @@ -134,8 +134,8 @@ fn lint_expectations(tcx: TyCtxt<'_>, (): ()) -> Vec<(LintExpectationId, LintExp cur: hir::CRATE_HIR_ID, specs: ShallowLintLevelMap::default(), expectations: Vec::new(), - unstable_to_stable_ids: FxIndexMap::default(), - empty: FxIndexMap::default(), + unstable_to_stable_ids: GxIndexMap::default(), + empty: GxIndexMap::default(), }, lint_added_lints: false, store, @@ -163,7 +163,7 @@ fn shallow_lint_levels_on(tcx: TyCtxt<'_>, owner: hir::OwnerId) -> ShallowLintLe tcx, cur: owner.into(), specs: ShallowLintLevelMap::default(), - empty: FxIndexMap::default(), + empty: GxIndexMap::default(), attrs, }, lint_added_lints: false, @@ -212,14 +212,14 @@ pub struct TopDown { } pub trait LintLevelsProvider { - fn current_specs(&self) -> &FxIndexMap; + fn current_specs(&self) -> &GxIndexMap; fn insert(&mut self, id: LintId, lvl: LevelAndSource); fn get_lint_level(&self, lint: &'static Lint, sess: &Session) -> LevelAndSource; fn push_expectation(&mut self, _id: LintExpectationId, _expectation: LintExpectation) {} } impl LintLevelsProvider for TopDown { - fn current_specs(&self) -> &FxIndexMap { + fn current_specs(&self) -> &GxIndexMap { &self.sets.list[self.cur].specs } @@ -237,12 +237,12 @@ struct LintLevelQueryMap<'tcx> { cur: HirId, specs: ShallowLintLevelMap, /// Empty hash map to simplify code. - empty: FxIndexMap, + empty: GxIndexMap, attrs: &'tcx hir::AttributeMap<'tcx>, } impl LintLevelsProvider for LintLevelQueryMap<'_> { - fn current_specs(&self) -> &FxIndexMap { + fn current_specs(&self) -> &GxIndexMap { self.specs.specs.get(&self.cur.local_id).unwrap_or(&self.empty) } fn insert(&mut self, id: LintId, lvl: LevelAndSource) { @@ -260,13 +260,13 @@ struct QueryMapExpectationsWrapper<'tcx> { /// Level map for `cur`. specs: ShallowLintLevelMap, expectations: Vec<(LintExpectationId, LintExpectation)>, - unstable_to_stable_ids: FxIndexMap, + unstable_to_stable_ids: GxIndexMap, /// Empty hash map to simplify code. - empty: FxIndexMap, + empty: GxIndexMap, } impl LintLevelsProvider for QueryMapExpectationsWrapper<'_> { - fn current_specs(&self) -> &FxIndexMap { + fn current_specs(&self) -> &GxIndexMap { self.specs.specs.get(&self.cur.local_id).unwrap_or(&self.empty) } fn insert(&mut self, id: LintId, lvl: LevelAndSource) { @@ -489,7 +489,7 @@ impl<'s> LintLevelsBuilder<'s, TopDown> { .provider .sets .list - .push(LintSet { specs: FxIndexMap::default(), parent: COMMAND_LINE }); + .push(LintSet { specs: GxIndexMap::default(), parent: COMMAND_LINE }); self.add_command_line(); } @@ -515,7 +515,7 @@ impl<'s> LintLevelsBuilder<'s, TopDown> { ) -> BuilderPush { let prev = self.provider.cur; self.provider.cur = - self.provider.sets.list.push(LintSet { specs: FxIndexMap::default(), parent: prev }); + self.provider.sets.list.push(LintSet { specs: GxIndexMap::default(), parent: prev }); self.add(attrs, is_crate_node, source_hir_id); @@ -550,7 +550,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { self.features } - fn current_specs(&self) -> &FxIndexMap { + fn current_specs(&self) -> &GxIndexMap { self.provider.current_specs() } diff --git a/compiler/rustc_lint/src/non_ascii_idents.rs b/compiler/rustc_lint/src/non_ascii_idents.rs index 9f298a6071c69..6e0c020a1005a 100644 --- a/compiler/rustc_lint/src/non_ascii_idents.rs +++ b/compiler/rustc_lint/src/non_ascii_idents.rs @@ -4,7 +4,7 @@ use crate::lints::{ }; use crate::{EarlyContext, EarlyLintPass, LintContext}; use rustc_ast as ast; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::unord::UnordMap; use rustc_session::{declare_lint, declare_lint_pass}; use rustc_span::symbol::Symbol; @@ -290,7 +290,7 @@ impl EarlyLintPass for NonAsciiIdents { Verified, } - let mut script_states: FxIndexMap = + let mut script_states: GxIndexMap = Default::default(); let latin_augmented_script_set = AugmentedScriptSet::for_char('A'); script_states.insert(latin_augmented_script_set, ScriptSetUsage::Verified); diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index f3a904022e9ed..2cc58e8ce8b82 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -13,7 +13,7 @@ use crate::{ use crate::{LateContext, LateLintPass, LintContext}; use rustc_ast as ast; use rustc_attr as attr; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::DiagMessage; use rustc_hir as hir; use rustc_hir::{is_range_literal, Expr, ExprKind, Node}; @@ -1221,7 +1221,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Checks if the given field's type is "ffi-safe". fn check_field_type_for_ffi( &self, - cache: &mut FxHashSet>, + cache: &mut GxHashSet>, field: &ty::FieldDef, args: GenericArgsRef<'tcx>, ) -> FfiResult<'tcx> { @@ -1237,7 +1237,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Checks if the given `VariantDef`'s field types are "ffi-safe". fn check_variant_for_ffi( &self, - cache: &mut FxHashSet>, + cache: &mut GxHashSet>, ty: Ty<'tcx>, def: ty::AdtDef<'tcx>, variant: &ty::VariantDef, @@ -1285,7 +1285,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Checks if the given type is "ffi-safe" (has a stable, well-defined /// representation which can be exported to C code). - fn check_type_for_ffi(&self, cache: &mut FxHashSet>, ty: Ty<'tcx>) -> FfiResult<'tcx> { + fn check_type_for_ffi(&self, cache: &mut GxHashSet>, ty: Ty<'tcx>) -> FfiResult<'tcx> { use FfiResult::*; let tcx = self.cx.tcx; @@ -1626,7 +1626,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { return; } - match self.check_type_for_ffi(&mut FxHashSet::default(), ty) { + match self.check_type_for_ffi(&mut GxHashSet::default(), ty) { FfiResult::FfiSafe => {} FfiResult::FfiPhantom(ty) => { self.emit_ffi_unsafe_type_lint( diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index b44eb25216770..48efb812c8cda 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -1,7 +1,7 @@ pub use self::Level::*; use rustc_ast::node_id::NodeId; use rustc_ast::{AttrId, Attribute}; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::stable_hasher::{ HashStable, StableCompare, StableHasher, ToStableHashKey, }; @@ -769,7 +769,7 @@ pub struct BufferedEarlyLint { #[derive(Default, Debug)] pub struct LintBuffer { - pub map: FxIndexMap>, + pub map: GxIndexMap>, } impl LintBuffer { @@ -798,7 +798,7 @@ impl LintBuffer { } } -pub type RegisteredTools = FxIndexSet; +pub type RegisteredTools = GxIndexSet; /// Declares a static item of type `&'static Lint`. /// diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 749495bc2ef53..16a10dfcef840 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -6,7 +6,7 @@ use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob use rustc_ast::expand::allocator::{alloc_error_handler_name, global_fn_name, AllocatorKind}; use rustc_ast::{self as ast, *}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::owned_slice::OwnedSlice; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, FreezeReadGuard, FreezeWriteGuard}; @@ -79,7 +79,7 @@ pub struct CrateLoader<'a, 'tcx: 'a> { tcx: TyCtxt<'tcx>, // Mutable output. cstore: &'a mut CStore, - used_extern_options: &'a mut FxHashSet, + used_extern_options: &'a mut GxHashSet, } impl<'a, 'tcx> std::ops::Deref for CrateLoader<'a, 'tcx> { @@ -312,7 +312,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { pub fn new( tcx: TyCtxt<'tcx>, cstore: &'a mut CStore, - used_extern_options: &'a mut FxHashSet, + used_extern_options: &'a mut GxHashSet, ) -> Self { CrateLoader { tcx, cstore, used_extern_options } } diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs index 9c69ab2344e5e..0b8b174b75c4a 100644 --- a/compiler/rustc_metadata/src/dependency_format.rs +++ b/compiler/rustc_metadata/src/dependency_format.rs @@ -57,7 +57,7 @@ use crate::errors::{ NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcLibRequired, TwoPanicRuntimes, }; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::CrateNum; use rustc_middle::bug; use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; @@ -160,7 +160,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { Linkage::Dynamic | Linkage::IncludedFromDylib => {} } - let mut formats = FxHashMap::default(); + let mut formats = GxHashMap::default(); // Sweep all crates for found dylibs. Add all dylibs, as well as their // dependencies, ensuring there are no conflicts. The only valid case for a @@ -255,7 +255,7 @@ fn add_library( tcx: TyCtxt<'_>, cnum: CrateNum, link: LinkagePreference, - m: &mut FxHashMap, + m: &mut GxHashMap, unavailable_as_static: &mut Vec, ) { match m.get(&cnum) { diff --git a/compiler/rustc_metadata/src/foreign_modules.rs b/compiler/rustc_metadata/src/foreign_modules.rs index 154eb684f1197..4373e64b81db0 100644 --- a/compiler/rustc_metadata/src/foreign_modules.rs +++ b/compiler/rustc_metadata/src/foreign_modules.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; @@ -6,8 +6,8 @@ use rustc_middle::query::LocalCrate; use rustc_middle::ty::TyCtxt; use rustc_session::cstore::ForeignModule; -pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> FxIndexMap { - let mut modules = FxIndexMap::default(); +pub(crate) fn collect(tcx: TyCtxt<'_>, LocalCrate: LocalCrate) -> GxIndexMap { + let mut modules = GxIndexMap::default(); // We need to collect all the `ForeignMod`, even if they are empty. for id in tcx.hir().items() { diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 90fe52a34385a..e6acc4d5e619f 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -216,7 +216,7 @@ use crate::creader::{Library, MetadataLoader}; use crate::errors; use crate::rmeta::{rustc_version, MetadataBlob, METADATA_HEADER}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::owned_slice::slice_owned; use rustc_data_structures::svh::Svh; @@ -359,7 +359,7 @@ impl<'a> CrateLocator<'a> { if !self.exact_paths.is_empty() { return self.find_commandline_library(); } - let mut seen_paths = FxHashSet::default(); + let mut seen_paths = GxHashSet::default(); if let Some(extra_filename) = self.extra_filename { if let library @ Some(_) = self.find_library_crate(extra_filename, &mut seen_paths)? { return Ok(library); @@ -371,7 +371,7 @@ impl<'a> CrateLocator<'a> { fn find_library_crate( &mut self, extra_prefix: &str, - seen_paths: &mut FxHashSet, + seen_paths: &mut GxHashSet, ) -> Result, CrateError> { let rmeta_prefix = &format!("lib{}{}", self.crate_name, extra_prefix); let rlib_prefix = rmeta_prefix; @@ -385,7 +385,7 @@ impl<'a> CrateLocator<'a> { let dylib_suffix = &self.target.dll_suffix; let staticlib_suffix = &self.target.staticlib_suffix; - let mut candidates: FxHashMap<_, (FxHashMap<_, _>, FxHashMap<_, _>, FxHashMap<_, _>)> = + let mut candidates: GxHashMap<_, (GxHashMap<_, _>, GxHashMap<_, _>, GxHashMap<_, _>)> = Default::default(); // First, find all possible candidate rlibs and dylibs purely based on @@ -460,7 +460,7 @@ impl<'a> CrateLocator<'a> { // A Library candidate is created if the metadata for the set of // libraries corresponds to the crate id and hash criteria that this // search is being performed for. - let mut libraries = FxHashMap::default(); + let mut libraries = GxHashMap::default(); for (_hash, (rlibs, rmetas, dylibs)) in candidates { if let Some((svh, lib)) = self.extract_lib(rlibs, rmetas, dylibs)? { libraries.insert(svh, lib); @@ -494,9 +494,9 @@ impl<'a> CrateLocator<'a> { fn extract_lib( &mut self, - rlibs: FxHashMap, - rmetas: FxHashMap, - dylibs: FxHashMap, + rlibs: GxHashMap, + rmetas: GxHashMap, + dylibs: GxHashMap, ) -> Result, CrateError> { let mut slot = None; // Order here matters, rmeta should come first. See comment in @@ -534,7 +534,7 @@ impl<'a> CrateLocator<'a> { // The `PathBuf` in `slot` will only be used for diagnostic purposes. fn extract_one( &mut self, - m: FxHashMap, + m: GxHashMap, flavor: CrateFlavor, slot: &mut Option<(Svh, MetadataBlob, PathBuf)>, ) -> Result, CrateError> { @@ -702,9 +702,9 @@ impl<'a> CrateLocator<'a> { // First, filter out all libraries that look suspicious. We only accept // files which actually exist that have the correct naming scheme for // rlibs/dylibs. - let mut rlibs = FxHashMap::default(); - let mut rmetas = FxHashMap::default(); - let mut dylibs = FxHashMap::default(); + let mut rlibs = GxHashMap::default(); + let mut rmetas = GxHashMap::default(); + let mut dylibs = GxHashMap::default(); for loc in &self.exact_paths { if !loc.canonicalized().exists() { return Err(CrateError::ExternLocationNotExist( diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 1254ebead0727..b0b0449292d70 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -1,6 +1,6 @@ use rustc_ast::{NestedMetaItem, CRATE_NODE_ID}; use rustc_attr as attr; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::query::LocalCrate; use rustc_middle::ty::{List, ParamEnv, ParamEnvAnd, Ty, TyCtxt}; use rustc_session::config::CrateType; @@ -386,7 +386,7 @@ impl<'tcx> Collector<'tcx> { // Process libs passed on the command line fn process_command_line(&mut self) { // First, check for errors - let mut renames = FxHashSet::default(); + let mut renames = GxHashSet::default(); for lib in &self.tcx.sess.opts.libs { if let NativeLibKind::Framework { .. } = lib.kind && !self.tcx.sess.target.is_like_osx diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index ea7037740f17e..b98a017b99fd5 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -83,12 +83,12 @@ pub(crate) struct CrateMetadata { /// Trait impl data. /// FIXME: Used only from queries and can use query cache, /// so pre-decoding can probably be avoided. - trait_impls: FxHashMap<(u32, DefIndex), LazyArray<(DefIndex, Option)>>, + trait_impls: GxHashMap<(u32, DefIndex), LazyArray<(DefIndex, Option)>>, /// Inherent impls which do not follow the normal coherence rules. /// /// These can be introduced using either `#![rustc_coherence_is_core]` /// or `#[rustc_allow_incoherent_impl]`. - incoherent_impls: FxHashMap>, + incoherent_impls: GxHashMap>, /// Proc macro descriptions for this crate, if it's a proc macro crate. raw_proc_macros: Option<&'static [ProcMacro]>, /// Source maps for code from the crate. @@ -100,7 +100,7 @@ pub(crate) struct CrateMetadata { /// Used for decoding interpret::AllocIds in a cached & thread-safe manner. alloc_decoding_state: AllocDecodingState, /// Caches decoded `DefKey`s. - def_key_cache: Lock>, + def_key_cache: Lock>, // --- Other significant crate properties --- /// ID of this crate, from the current compilation session's point of view. diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 4bd2ec09a6e6f..de69253c7f78d 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -2,7 +2,7 @@ use crate::errors::{FailCreateFileEncoder, FailWriteFile}; use crate::rmeta::*; use rustc_ast::Attribute; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::memmap::{Mmap, MmapMut}; use rustc_data_structures::sync::{join, par_for_each_in, Lrc}; use rustc_data_structures::temp_dir::MaybeTempDir; @@ -42,11 +42,11 @@ pub(super) struct EncodeContext<'a, 'tcx> { tables: TableBuilders, lazy_state: LazyState, - span_shorthands: FxHashMap, - type_shorthands: FxHashMap, usize>, - predicate_shorthands: FxHashMap, usize>, + span_shorthands: GxHashMap, + type_shorthands: GxHashMap, usize>, + predicate_shorthands: GxHashMap, usize>, - interpret_allocs: FxIndexSet, + interpret_allocs: GxIndexSet, // This is used to speed up Span encoding. // The `usize` is an index into the `MonotonicVec` @@ -55,13 +55,13 @@ pub(super) struct EncodeContext<'a, 'tcx> { // The indices (into the `SourceMap`'s `MonotonicVec`) // of all of the `SourceFiles` that we need to serialize. // When we serialize a `Span`, we insert the index of its - // `SourceFile` into the `FxIndexSet`. - // The order inside the `FxIndexSet` is used as on-disk + // `SourceFile` into the `GxIndexSet`. + // The order inside the `GxIndexSet` is used as on-disk // order of `SourceFiles`, and encoded inside `Span`s. - required_source_files: Option>, + required_source_files: Option>, is_proc_macro: bool, hygiene_ctxt: &'a HygieneEncodeContext, - symbol_table: FxHashMap, + symbol_table: GxHashMap, } /// If the current crate is a proc-macro, returns early with `LazyArray::default()`. @@ -385,11 +385,11 @@ impl<'a, 'tcx> TyEncoder for EncodeContext<'a, 'tcx> { self.opaque.position() } - fn type_shorthands(&mut self) -> &mut FxHashMap, usize> { + fn type_shorthands(&mut self) -> &mut GxHashMap, usize> { &mut self.type_shorthands } - fn predicate_shorthands(&mut self) -> &mut FxHashMap, usize> { + fn predicate_shorthands(&mut self) -> &mut GxHashMap, usize> { &mut self.predicate_shorthands } @@ -1986,8 +1986,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { fn encode_impls(&mut self) -> LazyArray { empty_proc_macro!(self); let tcx = self.tcx; - let mut fx_hash_map: FxHashMap)>> = - FxHashMap::default(); + let mut fx_hash_map: GxHashMap)>> = + GxHashMap::default(); for id in tcx.hir().items() { let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else { @@ -2239,7 +2239,7 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path) { let source_map_files = tcx.sess.source_map().files(); let source_file_cache = (source_map_files[0].clone(), 0); - let required_source_files = Some(FxIndexSet::default()); + let required_source_files = Some(GxIndexSet::default()); drop(source_map_files); let hygiene_ctxt = HygieneEncodeContext::default(); diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 87900c23d8daf..8996b048f52b5 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -7,7 +7,7 @@ pub use encoder::{encode_metadata, rendered_const, EncodedMetadata}; use rustc_ast as ast; use rustc_ast::expand::StrippedCfgItem; use rustc_attr as attr; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::svh::Svh; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap}; diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index e3d7dff3c66bb..271c89b51048f 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -87,12 +87,12 @@ macro_rules! arena_types { rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>> >, [] effective_visibilities: rustc_middle::middle::privacy::EffectiveVisibilities, - [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap, + [] upvars_mentioned: rustc_data_structures::gx::GxIndexMap, [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation, [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>, [decode] attribute: rustc_ast::Attribute, [] name_set: rustc_data_structures::unord::UnordSet, - [] ordered_name_set: rustc_data_structures::fx::FxIndexSet, + [] ordered_name_set: rustc_data_structures::gx::GxIndexSet, [] pats: rustc_middle::ty::PatternKind<'tcx>, // Note that this deliberately duplicates items in the `rustc_hir::arena`, @@ -100,7 +100,7 @@ macro_rules! arena_types { // (during lowering) and the `rustc_middle` arena (for decoding MIR) [decode] asm_template: rustc_ast::InlineAsmTemplatePiece, [decode] used_trait_imports: rustc_data_structures::unord::UnordSet, - [decode] is_late_bound_map: rustc_data_structures::fx::FxIndexSet, + [decode] is_late_bound_map: rustc_data_structures::gx::GxIndexSet, [decode] impl_source: rustc_middle::traits::ImplSource<'tcx, ()>, [] dep_kind: rustc_middle::dep_graph::DepKindStruct<'tcx>, diff --git a/compiler/rustc_middle/src/infer/canonical.rs b/compiler/rustc_middle/src/infer/canonical.rs index dba71d88f404b..dff665213f4ab 100644 --- a/compiler/rustc_middle/src/infer/canonical.rs +++ b/compiler/rustc_middle/src/infer/canonical.rs @@ -21,7 +21,7 @@ //! //! [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lock; use rustc_macros::{HashStable, TypeFoldable, TypeVisitable}; pub use rustc_type_ir as ir; @@ -150,7 +150,7 @@ TrivialTypeTraversalImpls! { #[derive(Default)] pub struct CanonicalParamEnvCache<'tcx> { map: Lock< - FxHashMap< + GxHashMap< ty::ParamEnv<'tcx>, (Canonical<'tcx, ty::ParamEnv<'tcx>>, &'tcx [GenericArg<'tcx>]), >, diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index 4e655ca2027f2..3115f29ca32af 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -1,6 +1,6 @@ use std::cmp; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::sorted_map::SortedMap; use rustc_errors::{Diag, MultiSpan}; use rustc_hir::{HirId, ItemLocalId}; @@ -63,7 +63,7 @@ pub type LevelAndSource = (Level, LintLevelSource); /// by the attributes for *a single HirId*. #[derive(Default, Debug, HashStable)] pub struct ShallowLintLevelMap { - pub specs: SortedMap>, + pub specs: SortedMap>, } /// From an initial level and source, verify the effect of special annotations: diff --git a/compiler/rustc_middle/src/middle/privacy.rs b/compiler/rustc_middle/src/middle/privacy.rs index 4b47b019fd4b0..fac16ca1dc670 100644 --- a/compiler/rustc_middle/src/middle/privacy.rs +++ b/compiler/rustc_middle/src/middle/privacy.rs @@ -3,7 +3,7 @@ //! which are available for use externally when compiled as a library. use crate::ty::{TyCtxt, Visibility}; -use rustc_data_structures::fx::{FxIndexMap, IndexEntry}; +use rustc_data_structures::gx::{GxIndexMap, IndexEntry}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def::DefKind; use rustc_macros::HashStable; @@ -91,7 +91,7 @@ impl EffectiveVisibility { /// Holds a map of effective visibilities for reachable HIR nodes. #[derive(Clone, Debug)] pub struct EffectiveVisibilities { - map: FxIndexMap, + map: GxIndexMap, } impl EffectiveVisibilities { diff --git a/compiler/rustc_middle/src/middle/region.rs b/compiler/rustc_middle/src/middle/region.rs index 6e89dc494fa56..183d2696044a6 100644 --- a/compiler/rustc_middle/src/middle/region.rs +++ b/compiler/rustc_middle/src/middle/region.rs @@ -7,7 +7,7 @@ //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/borrow_check.html use crate::ty::TyCtxt; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::unord::UnordMap; use rustc_hir as hir; use rustc_hir::{HirId, HirIdMap, Node}; @@ -216,11 +216,11 @@ pub struct ScopeTree { /// conditional expression or repeating block. (Note that the /// enclosing scope ID for the block associated with a closure is /// the closure itself.) - pub parent_map: FxIndexMap, + pub parent_map: GxIndexMap, /// Maps from a variable or binding ID to the block in which that /// variable is declared. - var_map: FxIndexMap, + var_map: GxIndexMap, /// Identifies expressions which, if captured into a temporary, ought to /// have a temporary whose lifetime extends to the end of the enclosing *block*, diff --git a/compiler/rustc_middle/src/middle/resolve_bound_vars.rs b/compiler/rustc_middle/src/middle/resolve_bound_vars.rs index d0103f622313b..bad6e63f023b7 100644 --- a/compiler/rustc_middle/src/middle/resolve_bound_vars.rs +++ b/compiler/rustc_middle/src/middle/resolve_bound_vars.rs @@ -2,7 +2,7 @@ use crate::ty; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::DefId; use rustc_hir::{ItemLocalId, OwnerId}; @@ -51,7 +51,7 @@ pub enum ObjectLifetimeDefault { pub struct ResolveBoundVars { /// Maps from every use of a named (not anonymous) lifetime to a /// `Region` describing how that region is bound - pub defs: FxIndexMap>, + pub defs: GxIndexMap>, - pub late_bound_vars: FxIndexMap>>, + pub late_bound_vars: GxIndexMap>>, } diff --git a/compiler/rustc_middle/src/mir/basic_blocks.rs b/compiler/rustc_middle/src/mir/basic_blocks.rs index f9398b254c7b1..42e71d7a4871e 100644 --- a/compiler/rustc_middle/src/mir/basic_blocks.rs +++ b/compiler/rustc_middle/src/mir/basic_blocks.rs @@ -1,9 +1,9 @@ use crate::mir::traversal::Postorder; use crate::mir::{BasicBlock, BasicBlockData, Terminator, TerminatorKind, START_BLOCK}; -use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::graph; use rustc_data_structures::graph::dominators::{dominators, Dominators}; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::OnceLock; use rustc_index::{IndexSlice, IndexVec}; @@ -20,7 +20,7 @@ pub struct BasicBlocks<'tcx> { // Typically 95%+ of basic blocks have 4 or fewer predecessors. pub type Predecessors = IndexVec>; -pub type SwitchSources = FxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option; 1]>>; +pub type SwitchSources = GxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option; 1]>>; #[derive(Clone, Default, Debug)] struct Cache { @@ -82,7 +82,7 @@ impl<'tcx> BasicBlocks<'tcx> { #[inline] pub fn switch_sources(&self) -> &SwitchSources { self.cache.switch_sources.get_or_init(|| { - let mut switch_sources: SwitchSources = FxHashMap::default(); + let mut switch_sources: SwitchSources = GxHashMap::default(); for (bb, data) in self.basic_blocks.iter_enumerated() { if let Some(Terminator { kind: TerminatorKind::SwitchInt { targets, .. }, .. diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index cac3bf948a0c1..91dcdc0159e82 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -119,7 +119,7 @@ const MAX_BYTES_TO_HASH: usize = 64; const MAX_HASHED_BUFFER_LEN: usize = 2 * MAX_BYTES_TO_HASH; // Const allocations are only hashed for interning. However, they can be large, making the hashing -// expensive especially since it uses `FxHash`: it's better suited to short keys, not potentially +// expensive especially since it uses `GxHash`: it's better suited to short keys, not potentially // big buffers like the actual bytes of allocation. We can partially hash some fields when they're // large. impl hash::Hash for Allocation { diff --git a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs index d60db775ff08a..0e789bea0f6f2 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs @@ -219,7 +219,7 @@ impl Decodable for InitMaskMaterialized { } // Const allocations are only hashed for interning. However, they can be large, making the hashing -// expensive especially since it uses `FxHash`: it's better suited to short keys, not potentially +// expensive especially since it uses `GxHash`: it's better suited to short keys, not potentially // big buffers like the allocation's init mask. We can partially hash some fields when they're // large. impl hash::Hash for InitMaskMaterialized { diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs index 16093cfca6add..bb3c071837fbc 100644 --- a/compiler/rustc_middle/src/mir/interpret/mod.rs +++ b/compiler/rustc_middle/src/mir/interpret/mod.rs @@ -18,7 +18,7 @@ use smallvec::{smallvec, SmallVec}; use tracing::{debug, trace}; use rustc_ast::LitKind; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock}; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -378,13 +378,13 @@ impl<'tcx> GlobalAlloc<'tcx> { pub(crate) struct AllocMap<'tcx> { /// Maps `AllocId`s to their corresponding allocations. - alloc_map: FxHashMap>, + alloc_map: GxHashMap>, /// Used to ensure that statics and functions only get one associated `AllocId`. /// Should never contain a `GlobalAlloc::Memory`! // // FIXME: Should we just have two separate dedup maps for statics and functions each? - dedup: FxHashMap, AllocId>, + dedup: GxHashMap, AllocId>, /// The `AllocId` to assign to the next requested ID. /// Always incremented; never gets smaller. diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index ef88b253864bd..941d0393b58a8 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -27,9 +27,9 @@ use rustc_target::abi::{FieldIdx, VariantIdx}; use polonius_engine::Atom; pub use rustc_ast::Mutability; -use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::Dominators; +use rustc_data_structures::gx::GxHashMap; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use rustc_index::{Idx, IndexSlice, IndexVec}; use rustc_serialize::{Decodable, Encodable}; @@ -110,8 +110,8 @@ impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> { } thread_local! { - static PASS_NAMES: RefCell> = { - RefCell::new(FxHashMap::default()) + static PASS_NAMES: RefCell> = { + RefCell::new(GxHashMap::default()) }; } @@ -1748,7 +1748,7 @@ impl Location { // If we're in another block, then we want to check that block is a predecessor of `other`. let mut queue: Vec = predecessors[other.block].to_vec(); - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); while let Some(block) = queue.pop() { // If we haven't visited this block before, then make sure we visit its predecessors. diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index 146cd6dfbeb7e..c18ca943505c6 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -5,7 +5,7 @@ use rustc_data_structures::base_n::BaseNString; use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::CASE_INSENSITIVE; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher, ToStableHashKey}; use rustc_data_structures::unord::UnordMap; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -258,7 +258,7 @@ pub struct CodegenUnit<'tcx> { /// contain something unique to this crate (e.g., a module path) /// as well as the crate name and disambiguator. name: Symbol, - items: FxIndexMap, MonoItemData>, + items: GxIndexMap, MonoItemData>, size_estimate: usize, primary: bool, /// True if this is CGU is used to hold code coverage information for dead code, @@ -333,11 +333,11 @@ impl<'tcx> CodegenUnit<'tcx> { self.primary = true; } - pub fn items(&self) -> &FxIndexMap, MonoItemData> { + pub fn items(&self) -> &GxIndexMap, MonoItemData> { &self.items } - pub fn items_mut(&mut self) -> &mut FxIndexMap, MonoItemData> { + pub fn items_mut(&mut self) -> &mut GxIndexMap, MonoItemData> { &mut self.items } diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 4657f4dcf8132..ed2bbc5c9919c 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -317,7 +317,7 @@ where fn write_scope_tree( tcx: TyCtxt<'_>, body: &Body<'_>, - scope_tree: &FxHashMap>, + scope_tree: &GxHashMap>, w: &mut dyn io::Write, parent: SourceScope, depth: usize, @@ -458,7 +458,7 @@ pub fn write_mir_intro<'tcx>( writeln!(w, "{{")?; // construct a scope tree and write it out - let mut scope_tree: FxHashMap> = Default::default(); + let mut scope_tree: GxHashMap> = Default::default(); for (index, scope_data) in body.source_scopes.iter().enumerate() { if let Some(parent) = scope_data.parent_scope { scope_tree.entry(parent).or_default().push(SourceScope::new(index)); diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 46b38e4a6a60c..8ed626b991d8c 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -2,7 +2,7 @@ use crate::mir; use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::LocalDefId; use rustc_index::bit_set::BitMatrix; @@ -121,7 +121,7 @@ pub struct BorrowCheckResult<'tcx> { /// All the opaque types that are restricted to concrete types /// by this function. Unlike the value in `TypeckResults`, this has /// unerased regions. - pub concrete_opaque_types: FxIndexMap>, + pub concrete_opaque_types: GxIndexMap>, pub closure_requirements: Option>, pub used_mut_upvars: SmallVec<[FieldIdx; 8]>, pub tainted_by_errors: Option, diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs index ed592612358be..164a93bd7821b 100644 --- a/compiler/rustc_middle/src/mir/terminator.rs +++ b/compiler/rustc_middle/src/mir/terminator.rs @@ -90,7 +90,7 @@ impl SwitchTargets { /// Returns true if all targets (including the fallback target) are distinct. #[inline] pub fn is_distinct(&self) -> bool { - self.targets.iter().collect::>().len() == self.targets.len() + self.targets.iter().collect::>().len() == self.targets.len() } } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 230a44bcf2452..3703de88fcf9d 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -59,7 +59,7 @@ use rustc_ast as ast; use rustc_ast::expand::{allocator::AllocatorKind, StrippedCfgItem}; use rustc_attr as attr; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::steal::Steal; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; @@ -479,7 +479,7 @@ rustc_queries! { /// Set of all the `DefId`s in this crate that have MIR associated with /// them. This includes all the body owners, but also things like struct /// constructors. - query mir_keys(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexSet { + query mir_keys(_: ()) -> &'tcx rustc_data_structures::gx::GxIndexSet { arena_cache desc { "getting a list of all mir_keys" } } @@ -1239,7 +1239,7 @@ rustc_queries! { feedable } - query asm_target_features(def_id: DefId) -> &'tcx FxIndexSet { + query asm_target_features(def_id: DefId) -> &'tcx GxIndexSet { desc { |tcx| "computing target features for inline asm of `{}`", tcx.def_path_str(def_id) } } @@ -1305,7 +1305,7 @@ rustc_queries! { } /// Return all `impl` blocks in the current crate. - query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::fx::FxIndexMap> { + query all_local_trait_impls(_: ()) -> &'tcx rustc_data_structures::gx::GxIndexMap> { desc { "finding local trait impls" } } @@ -1632,7 +1632,7 @@ rustc_queries! { } /// Returns a list of all `extern` blocks of a crate. - query foreign_modules(_: CrateNum) -> &'tcx FxIndexMap { + query foreign_modules(_: CrateNum) -> &'tcx GxIndexMap { arena_cache desc { "looking up the foreign modules of a linked crate" } separate_provide_extern @@ -1715,10 +1715,10 @@ rustc_queries! { desc { "resolving lifetimes" } } query named_variable_map(_: hir::OwnerId) -> - Option<&'tcx FxIndexMap> { + Option<&'tcx GxIndexMap> { desc { "looking up a named region" } } - query is_late_bound_map(_: hir::OwnerId) -> Option<&'tcx FxIndexSet> { + query is_late_bound_map(_: hir::OwnerId) -> Option<&'tcx GxIndexSet> { desc { "testing if a region is late bound" } } /// For a given item's generic parameter, gets the default lifetimes to be used @@ -1731,7 +1731,7 @@ rustc_queries! { separate_provide_extern } query late_bound_vars_map(_: hir::OwnerId) - -> Option<&'tcx FxIndexMap>> { + -> Option<&'tcx GxIndexMap>> { desc { "looking up late bound vars" } } @@ -1886,10 +1886,10 @@ rustc_queries! { desc { "alloc error handler kind for the current crate" } } - query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap> { + query upvars_mentioned(def_id: DefId) -> Option<&'tcx GxIndexMap> { desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) } } - query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet { + query maybe_unused_trait_imports(_: ()) -> &'tcx GxIndexSet { desc { "fetching potentially unused trait imports" } } query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx UnordSet { diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index 924249bf37d6c..b161fd7710abd 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexSet}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, RwLock}; use rustc_data_structures::unhash::UnhashMap; @@ -56,21 +56,21 @@ pub struct OnDiskCache<'sess> { // Collects all `QuerySideEffects` created during the current compilation // session. - current_side_effects: Lock>, + current_side_effects: Lock>, source_map: &'sess SourceMap, - file_index_to_stable_id: FxHashMap, + file_index_to_stable_id: GxHashMap, // Caches that are populated lazily during decoding. - file_index_to_file: Lock>>, + file_index_to_file: Lock>>, // A map from dep-node to the position of the cached query result in // `serialized_data`. - query_result_index: FxHashMap, + query_result_index: GxHashMap, // A map from dep-node to the position of any associated `QuerySideEffects` in // `serialized_data`. - prev_side_effects_index: FxHashMap, + prev_side_effects_index: GxHashMap, alloc_decoding_state: AllocDecodingState, @@ -79,7 +79,7 @@ pub struct OnDiskCache<'sess> { // to represent the fact that we are storing *encoded* ids. When we decode // a `SyntaxContext`, a new id will be allocated from the global `HygieneData`, // which will almost certainly be different than the serialized id. - syntax_contexts: FxHashMap, + syntax_contexts: GxHashMap, // A map from the `DefPathHash` of an `ExpnId` to the position // of their associated `ExpnData`. Ideally, we would store a `DefId`, // but we need to decode this before we've constructed a `TyCtxt` (which @@ -102,7 +102,7 @@ pub struct OnDiskCache<'sess> { // This type is used only for serialization and deserialization. #[derive(Encodable, Decodable)] struct Footer { - file_index_to_stable_id: FxHashMap, + file_index_to_stable_id: GxHashMap, query_result_index: EncodedDepNodeIndex, side_effects_index: EncodedDepNodeIndex, // The location of all allocations. @@ -110,7 +110,7 @@ struct Footer { // without measurable overhead. This permits larger const allocations without ICEing. interpret_alloc_index: Vec, // See `OnDiskCache.syntax_contexts` - syntax_contexts: FxHashMap, + syntax_contexts: GxHashMap, // See `OnDiskCache.expn_data` expn_data: UnhashMap, foreign_expn_data: UnhashMap, @@ -198,7 +198,7 @@ impl<'sess> OnDiskCache<'sess> { query_result_index: Default::default(), prev_side_effects_index: Default::default(), alloc_decoding_state: AllocDecodingState::new(Vec::new()), - syntax_contexts: FxHashMap::default(), + syntax_contexts: GxHashMap::default(), expn_data: UnhashMap::default(), foreign_expn_data: UnhashMap::default(), hygiene_context: Default::default(), @@ -229,9 +229,9 @@ impl<'sess> OnDiskCache<'sess> { let (file_to_file_index, file_index_to_stable_id) = { let files = tcx.sess.source_map().files(); let mut file_to_file_index = - FxHashMap::with_capacity_and_hasher(files.len(), Default::default()); + GxHashMap::with_capacity_and_hasher(files.len(), Default::default()); let mut file_index_to_stable_id = - FxHashMap::with_capacity_and_hasher(files.len(), Default::default()); + GxHashMap::with_capacity_and_hasher(files.len(), Default::default()); for (index, file) in files.iter().enumerate() { let index = SourceFileIndex(index as u32); @@ -303,7 +303,7 @@ impl<'sess> OnDiskCache<'sess> { interpret_alloc_index }; - let mut syntax_contexts = FxHashMap::default(); + let mut syntax_contexts = GxHashMap::default(); let mut expn_data = UnhashMap::default(); let mut foreign_expn_data = UnhashMap::default(); @@ -416,7 +416,7 @@ impl<'sess> OnDiskCache<'sess> { &self, tcx: TyCtxt<'tcx>, dep_node_index: SerializedDepNodeIndex, - index: &FxHashMap, + index: &GxHashMap, ) -> Option where T: for<'a> Decodable>, @@ -462,10 +462,10 @@ pub struct CacheDecoder<'a, 'tcx> { tcx: TyCtxt<'tcx>, opaque: MemDecoder<'a>, source_map: &'a SourceMap, - file_index_to_file: &'a Lock>>, - file_index_to_stable_id: &'a FxHashMap, + file_index_to_file: &'a Lock>>, + file_index_to_stable_id: &'a GxHashMap, alloc_decoding_session: AllocDecodingSession<'a>, - syntax_contexts: &'a FxHashMap, + syntax_contexts: &'a GxHashMap, expn_data: &'a UnhashMap, foreign_expn_data: &'a UnhashMap, hygiene_context: &'a HygieneDecodeContext, @@ -820,13 +820,13 @@ impl_ref_decoder! {<'tcx> pub struct CacheEncoder<'a, 'tcx> { tcx: TyCtxt<'tcx>, encoder: FileEncoder, - type_shorthands: FxHashMap, usize>, - predicate_shorthands: FxHashMap, usize>, - interpret_allocs: FxIndexSet, + type_shorthands: GxHashMap, usize>, + predicate_shorthands: GxHashMap, usize>, + interpret_allocs: GxIndexSet, source_map: CachingSourceMapView<'tcx>, - file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>, + file_to_file_index: GxHashMap<*const SourceFile, SourceFileIndex>, hygiene_context: &'a HygieneEncodeContext, - symbol_table: FxHashMap, + symbol_table: GxHashMap, } impl<'a, 'tcx> CacheEncoder<'a, 'tcx> { @@ -954,11 +954,11 @@ impl<'a, 'tcx> TyEncoder for CacheEncoder<'a, 'tcx> { self.encoder.position() } #[inline] - fn type_shorthands(&mut self) -> &mut FxHashMap, usize> { + fn type_shorthands(&mut self) -> &mut GxHashMap, usize> { &mut self.type_shorthands } #[inline] - fn predicate_shorthands(&mut self) -> &mut FxHashMap, usize> { + fn predicate_shorthands(&mut self) -> &mut GxHashMap, usize> { &mut self.predicate_shorthands } #[inline] diff --git a/compiler/rustc_middle/src/traits/solve/cache.rs b/compiler/rustc_middle/src/traits/solve/cache.rs index 72a8d4eb4050c..ab9a435dab322 100644 --- a/compiler/rustc_middle/src/traits/solve/cache.rs +++ b/compiler/rustc_middle/src/traits/solve/cache.rs @@ -1,6 +1,6 @@ use super::{inspect, CanonicalInput, QueryResult}; use crate::ty::TyCtxt; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::sync::Lock; use rustc_query_system::cache::WithDepNode; use rustc_query_system::dep_graph::DepNodeIndex; @@ -13,7 +13,7 @@ use rustc_type_ir::solve::CacheData; /// this works. #[derive(Default)] pub struct EvaluationCache<'tcx> { - map: Lock, CacheEntry<'tcx>>>, + map: Lock, CacheEntry<'tcx>>>, } impl<'tcx> rustc_type_ir::inherent::EvaluationCache> for &'tcx EvaluationCache<'tcx> { @@ -25,7 +25,7 @@ impl<'tcx> rustc_type_ir::inherent::EvaluationCache> for &'tcx Eval proof_tree: Option<&'tcx inspect::CanonicalGoalEvaluationStep>>, additional_depth: usize, encountered_overflow: bool, - cycle_participants: FxHashSet>, + cycle_participants: GxHashSet>, dep_node: DepNodeIndex, result: QueryResult<'tcx>, ) { @@ -116,6 +116,6 @@ struct CacheEntry<'tcx> { /// /// See the doc comment of `StackEntry::cycle_participants` for more /// details. - cycle_participants: FxHashSet>, - with_overflow: FxHashMap>>, + cycle_participants: GxHashSet>, + with_overflow: GxHashMap>>, } diff --git a/compiler/rustc_middle/src/traits/specialization_graph.rs b/compiler/rustc_middle/src/traits/specialization_graph.rs index ff5d51bcb66f5..f7922f5996d2a 100644 --- a/compiler/rustc_middle/src/traits/specialization_graph.rs +++ b/compiler/rustc_middle/src/traits/specialization_graph.rs @@ -2,7 +2,7 @@ use crate::error::StrictCoherenceNeedsNegativeCoherence; use crate::ty::fast_reject::SimplifiedType; use crate::ty::visit::TypeVisitableExt; use crate::ty::{self, TyCtxt}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::{DefId, DefIdMap}; use rustc_macros::{HashStable, TyDecodable, TyEncodable}; @@ -107,7 +107,7 @@ pub struct Children { // together *all* the impls for a trait, and are populated prior to building // the specialization graph. /// Impls of the trait. - pub non_blanket_impls: FxIndexMap>, + pub non_blanket_impls: GxIndexMap>, /// Blanket impls associated with the trait. pub blanket_impls: Vec, diff --git a/compiler/rustc_middle/src/traits/util.rs b/compiler/rustc_middle/src/traits/util.rs index adbb6cf2ddc94..a481424d6fd85 100644 --- a/compiler/rustc_middle/src/traits/util.rs +++ b/compiler/rustc_middle/src/traits/util.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use crate::ty::{Clause, PolyTraitRef, ToPolyTraitRef, TyCtxt, Upcast}; @@ -12,7 +12,7 @@ pub fn super_predicates_for_pretty_printing<'tcx>( trait_ref: PolyTraitRef<'tcx>, ) -> impl Iterator> { let clause = trait_ref.upcast(tcx); - Elaborator { tcx, visited: FxHashSet::from_iter([clause]), stack: vec![clause] } + Elaborator { tcx, visited: GxHashSet::from_iter([clause]), stack: vec![clause] } } /// Like [`super_predicates_for_pretty_printing`], except it only returns traits and filters out @@ -28,7 +28,7 @@ pub fn supertraits_for_pretty_printing<'tcx>( struct Elaborator<'tcx> { tcx: TyCtxt<'tcx>, - visited: FxHashSet>, + visited: GxHashSet>, stack: Vec>, } diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs index 8e221cdc603ba..e0e997bb53755 100644 --- a/compiler/rustc_middle/src/ty/adt.rs +++ b/compiler/rustc_middle/src/ty/adt.rs @@ -3,7 +3,7 @@ use crate::ty; use crate::ty::util::{Discr, IntTypeExt}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::intern::Interned; use rustc_data_structures::stable_hasher::HashingControls; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -146,7 +146,7 @@ impl Hash for AdtDefData { impl<'a> HashStable> for AdtDefData { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { thread_local! { - static CACHE: RefCell> = Default::default(); + static CACHE: RefCell> = Default::default(); } let hash: Fingerprint = CACHE.with(|cache| { diff --git a/compiler/rustc_middle/src/ty/closure.rs b/compiler/rustc_middle/src/ty/closure.rs index bade0d564156f..c354192810d9f 100644 --- a/compiler/rustc_middle/src/ty/closure.rs +++ b/compiler/rustc_middle/src/ty/closure.rs @@ -7,7 +7,7 @@ use std::fmt::Write; use crate::query::Providers; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_hir::HirId; @@ -70,7 +70,7 @@ pub type MinCaptureInformationMap<'tcx> = LocalDefIdMap = FxIndexMap>; +pub type RootVariableMinCaptureList<'tcx> = GxIndexMap>; /// Part of `MinCaptureInformationMap`; List of `CapturePlace`s. pub type MinCaptureList<'tcx> = Vec>; diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 33f564e9b59c3..685c28c56cffe 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -16,7 +16,7 @@ use crate::mir::{ use crate::traits; use crate::ty::GenericArgsRef; use crate::ty::{self, AdtDef, Ty}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::LocalDefId; use rustc_middle::ty::TyCtxt; use rustc_serialize::{Decodable, Encodable}; @@ -59,7 +59,7 @@ impl<'tcx, E: TyEncoder>> EncodableWithShorthand for ty::Pre /// Trait for decoding to a reference. /// /// This is a separate trait from `Decodable` so that we can implement it for -/// upstream types, such as `FxHashSet`. +/// upstream types, such as `GxHashSet`. /// /// The `TyDecodable` derive macro will use this trait for fields that are /// references (and don't use a type alias to hide that). @@ -74,7 +74,7 @@ pub trait RefDecodable<'tcx, D: TyDecoder>> { pub fn encode_with_shorthand<'tcx, E, T, M>(encoder: &mut E, value: &T, cache: M) where E: TyEncoder>, - M: for<'b> Fn(&'b mut E) -> &'b mut FxHashMap, + M: for<'b> Fn(&'b mut E) -> &'b mut GxHashMap, T: EncodableWithShorthand, // The discriminant and shorthand must have the same size. T::Variant: DiscriminantKind, diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 4bac9396e59a9..c8bfde5756b73 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -37,7 +37,7 @@ use crate::ty::{GenericArg, GenericArgs, GenericArgsRef}; use rustc_ast::{self as ast, attr}; use rustc_data_structures::defer; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::intern::Interned; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap}; @@ -1237,8 +1237,8 @@ pub struct GlobalCtxt<'tcx> { pub(crate) query_kinds: &'tcx [DepKindStruct<'tcx>], // Internal caches for metadata decoding. No need to track deps on this. - pub ty_rcache: Lock>>, - pub pred_rcache: Lock>>, + pub ty_rcache: Lock>>, + pub pred_rcache: Lock>>, /// Caches the results of trait selection. This cache is used /// for things that do not have to do with the parameters in scope. @@ -2466,7 +2466,7 @@ impl<'tcx> TyCtxt<'tcx> { /// to identify which traits may define a given associated type to help avoid cycle errors. /// Returns a `DefId` iterator. fn super_traits_of(self, trait_def_id: DefId) -> impl Iterator + 'tcx { - let mut set = FxHashSet::default(); + let mut set = GxHashSet::default(); let mut stack = vec![trait_def_id]; set.insert(trait_def_id); diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index 4bf2233799130..79778a1679f11 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -10,7 +10,7 @@ use crate::ty::{ TypeSuperVisitable, TypeVisitable, TypeVisitor, }; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{into_diag_arg_using_display, Applicability, Diag, DiagArgValue, IntoDiagArg}; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -248,7 +248,7 @@ pub fn suggest_constraining_type_params<'a>( param_names_and_constraints: impl Iterator)>, span_to_replace: Option, ) -> bool { - let mut grouped = FxHashMap::default(); + let mut grouped = GxHashMap::default(); param_names_and_constraints.for_each(|(param_name, constraint, def_id)| { grouped.entry(param_name).or_insert(Vec::new()).push((constraint, def_id)) }); diff --git a/compiler/rustc_middle/src/ty/fold.rs b/compiler/rustc_middle/src/ty/fold.rs index 81ea8738e7269..9b8f15528cf2d 100644 --- a/compiler/rustc_middle/src/ty/fold.rs +++ b/compiler/rustc_middle/src/ty/fold.rs @@ -1,5 +1,5 @@ use crate::ty::{self, Binder, BoundTy, Ty, TyCtxt, TypeVisitableExt}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir::def_id::DefId; use tracing::{debug, instrument}; @@ -255,12 +255,12 @@ impl<'tcx> TyCtxt<'tcx> { self, value: Binder<'tcx, T>, mut fld_r: F, - ) -> (T, FxIndexMap>) + ) -> (T, GxIndexMap>) where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, T: TypeFoldable>, { - let mut region_map = FxIndexMap::default(); + let mut region_map = GxIndexMap::default(); let real_fld_r = |br: ty::BoundRegion| *region_map.entry(br).or_insert_with(|| fld_r(br)); let value = self.instantiate_bound_regions_uncached(value, real_fld_r); (value, region_map) @@ -374,7 +374,7 @@ impl<'tcx> TyCtxt<'tcx> { { struct Anonymize<'a, 'tcx> { tcx: TyCtxt<'tcx>, - map: &'a mut FxIndexMap, + map: &'a mut GxIndexMap, } impl<'tcx> BoundVarReplacerDelegate<'tcx> for Anonymize<'_, 'tcx> { fn replace_region(&mut self, br: ty::BoundRegion) -> ty::Region<'tcx> { diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 6467689a8aa15..4fdc240375aa5 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -1,7 +1,7 @@ use crate::ty; use crate::ty::{EarlyBinder, GenericArgsRef}; use rustc_ast as ast; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::DefId; use rustc_macros::{HashStable, TyDecodable, TyEncodable}; use rustc_span::symbol::{kw, Symbol}; @@ -129,7 +129,7 @@ pub struct Generics { /// Reverse map to the `index` field of each `GenericParamDef`. #[stable_hasher(ignore)] - pub param_def_id_to_index: FxHashMap, + pub param_def_id_to_index: GxHashMap, pub has_self: bool, pub has_late_bound_regions: Option, diff --git a/compiler/rustc_middle/src/ty/impls_ty.rs b/compiler/rustc_middle/src/ty/impls_ty.rs index efcf428c2136f..c5b6a33799474 100644 --- a/compiler/rustc_middle/src/ty/impls_ty.rs +++ b/compiler/rustc_middle/src/ty/impls_ty.rs @@ -6,7 +6,7 @@ use crate::mir; use crate::ty; use crate::ty::fast_reject::SimplifiedType; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::stable_hasher::HashingControls; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_query_system::ich::StableHashingContext; @@ -20,7 +20,7 @@ where { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { thread_local! { - static CACHE: RefCell> = + static CACHE: RefCell> = RefCell::new(Default::default()); } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 9c2bfc12a18a1..02d343e8a5d56 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -35,7 +35,7 @@ use rustc_ast::expand::StrippedCfgItem; use rustc_ast::node_id::NodeMap; pub use rustc_ast_ir::{try_visit, Movability, Mutability}; use rustc_attr as attr; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap, GxIndexSet}; use rustc_data_structures::intern::Interned; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::steal::Steal; @@ -176,23 +176,23 @@ pub struct ResolverOutputs { pub struct ResolverGlobalCtxt { pub visibilities_for_hashing: Vec<(LocalDefId, Visibility)>, /// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`. - pub expn_that_defined: FxHashMap, + pub expn_that_defined: GxHashMap, pub effective_visibilities: EffectiveVisibilities, - pub extern_crate_map: FxHashMap, - pub maybe_unused_trait_imports: FxIndexSet, + pub extern_crate_map: GxHashMap, + pub maybe_unused_trait_imports: GxIndexSet, pub module_children: LocalDefIdMap>, - pub glob_map: FxHashMap>, + pub glob_map: GxHashMap>, pub main_def: Option, - pub trait_impls: FxIndexMap>, + pub trait_impls: GxIndexMap>, /// A list of proc macro LocalDefIds, written out in the order in which /// they are declared in the static array generated by proc_macro_harness. pub proc_macros: Vec, /// Mapping from ident span to path span for paths that don't exist as written, but that /// exist under `std`. For example, wrote `str::from_utf8` instead of `std::str::from_utf8`. - pub confused_type_with_std_module: FxHashMap, - pub doc_link_resolutions: FxHashMap, - pub doc_link_traits_in_scope: FxHashMap>, - pub all_macro_rules: FxHashMap>, + pub confused_type_with_std_module: GxHashMap, + pub doc_link_resolutions: GxHashMap, + pub doc_link_traits_in_scope: GxHashMap>, + pub all_macro_rules: GxHashMap>, pub stripped_cfg_items: Steal>, } @@ -200,7 +200,7 @@ pub struct ResolverGlobalCtxt { /// This struct is meant to be consumed by lowering. #[derive(Debug)] pub struct ResolverAstLowering { - pub legacy_const_generic_args: FxHashMap>>, + pub legacy_const_generic_args: GxHashMap>>, /// Resolutions for nodes that have a single resolution. pub partial_res_map: NodeMap, @@ -219,7 +219,7 @@ pub struct ResolverAstLowering { pub trait_map: NodeMap>, /// List functions and methods for which lifetime elision was successful. - pub lifetime_elision_allowed: FxHashSet, + pub lifetime_elision_allowed: GxHashSet, /// Lints that were emitted by the resolver and early lints. pub lint_buffer: Steal, diff --git a/compiler/rustc_middle/src/ty/opaque_types.rs b/compiler/rustc_middle/src/ty/opaque_types.rs index 70a54e96d3678..a88942b0da209 100644 --- a/compiler/rustc_middle/src/ty/opaque_types.rs +++ b/compiler/rustc_middle/src/ty/opaque_types.rs @@ -2,7 +2,7 @@ use crate::error::ConstNotUsedTraitAlias; use crate::ty::fold::{TypeFolder, TypeSuperFoldable}; use crate::ty::{self, Ty, TyCtxt, TypeFoldable}; use crate::ty::{GenericArg, GenericArgKind}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_span::def_id::DefId; use rustc_span::Span; use tracing::{debug, instrument, trace}; @@ -14,7 +14,7 @@ pub type OpaqueTypeKey<'tcx> = rustc_type_ir::OpaqueTypeKey>; /// list to the opaque type's own generics. pub(super) struct ReverseMapper<'tcx> { tcx: TyCtxt<'tcx>, - map: FxHashMap, GenericArg<'tcx>>, + map: GxHashMap, GenericArg<'tcx>>, /// see call sites to fold_kind_no_missing_regions_error /// for an explanation of this field. do_not_error: bool, @@ -32,7 +32,7 @@ pub(super) struct ReverseMapper<'tcx> { impl<'tcx> ReverseMapper<'tcx> { pub(super) fn new( tcx: TyCtxt<'tcx>, - map: FxHashMap, GenericArg<'tcx>>, + map: GxHashMap, GenericArg<'tcx>>, span: Span, ignore_errors: bool, ) -> Self { diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 3c27df9529aa1..5fdfb60ec5975 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -2,7 +2,7 @@ use crate::ty::GenericArg; use crate::ty::{self, Ty, TyCtxt}; use hir::def::Namespace; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::sso::SsoHashSet; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId}; diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 19700353f5944..4512dc42c57dd 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -9,7 +9,7 @@ use crate::ty::{ }; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; use rustc_apfloat::Float; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_data_structures::unord::UnordMap; use rustc_hir as hir; use rustc_hir::def::{self, CtorKind, DefKind, Namespace}; @@ -985,8 +985,8 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { // by looking up the projections associated with the def_id. let bounds = tcx.explicit_item_bounds(def_id); - let mut traits = FxIndexMap::default(); - let mut fn_traits = FxIndexMap::default(); + let mut traits = GxIndexMap::default(); + let mut fn_traits = GxIndexMap::default(); let mut has_sized_bound = false; let mut has_negative_sized_bound = false; let mut lifetimes = SmallVec::<[ty::Region<'tcx>; 1]>::new(); @@ -1231,11 +1231,11 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { trait_ref: ty::PolyTraitRef<'tcx>, polarity: ty::PredicatePolarity, proj_ty: Option<(DefId, ty::Binder<'tcx, Term<'tcx>>)>, - traits: &mut FxIndexMap< + traits: &mut GxIndexMap< (ty::PolyTraitRef<'tcx>, ty::PredicatePolarity), - FxIndexMap>>, + GxIndexMap>>, >, - fn_traits: &mut FxIndexMap, OpaqueFnEntry<'tcx>>, + fn_traits: &mut GxIndexMap, OpaqueFnEntry<'tcx>>, ) { let trait_def_id = trait_ref.def_id(); @@ -1994,7 +1994,7 @@ pub struct FmtPrinterData<'a, 'tcx> { pub print_alloc_ids: bool, // set of all named (non-anonymous) region names - used_region_names: FxHashSet, + used_region_names: GxHashSet, region_index: usize, binder_depth: usize, @@ -2791,7 +2791,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> { T: TypeVisitable>, { struct RegionNameCollector<'tcx> { - used_region_names: FxHashSet, + used_region_names: GxHashSet, type_collector: SsoHashSet>, } @@ -3309,8 +3309,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap { // Once constructed, unique namespace+symbol pairs will have a `Some(_)` entry, while // non-unique pairs will have a `None` entry. - let unique_symbols_rev: &mut FxHashMap<(Namespace, Symbol), Option> = - &mut FxHashMap::default(); + let unique_symbols_rev: &mut GxHashMap<(Namespace, Symbol), Option> = + &mut GxHashMap::default(); for symbol_set in tcx.resolutions(()).glob_map.values() { for symbol in symbol_set { diff --git a/compiler/rustc_middle/src/ty/trait_def.rs b/compiler/rustc_middle/src/ty/trait_def.rs index 4dba97c3b5b83..37edf624c477e 100644 --- a/compiler/rustc_middle/src/ty/trait_def.rs +++ b/compiler/rustc_middle/src/ty/trait_def.rs @@ -7,7 +7,7 @@ use rustc_hir::def_id::DefId; use std::iter; use tracing::debug; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_macros::{Decodable, Encodable, HashStable}; @@ -91,7 +91,7 @@ pub enum TraitSpecializationKind { pub struct TraitImpls { blanket_impls: Vec, /// Impls indexed by their simplified self type, for fast lookup. - non_blanket_impls: FxIndexMap>, + non_blanket_impls: GxIndexMap>, } impl TraitImpls { @@ -103,7 +103,7 @@ impl TraitImpls { self.blanket_impls.as_slice() } - pub fn non_blanket_impls(&self) -> &FxIndexMap> { + pub fn non_blanket_impls(&self) -> &GxIndexMap> { &self.non_blanket_impls } } diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs index 24e3e623ff274..b51f59a3d6901 100644 --- a/compiler/rustc_middle/src/ty/typeck_results.rs +++ b/compiler/rustc_middle/src/ty/typeck_results.rs @@ -7,7 +7,7 @@ use crate::{ GenericArgs, GenericArgsRef, Ty, UserArgs, }, }; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::unord::{ExtendUnord, UnordItems, UnordSet}; use rustc_errors::ErrorGuaranteed; use rustc_hir::{ @@ -166,7 +166,7 @@ pub struct TypeckResults<'tcx> { /// We also store the type here, so that the compiler can use it as a hint /// for figuring out hidden types, even if they are only set in dead code /// (which doesn't show up in MIR). - pub concrete_opaque_types: FxIndexMap, ty::OpaqueHiddenType<'tcx>>, + pub concrete_opaque_types: GxIndexMap, ty::OpaqueHiddenType<'tcx>>, /// Tracks the minimum captures required for a closure; /// see `MinCaptureInformationMap` for more details. @@ -203,7 +203,7 @@ pub struct TypeckResults<'tcx> { /// Stores the predicates that apply on coroutine witness types. /// formatting modified file tests/ui/coroutine/retain-resume-ref.rs - pub coroutine_stalled_predicates: FxIndexSet<(ty::Predicate<'tcx>, ObligationCause<'tcx>)>, + pub coroutine_stalled_predicates: GxIndexSet<(ty::Predicate<'tcx>, ObligationCause<'tcx>)>, /// We sometimes treat byte string literals (which are of type `&[u8; N]`) /// as `&[u8]`, depending on the pattern in which they are used. diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 9307e38068128..e9545c2ce5ce7 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -9,7 +9,7 @@ use crate::ty::{ }; use crate::ty::{GenericArgKind, GenericArgsRef}; use rustc_apfloat::Float as _; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::ErrorGuaranteed; @@ -524,7 +524,7 @@ impl<'tcx> TyCtxt<'tcx> { ignore_regions: CheckRegions, ) -> Result<(), NotUniqueParam<'tcx>> { let mut seen = GrowableBitSet::default(); - let mut seen_late = FxHashSet::default(); + let mut seen_late = GxHashSet::default(); for arg in args { match arg.unpack() { GenericArgKind::Lifetime(lt) => match (ignore_regions, lt.kind()) { @@ -761,8 +761,8 @@ impl<'tcx> TyCtxt<'tcx> { inspect_coroutine_fields: InspectCoroutineFields, ) -> Result, Ty<'tcx>> { let mut visitor = OpaqueTypeExpander { - seen_opaque_tys: FxHashSet::default(), - expanded_cache: FxHashMap::default(), + seen_opaque_tys: GxHashSet::default(), + expanded_cache: GxHashMap::default(), primary_def_id: Some(def_id), found_recursion: false, found_any_recursion: false, @@ -994,10 +994,10 @@ struct OpaqueTypeExpander<'tcx> { // expanded. When we expand an opaque type we insert the DefId of // that type, and when we finish expanding that type we remove the // its DefId. - seen_opaque_tys: FxHashSet, + seen_opaque_tys: GxHashSet, // Cache of all expansions we've seen so far. This is a critical // optimization for some large types produced by async fn trees. - expanded_cache: FxHashMap<(DefId, GenericArgsRef<'tcx>), Ty<'tcx>>, + expanded_cache: GxHashMap<(DefId, GenericArgsRef<'tcx>), Ty<'tcx>>, primary_def_id: Option, found_recursion: bool, found_any_recursion: bool, @@ -1816,8 +1816,8 @@ pub fn reveal_opaque_types_in_bounds<'tcx>( val: ty::Clauses<'tcx>, ) -> ty::Clauses<'tcx> { let mut visitor = OpaqueTypeExpander { - seen_opaque_tys: FxHashSet::default(), - expanded_cache: FxHashMap::default(), + seen_opaque_tys: GxHashSet::default(), + expanded_cache: GxHashMap::default(), primary_def_id: None, found_recursion: false, found_any_recursion: false, diff --git a/compiler/rustc_middle/src/ty/visit.rs b/compiler/rustc_middle/src/ty/visit.rs index b1bbfd420e1b1..043336181df35 100644 --- a/compiler/rustc_middle/src/ty/visit.rs +++ b/compiler/rustc_middle/src/ty/visit.rs @@ -1,6 +1,6 @@ use crate::ty::{self, Binder, Ty, TyCtxt, TypeFlags}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_type_ir::fold::TypeFoldable; use std::ops::ControlFlow; @@ -110,7 +110,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn collect_constrained_late_bound_regions( self, value: Binder<'tcx, T>, - ) -> FxHashSet + ) -> GxHashSet where T: TypeFoldable>, { @@ -121,7 +121,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn collect_referenced_late_bound_regions( self, value: Binder<'tcx, T>, - ) -> FxHashSet + ) -> GxHashSet where T: TypeFoldable>, { @@ -132,7 +132,7 @@ impl<'tcx> TyCtxt<'tcx> { self, value: Binder<'tcx, T>, just_constrained: bool, - ) -> FxHashSet + ) -> GxHashSet where T: TypeFoldable>, { @@ -148,7 +148,7 @@ impl<'tcx> TyCtxt<'tcx> { /// into a hash set. struct LateBoundRegionsCollector { current_index: ty::DebruijnIndex, - regions: FxHashSet, + regions: GxHashSet, /// `true` if we only want regions that are known to be /// "constrained" when you equate this type with another type. In diff --git a/compiler/rustc_middle/src/ty/vtable.rs b/compiler/rustc_middle/src/ty/vtable.rs index dc3c84f9e439a..08909b4ef0fc0 100644 --- a/compiler/rustc_middle/src/ty/vtable.rs +++ b/compiler/rustc_middle/src/ty/vtable.rs @@ -3,7 +3,7 @@ use std::fmt; use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar}; use crate::ty::{self, Instance, PolyTraitRef, Ty, TyCtxt}; use rustc_ast::Mutability; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::DefId; use rustc_macros::HashStable; @@ -59,7 +59,7 @@ pub const COMMON_VTABLE_ENTRIES_ALIGN: usize = 2; pub struct SupertraitDefIds<'tcx> { tcx: TyCtxt<'tcx>, stack: Vec, - visited: FxHashSet, + visited: GxHashSet, } impl Iterator for SupertraitDefIds<'_> { diff --git a/compiler/rustc_middle/src/values.rs b/compiler/rustc_middle/src/values.rs index 8c323188826b2..eb0f0252352cb 100644 --- a/compiler/rustc_middle/src/values.rs +++ b/compiler/rustc_middle/src/values.rs @@ -1,6 +1,6 @@ use crate::dep_graph::dep_kinds; use crate::query::plumbing::CyclePlaceholder; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, MultiSpan}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -82,7 +82,7 @@ impl<'tcx> Value> for Representability { _guar: ErrorGuaranteed, ) -> Self { let mut item_and_field_ids = Vec::new(); - let mut representable_ids = FxHashSet::default(); + let mut representable_ids = GxHashSet::default(); for info in &cycle_error.cycle { if info.query.dep_kind == dep_kinds::representability && let Some(field_id) = info.query.def_id @@ -267,7 +267,7 @@ impl<'tcx, T> Value> for Result> pub fn recursive_type_error( tcx: TyCtxt<'_>, mut item_and_field_ids: Vec<(LocalDefId, LocalDefId)>, - representable_ids: &FxHashSet, + representable_ids: &GxHashSet, ) -> ErrorGuaranteed { const ITEM_LIMIT: usize = 5; @@ -352,7 +352,7 @@ fn find_item_ty_spans( ty: &hir::Ty<'_>, needle: LocalDefId, spans: &mut Vec, - seen_representable: &FxHashSet, + seen_representable: &GxHashSet, ) { match ty.kind { hir::TyKind::Path(hir::QPath::Resolved(_, path)) => { diff --git a/compiler/rustc_mir_build/src/build/coverageinfo.rs b/compiler/rustc_mir_build/src/build/coverageinfo.rs index 876faca5172ac..eb422b33c3ef0 100644 --- a/compiler/rustc_mir_build/src/build/coverageinfo.rs +++ b/compiler/rustc_mir_build/src/build/coverageinfo.rs @@ -1,7 +1,7 @@ use std::assert_matches::assert_matches; use std::collections::hash_map::Entry; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::mir::coverage::{BlockMarkerId, BranchSpan, CoverageKind}; use rustc_middle::mir::{self, BasicBlock, SourceInfo, UnOp}; use rustc_middle::thir::{ExprId, ExprKind, Pat, Thir}; @@ -15,7 +15,7 @@ mod mcdc; pub(crate) struct BranchInfoBuilder { /// Maps condition expressions to their enclosing `!`, for better instrumentation. - nots: FxHashMap, + nots: GxHashMap, markers: BlockMarkerGen, branch_spans: Vec, @@ -68,7 +68,7 @@ impl BranchInfoBuilder { pub(crate) fn new_if_enabled(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option { if tcx.sess.instrument_coverage_branch() && tcx.is_eligible_for_coverage(def_id) { Some(Self { - nots: FxHashMap::default(), + nots: GxHashMap::default(), markers: BlockMarkerGen::default(), branch_spans: vec![], mcdc_info: tcx.sess.instrument_coverage_mcdc().then(MCDCInfoBuilder::new), diff --git a/compiler/rustc_mir_build/src/build/custom/mod.rs b/compiler/rustc_mir_build/src/build/custom/mod.rs index a0a512a2effcf..4863e1233f502 100644 --- a/compiler/rustc_mir_build/src/build/custom/mod.rs +++ b/compiler/rustc_mir_build/src/build/custom/mod.rs @@ -18,7 +18,7 @@ //! use rustc_ast::Attribute; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::DefId; use rustc_hir::HirId; use rustc_index::{IndexSlice, IndexVec}; @@ -83,8 +83,8 @@ pub(super) fn build_custom_mir<'tcx>( thir, source_scope: OUTERMOST_SOURCE_SCOPE, body: &mut body, - local_map: FxHashMap::default(), - block_map: FxHashMap::default(), + local_map: GxHashMap::default(), + block_map: GxHashMap::default(), }; let res: PResult<_> = try { @@ -143,8 +143,8 @@ struct ParseCtxt<'tcx, 'body> { source_scope: SourceScope, body: &'body mut Body<'tcx>, - local_map: FxHashMap, - block_map: FxHashMap, + local_map: GxHashMap, + block_map: GxHashMap, } struct ParseError { diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 76bdc26a501a6..0de97c4a3aa1e 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -3,7 +3,7 @@ use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, NeedsTemporary}; use rustc_ast::InlineAsmOptions; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; use rustc_middle::mir::*; @@ -323,7 +323,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // first process the set of fields that were provided // (evaluating them in order given by user) - let fields_map: FxHashMap<_, _> = fields + let fields_map: GxHashMap<_, _> = fields .into_iter() .map(|f| { ( diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 932406fd1aaf2..4476b160b5056 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -10,7 +10,7 @@ use crate::build::scope::DropKind; use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard}; use crate::build::{BlockAnd, BlockAndExtension, Builder}; use crate::build::{GuardFrame, GuardFrameLocal, LocalsForNode}; -use rustc_data_structures::{fx::FxIndexMap, stack::ensure_sufficient_stack}; +use rustc_data_structures::{gx::GxIndexMap, stack::ensure_sufficient_stack}; use rustc_hir::{BindingMode, ByRef}; use rustc_middle::bug; use rustc_middle::middle::region; @@ -1805,11 +1805,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>], ) -> ( &'b mut [&'c mut Candidate<'pat, 'tcx>], - FxIndexMap, Vec<&'b mut Candidate<'pat, 'tcx>>>, + GxIndexMap, Vec<&'b mut Candidate<'pat, 'tcx>>>, ) { // For each of the possible outcomes, collect vector of candidates that apply if the test // has that particular outcome. - let mut target_candidates: FxIndexMap<_, Vec<&mut Candidate<'_, '_>>> = Default::default(); + let mut target_candidates: GxIndexMap<_, Vec<&mut Candidate<'_, '_>>> = Default::default(); let total_candidate_count = candidates.len(); @@ -1965,7 +1965,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { }; // For each outcome of test, process the candidates that still apply. - let target_blocks: FxIndexMap<_, _> = target_candidates + let target_blocks: GxIndexMap<_, _> = target_candidates .into_iter() .map(|(branch, mut candidates)| { let candidate_start = self.cfg.start_new_block(); diff --git a/compiler/rustc_mir_build/src/build/matches/test.rs b/compiler/rustc_mir_build/src/build/matches/test.rs index d29874a5ad4ba..beebda25da452 100644 --- a/compiler/rustc_mir_build/src/build/matches/test.rs +++ b/compiler/rustc_mir_build/src/build/matches/test.rs @@ -7,7 +7,7 @@ use crate::build::matches::{Candidate, MatchPair, Test, TestBranch, TestCase, TestKind}; use crate::build::Builder; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir::{LangItem, RangeEnd}; use rustc_middle::mir::*; use rustc_middle::ty::util::IntTypeExt; @@ -69,7 +69,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { otherwise_block: BasicBlock, place: Place<'tcx>, test: &Test<'tcx>, - target_blocks: FxIndexMap, BasicBlock>, + target_blocks: GxIndexMap, BasicBlock>, ) { let place_ty = place.ty(&self.local_decls, self.tcx); debug!(?place, ?place_ty); @@ -538,7 +538,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { test_place: Place<'tcx>, test: &Test<'tcx>, candidate: &mut Candidate<'_, 'tcx>, - sorted_candidates: &FxIndexMap, Vec<&mut Candidate<'_, 'tcx>>>, + sorted_candidates: &GxIndexMap, Vec<&mut Candidate<'_, 'tcx>>>, ) -> Option> { // Find the match_pair for this place (if any). At present, // afaik, there can be at most one. (In the future, if we diff --git a/compiler/rustc_mir_build/src/build/matches/util.rs b/compiler/rustc_mir_build/src/build/matches/util.rs index 630d0b9438dca..00c844cfea235 100644 --- a/compiler/rustc_mir_build/src/build/matches/util.rs +++ b/compiler/rustc_mir_build/src/build/matches/util.rs @@ -1,7 +1,7 @@ use crate::build::expr::as_place::{PlaceBase, PlaceBuilder}; use crate::build::matches::{Binding, Candidate, FlatPat, MatchPair, TestCase}; use crate::build::Builder; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_middle::mir::*; use rustc_middle::thir::{self, *}; use rustc_middle::ty::TypeVisitableExt; @@ -278,7 +278,7 @@ pub(super) struct FakeBorrowCollector<'a, 'b, 'tcx> { /// borrow (i.e. Deep > Shallow). /// Invariant: for any place in `fake_borrows`, all the prefixes of this place that are /// dereferences are also borrowed with the same of stronger borrow kind. - fake_borrows: FxIndexMap, FakeBorrowKind>, + fake_borrows: GxIndexMap, FakeBorrowKind>, } /// Determine the set of places that have to be stable across match guards. @@ -323,7 +323,7 @@ pub(super) fn collect_fake_borrows<'tcx>( scrutinee_base: PlaceBase, ) -> Vec<(Place<'tcx>, Local, FakeBorrowKind)> { let mut collector = - FakeBorrowCollector { cx, scrutinee_base, fake_borrows: FxIndexMap::default() }; + FakeBorrowCollector { cx, scrutinee_base, fake_borrows: GxIndexMap::default() }; for candidate in candidates.iter() { collector.visit_candidate(candidate); } diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 601e5d4d3dc79..cdee699643550 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; use rustc_apfloat::Float; use rustc_ast::attr; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sorted_map::SortedIndexMultiMap; use rustc_errors::ErrorGuaranteed; use rustc_hir::def::DefKind; @@ -195,13 +195,13 @@ struct Builder<'a, 'tcx> { /// Temporaries with fixed indexes. Used so that if-let guards on arms /// with an or-pattern are only created once. - fixed_temps: FxHashMap, + fixed_temps: GxHashMap, /// Scope of temporaries that should be deduplicated using [Self::fixed_temps]. fixed_temps_scope: Option, /// Maps `HirId`s of variable bindings to the `Local`s created for them. /// (A match binding can have two locals; the 2nd is for the arm's guard.) - var_indices: FxHashMap, + var_indices: GxHashMap, local_decls: IndexVec>, canonical_user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>, upvars: CaptureMap<'tcx>, diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index 5b6de39bb2e78..710cbe8249e60 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -84,7 +84,7 @@ that contains only loops and breakable blocks. It tracks where a `break`, use std::mem; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::HirId; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::middle::region; @@ -208,7 +208,7 @@ struct DropTree { /// Nodes in the drop tree, containing drop data and a link to the next node. drops: IndexVec, /// Map for finding the index of an existing node, given its contents. - existing_drops_map: FxHashMap, + existing_drops_map: GxHashMap, /// Edges into the `DropTree` that need to be added once it's lowered. entry_points: Vec<(DropIdx, BasicBlock)>, } @@ -276,7 +276,7 @@ impl DropTree { let fake_data = DropData { source_info: fake_source_info, local: Local::MAX, kind: DropKind::Storage }; let drops = IndexVec::from_raw(vec![DropNode { data: fake_data, next: DropIdx::MAX }]); - Self { drops, entry_points: Vec::new(), existing_drops_map: FxHashMap::default() } + Self { drops, entry_points: Vec::new(), existing_drops_map: GxHashMap::default() } } /// Adds a node to the drop tree, consisting of drop data and the index of diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 70065b5a2c329..63cb1c57a52f8 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -2,7 +2,7 @@ use crate::errors::*; use rustc_arena::{DroplessArena, TypedArena}; use rustc_ast::Mutability; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{codes::*, struct_span_code_err, Applicability, ErrorGuaranteed, MultiSpan}; use rustc_hir::def::*; @@ -998,7 +998,7 @@ fn report_non_exhaustive_match<'p, 'tcx>( err.note(format!("the matched value is of type `{}`", scrut_ty)); if !is_empty_match { - let mut non_exhaustive_tys = FxIndexSet::default(); + let mut non_exhaustive_tys = GxIndexSet::default(); // Look at the first witness. collect_non_exhaustive_tys(cx, &witnesses[0], &mut non_exhaustive_tys); @@ -1171,7 +1171,7 @@ fn joined_uncovered_patterns<'p, 'tcx>( fn collect_non_exhaustive_tys<'tcx>( cx: &PatCtxt<'_, 'tcx>, pat: &WitnessPat<'_, 'tcx>, - non_exhaustive_tys: &mut FxIndexSet>, + non_exhaustive_tys: &mut GxIndexSet>, ) { if matches!(pat.ctor(), Constructor::NonExhaustive) { non_exhaustive_tys.insert(pat.ty().inner()); diff --git a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs index 830f44df5fb39..c886385222c97 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs @@ -1,5 +1,5 @@ use crate::un_derefer::UnDerefer; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::*; use rustc_middle::ty::{ParamEnv, Ty, TyCtxt}; @@ -300,7 +300,7 @@ pub struct MovePathLookup<'tcx> { /// subsequent search so that it is solely relative to that /// base-place). For the remaining lookup, we map the projection /// elem to the associated MovePathIndex. - projections: FxHashMap<(MovePathIndex, AbstractElem), MovePathIndex>, + projections: GxHashMap<(MovePathIndex, AbstractElem), MovePathIndex>, un_derefer: UnDerefer<'tcx>, } diff --git a/compiler/rustc_mir_dataflow/src/un_derefer.rs b/compiler/rustc_mir_dataflow/src/un_derefer.rs index b803ecc575ee0..9d8e967d1c397 100644 --- a/compiler/rustc_mir_dataflow/src/un_derefer.rs +++ b/compiler/rustc_mir_dataflow/src/un_derefer.rs @@ -1,10 +1,10 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::mir::*; /// Used for reverting changes made by `DerefSeparator` #[derive(Default, Debug)] pub(crate) struct UnDerefer<'tcx> { - deref_chains: FxHashMap>>, + deref_chains: GxHashMap>>, } impl<'tcx> UnDerefer<'tcx> { diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index 5e2d88f94ca28..072a94f438695 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -36,7 +36,7 @@ use std::collections::VecDeque; use std::fmt::{Debug, Formatter}; use std::ops::Range; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_index::bit_set::BitSet; use rustc_index::{IndexSlice, IndexVec}; @@ -707,7 +707,7 @@ impl JoinSemiLattice for State { #[derive(Debug)] pub struct Map { locals: IndexVec>, - projections: FxHashMap<(PlaceIndex, TrackElem), PlaceIndex>, + projections: GxHashMap<(PlaceIndex, TrackElem), PlaceIndex>, places: IndexVec, value_count: usize, // The Range corresponds to a slice into `inner_values_buffer`. @@ -724,7 +724,7 @@ impl Map { pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, value_limit: Option) -> Self { let mut map = Self { locals: IndexVec::new(), - projections: FxHashMap::default(), + projections: GxHashMap::default(), places: IndexVec::new(), value_count: 0, inner_values: IndexVec::new(), diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index 05674792426f1..becaa7f00b101 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -58,7 +58,7 @@ use crate::deref_separator::deref_finder; use crate::errors; use crate::pass_manager as pm; use crate::simplify; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_errors::pluralize; use rustc_hir as hir; use rustc_hir::lang_items::LangItem; @@ -237,7 +237,7 @@ struct TransformVisitor<'tcx> { // Mapping from Local to (type of local, coroutine struct index) // FIXME(eddyb) This should use `IndexVec>`. - remap: FxHashMap, VariantIdx, FieldIdx)>, + remap: GxHashMap, VariantIdx, FieldIdx)>, // A map from a suspension point in a block to the locals which have live storage at that point storage_liveness: IndexVec>>, @@ -1037,7 +1037,7 @@ fn compute_layout<'tcx>( liveness: LivenessInfo, body: &Body<'tcx>, ) -> ( - FxHashMap, VariantIdx, FieldIdx)>, + GxHashMap, VariantIdx, FieldIdx)>, CoroutineLayout<'tcx>, IndexVec>>, ) { @@ -1098,7 +1098,7 @@ fn compute_layout<'tcx>( // Create a map from local indices to coroutine struct indices. let mut variant_fields: IndexVec> = iter::repeat(IndexVec::new()).take(RESERVED_VARIANTS).collect(); - let mut remap = FxHashMap::default(); + let mut remap = GxHashMap::default(); for (suspension_point_idx, live_locals) in live_locals_at_suspension_points.iter().enumerate() { let variant_index = VariantIdx::from(RESERVED_VARIANTS + suspension_point_idx); let mut fields = IndexVec::new(); @@ -1933,7 +1933,7 @@ impl<'tcx> Visitor<'tcx> for EnsureCoroutineFieldAssignmentsNeverAlias<'_> { } fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, body: &Body<'tcx>) { - let mut linted_tys = FxHashSet::default(); + let mut linted_tys = GxHashSet::default(); // We want a user-facing param-env. let param_env = tcx.param_env(body.source.def_id()); diff --git a/compiler/rustc_mir_transform/src/coverage/counters.rs b/compiler/rustc_mir_transform/src/coverage/counters.rs index a8b0f4a8d6df4..a15bc27da9ab2 100644 --- a/compiler/rustc_mir_transform/src/coverage/counters.rs +++ b/compiler/rustc_mir_transform/src/coverage/counters.rs @@ -1,8 +1,8 @@ use std::fmt::{self, Debug}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::graph::DirectedGraph; +use rustc_data_structures::gx::GxHashMap; use rustc_index::IndexVec; use rustc_middle::bug; use rustc_middle::mir::coverage::{CounterId, CovTerm, Expression, ExpressionId, Op}; @@ -61,15 +61,15 @@ pub(super) struct CoverageCounters { /// edge between two BCBs. /// /// We currently don't iterate over this map, but if we do in the future, - /// switch it back to `FxIndexMap` to avoid query stability hazards. - bcb_edge_counters: FxHashMap<(BasicCoverageBlock, BasicCoverageBlock), BcbCounter>, + /// switch it back to `GxIndexMap` to avoid query stability hazards. + bcb_edge_counters: GxHashMap<(BasicCoverageBlock, BasicCoverageBlock), BcbCounter>, /// Table of expression data, associating each expression ID with its /// corresponding operator (+ or -) and its LHS/RHS operands. expressions: IndexVec, /// Remember expressions that have already been created (or simplified), /// so that we don't create unnecessary duplicates. - expressions_memo: FxHashMap, + expressions_memo: GxHashMap, } impl CoverageCounters { @@ -85,9 +85,9 @@ impl CoverageCounters { let mut this = Self { counter_increment_sites: IndexVec::new(), bcb_counters: IndexVec::from_elem_n(None, num_bcbs), - bcb_edge_counters: FxHashMap::default(), + bcb_edge_counters: GxHashMap::default(), expressions: IndexVec::new(), - expressions_memo: FxHashMap::default(), + expressions_memo: GxHashMap::default(), }; MakeBcbCounters::new(&mut this, basic_coverage_blocks) diff --git a/compiler/rustc_mir_transform/src/coverage/graph.rs b/compiler/rustc_mir_transform/src/coverage/graph.rs index 360dccb240dc6..622990e7ba2c0 100644 --- a/compiler/rustc_mir_transform/src/coverage/graph.rs +++ b/compiler/rustc_mir_transform/src/coverage/graph.rs @@ -1,7 +1,7 @@ use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::{self, Dominators}; use rustc_data_structures::graph::{self, DirectedGraph, StartNode}; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; use rustc_middle::bug; @@ -34,7 +34,7 @@ impl CoverageGraph { let successors = IndexVec::from_fn_n( |bcb| { - let mut seen_bcbs = FxHashSet::default(); + let mut seen_bcbs = GxHashSet::default(); let terminator = mir_body[bcbs[bcb].last_bb()].terminator(); bcb_filtered_successors(terminator) .into_iter() diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs index 84a70d1f02d75..61d5c0e0c1e67 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans.rs @@ -1,7 +1,7 @@ use std::collections::VecDeque; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::mir; use rustc_span::Span; @@ -83,7 +83,7 @@ pub(super) fn extract_refined_covspans( /// (The input spans should be sorted in BCB dominator order, so that the /// retained "first" span is likely to dominate the others.) fn remove_unwanted_macro_spans(covspans: &mut Vec) { - let mut seen_macro_spans = FxHashSet::default(); + let mut seen_macro_spans = GxHashSet::default(); covspans.retain(|covspan| { // Ignore (retain) non-macro-expansion spans. if covspan.visible_macro.is_none() { diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 0fd85eb345d0c..7c986f074171d 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -4,7 +4,7 @@ use rustc_const_eval::const_eval::{throw_machine_stop_str, DummyMachine}; use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, PlaceTy, Projectable}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def::DefKind; use rustc_middle::bug; use rustc_middle::mir::interpret::{InterpResult, Scalar}; @@ -539,15 +539,15 @@ pub(crate) struct Patch<'tcx> { /// For a given MIR location, this stores the values of the operands used by that location. In /// particular, this is before the effect, such that the operands of `_1 = _1 + _2` are /// properly captured. (This may become UB soon, but it is currently emitted even by safe code.) - pub(crate) before_effect: FxHashMap<(Location, Place<'tcx>), Const<'tcx>>, + pub(crate) before_effect: GxHashMap<(Location, Place<'tcx>), Const<'tcx>>, /// Stores the assigned values for assignments where the Rvalue is constant. - pub(crate) assignments: FxHashMap>, + pub(crate) assignments: GxHashMap>, } impl<'tcx> Patch<'tcx> { pub(crate) fn new(tcx: TyCtxt<'tcx>) -> Self { - Self { tcx, before_effect: FxHashMap::default(), assignments: FxHashMap::default() } + Self { tcx, before_effect: GxHashMap::default(), assignments: GxHashMap::default() } } fn make_operand(&self, const_: Const<'tcx>) -> Operand<'tcx> { diff --git a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs b/compiler/rustc_mir_transform/src/deduplicate_blocks.rs index 824974970bb3f..e621152b27a3e 100644 --- a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs +++ b/compiler/rustc_mir_transform/src/deduplicate_blocks.rs @@ -3,7 +3,7 @@ use std::{collections::hash_map::Entry, hash::Hash, hash::Hasher, iter}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; @@ -32,7 +32,7 @@ impl<'tcx> MirPass<'tcx> for DeduplicateBlocks { struct OptApplier<'tcx> { tcx: TyCtxt<'tcx>, - duplicates: FxHashMap, + duplicates: GxHashMap, } impl<'tcx> MutVisitor<'tcx> for OptApplier<'tcx> { @@ -52,14 +52,14 @@ impl<'tcx> MutVisitor<'tcx> for OptApplier<'tcx> { } } -fn find_duplicates(body: &Body<'_>) -> FxHashMap { - let mut duplicates = FxHashMap::default(); +fn find_duplicates(body: &Body<'_>) -> GxHashMap { + let mut duplicates = GxHashMap::default(); let bbs_to_go_through = body.basic_blocks.iter_enumerated().filter(|(_, bbd)| !bbd.is_cleanup).count(); let mut same_hashes = - FxHashMap::with_capacity_and_hasher(bbs_to_go_through, Default::default()); + GxHashMap::with_capacity_and_hasher(bbs_to_go_through, Default::default()); // Go through the basic blocks backwards. This means that in case of duplicates, // we can use the basic block with the highest index as the replacement for all lower ones. diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index b1016c0867c62..9eb1b84527701 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -132,7 +132,7 @@ //! [attempt 3]: https://github.com/rust-lang/rust/pull/72632 use crate::MirPass; -use rustc_data_structures::fx::{FxIndexMap, IndexEntry, IndexOccupiedEntry}; +use rustc_data_structures::gx::{GxIndexMap, IndexEntry, IndexOccupiedEntry}; use rustc_index::bit_set::BitSet; use rustc_index::interval::SparseIntervalMatrix; use rustc_middle::bug; @@ -216,7 +216,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { let mut merged_locals: BitSet = BitSet::new_empty(body.local_decls.len()); // This is the set of merges we will apply this round. It is a subset of the candidates. - let mut merges = FxIndexMap::default(); + let mut merges = GxIndexMap::default(); for (src, candidates) in candidates.c.iter() { if merged_locals.contains(*src) { @@ -261,8 +261,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { /// frequently. Everything with a `&'alloc` lifetime points into here. #[derive(Default)] struct Allocations { - candidates: FxIndexMap>, - candidates_reverse: FxIndexMap>, + candidates: GxIndexMap>, + candidates_reverse: GxIndexMap>, write_info: WriteInfo, // PERF: Do this for `MaybeLiveLocals` allocations too. } @@ -283,11 +283,11 @@ struct Candidates<'alloc> { /// /// We will still report that we would like to merge `_1` and `_2` in an attempt to allow us to /// remove that assignment. - c: &'alloc mut FxIndexMap>, + c: &'alloc mut GxIndexMap>, /// A reverse index of the `c` set; if the `c` set contains `a => Place { local: b, proj }`, /// then this contains `b => a`. // PERF: Possibly these should be `SmallVec`s? - reverse: &'alloc mut FxIndexMap>, + reverse: &'alloc mut GxIndexMap>, } ////////////////////////////////////////////////////////// @@ -298,7 +298,7 @@ struct Candidates<'alloc> { fn apply_merges<'tcx>( body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>, - merges: &FxIndexMap, + merges: &GxIndexMap, merged_locals: &BitSet, ) { let mut merger = Merger { tcx, merges, merged_locals }; @@ -307,7 +307,7 @@ fn apply_merges<'tcx>( struct Merger<'a, 'tcx> { tcx: TyCtxt<'tcx>, - merges: &'a FxIndexMap, + merges: &'a GxIndexMap, merged_locals: &'a BitSet, } @@ -736,8 +736,8 @@ fn places_to_candidate_pair<'tcx>( fn find_candidates<'alloc, 'tcx>( body: &Body<'tcx>, borrowed: &BitSet, - candidates: &'alloc mut FxIndexMap>, - candidates_reverse: &'alloc mut FxIndexMap>, + candidates: &'alloc mut GxIndexMap>, + candidates_reverse: &'alloc mut GxIndexMap>, ) -> Candidates<'alloc> { candidates.clear(); candidates_reverse.clear(); @@ -759,7 +759,7 @@ fn find_candidates<'alloc, 'tcx>( struct FindAssignments<'a, 'alloc, 'tcx> { body: &'a Body<'tcx>, - candidates: &'alloc mut FxIndexMap>, + candidates: &'alloc mut GxIndexMap>, borrowed: &'a BitSet, } diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 936a7e2d9dedd..b2ce59e675b3c 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -85,8 +85,8 @@ use rustc_const_eval::const_eval::DummyMachine; use rustc_const_eval::interpret::{intern_const_alloc_for_constprop, MemPlaceMeta, MemoryKind}; use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, Projectable, Scalar}; -use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::graph::dominators::Dominators; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir::def::DefKind; use rustc_index::bit_set::BitSet; use rustc_index::newtype_index; @@ -248,7 +248,7 @@ struct VnState<'body, 'tcx> { // This vector does not hold all the values of `VnIndex` that we create. // It stops at the largest value created in the first phase of collecting assignments. rev_locals: IndexVec>, - values: FxIndexSet>, + values: GxIndexSet>, /// Values evaluated as constants if possible. evaluated: IndexVec>>, /// Counter to generate different values. @@ -276,7 +276,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { local_decls, locals: IndexVec::from_elem(None, local_decls), rev_locals: IndexVec::default(), - values: FxIndexSet::default(), + values: GxIndexSet::default(), evaluated: IndexVec::new(), next_opaque: Some(0), feature_unsized_locals: tcx.features().unsized_locals, diff --git a/compiler/rustc_mir_transform/src/inline/cycle.rs b/compiler/rustc_mir_transform/src/inline/cycle.rs index 35bcd24ce95ba..b8c131bbd7028 100644 --- a/compiler/rustc_mir_transform/src/inline/cycle.rs +++ b/compiler/rustc_mir_transform/src/inline/cycle.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexSet}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::mir::TerminatorKind; @@ -39,8 +39,8 @@ pub(crate) fn mir_callgraph_reachable<'tcx>( caller: ty::Instance<'tcx>, target: LocalDefId, stack: &mut Vec>, - seen: &mut FxHashSet>, - recursion_limiter: &mut FxHashMap, + seen: &mut GxHashSet>, + recursion_limiter: &mut GxHashMap, recursion_limit: Limit, ) -> bool { trace!(%caller); @@ -143,8 +143,8 @@ pub(crate) fn mir_callgraph_reachable<'tcx>( root, target, &mut Vec::new(), - &mut FxHashSet::default(), - &mut FxHashMap::default(), + &mut GxHashSet::default(), + &mut GxHashMap::default(), tcx.recursion_limit(), ) } @@ -164,7 +164,7 @@ pub(crate) fn mir_inliner_callees<'tcx>( // Functions from other crates and MIR shims _ => tcx.instance_mir(instance), }; - let mut calls = FxIndexSet::default(); + let mut calls = GxIndexSet::default(); for bb_data in body.basic_blocks.iter() { let terminator = bb_data.terminator(); if let TerminatorKind::Call { func, args: call_args, .. } = &terminator.kind { diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs index 23cc0c46e7397..183de49de36d6 100644 --- a/compiler/rustc_mir_transform/src/jump_threading.rs +++ b/compiler/rustc_mir_transform/src/jump_threading.rs @@ -38,7 +38,7 @@ use rustc_arena::DroplessArena; use rustc_const_eval::const_eval::DummyMachine; use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, Projectable}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; use rustc_middle::bug; @@ -698,7 +698,7 @@ impl OpportunitySet { debug!(?op); let op_chain = std::mem::take(&mut op.chain); let op_target = op.target; - debug_assert_eq!(op_chain.len(), op_chain.iter().collect::>().len()); + debug_assert_eq!(op_chain.len(), op_chain.iter().collect::>().len()); let Some((current, chain)) = op_chain.split_first() else { return }; let basic_blocks = body.basic_blocks.as_mut(); diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs index 8d6c00bbedbae..571adb64a7483 100644 --- a/compiler/rustc_mir_transform/src/known_panics_lint.rs +++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs @@ -10,7 +10,7 @@ use rustc_const_eval::const_eval::DummyMachine; use rustc_const_eval::interpret::{ format_interp_error, ImmTy, InterpCx, InterpResult, Projectable, Scalar, }; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def::DefKind; use rustc_hir::HirId; use rustc_index::{bit_set::BitSet, IndexVec}; @@ -71,7 +71,7 @@ struct ConstPropagator<'mir, 'tcx> { visited_blocks: BitSet, locals: IndexVec>, body: &'mir Body<'tcx>, - written_only_inside_own_block_locals: FxHashSet, + written_only_inside_own_block_locals: GxHashSet, can_const_prop: IndexVec, } diff --git a/compiler/rustc_mir_transform/src/large_enums.rs b/compiler/rustc_mir_transform/src/large_enums.rs index e407929c9a7fd..980d94cb45f27 100644 --- a/compiler/rustc_mir_transform/src/large_enums.rs +++ b/compiler/rustc_mir_transform/src/large_enums.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::mir::interpret::AllocId; use rustc_middle::mir::*; use rustc_middle::ty::util::IntTypeExt; @@ -47,7 +47,7 @@ impl EnumSizeOpt { tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: Ty<'tcx>, - alloc_cache: &mut FxHashMap, AllocId>, + alloc_cache: &mut GxHashMap, AllocId>, ) -> Option<(AdtDef<'tcx>, usize, AllocId)> { let adt_def = match ty.kind() { ty::Adt(adt_def, _args) if adt_def.is_enum() => adt_def, @@ -117,7 +117,7 @@ impl EnumSizeOpt { Some((*adt_def, num_discrs, *alloc_cache.entry(ty).or_insert(alloc))) } fn optim<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let mut alloc_cache = FxHashMap::default(); + let mut alloc_cache = GxHashMap::default(); let body_did = body.source.def_id(); let param_env = tcx.param_env_reveal_all_normalized(body_did); diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index f7056702cb4ed..21bf5d24b4894 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -22,7 +22,7 @@ extern crate tracing; use hir::ConstContext; use required_consts::RequiredConstsVisitor; use rustc_const_eval::util; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::steal::Steal; use rustc_hir as hir; use rustc_hir::def::DefKind; @@ -223,8 +223,8 @@ fn is_mir_available(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet { - let mut set = FxIndexSet::default(); +fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> GxIndexSet { + let mut set = GxIndexSet::default(); // All body-owners have MIR associated with them. set.extend(tcx.hir().body_owners()); @@ -232,7 +232,7 @@ fn mir_keys(tcx: TyCtxt<'_>, (): ()) -> FxIndexSet { // Additionally, tuple struct/variant constructors have MIR, but // they don't have a BodyId, so we need to build them separately. struct GatherCtors<'a> { - set: &'a mut FxIndexSet, + set: &'a mut GxIndexSet, } impl<'tcx> Visitor<'tcx> for GatherCtors<'_> { fn visit_variant_data(&mut self, v: &'tcx hir::VariantData<'tcx>) { diff --git a/compiler/rustc_mir_transform/src/lint.rs b/compiler/rustc_mir_transform/src/lint.rs index 3d1e1e481750a..f149458633507 100644 --- a/compiler/rustc_mir_transform/src/lint.rs +++ b/compiler/rustc_mir_transform/src/lint.rs @@ -2,7 +2,7 @@ //! It can be used to locate problems in MIR building or optimizations. It assumes that all code //! can be executed, so it has false positives. -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::*; @@ -48,7 +48,7 @@ struct Lint<'a, 'tcx> { always_live_locals: &'a BitSet, maybe_storage_live: ResultsCursor<'a, 'tcx, MaybeStorageLive<'a>>, maybe_storage_dead: ResultsCursor<'a, 'tcx, MaybeStorageDead<'a>>, - places: FxHashSet>, + places: GxHashSet>, } impl<'a, 'tcx> Lint<'a, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs index 3f4d2b65ff240..9cd915d7f4a34 100644 --- a/compiler/rustc_mir_transform/src/promote_consts.rs +++ b/compiler/rustc_mir_transform/src/promote_consts.rs @@ -13,7 +13,7 @@ //! move analysis runs after promotion on broken MIR. use either::{Left, Right}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_middle::mir; use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor}; @@ -178,7 +178,7 @@ struct Validator<'a, 'tcx> { /// not have been evaluated, so we only promote such calls in basic blocks that are guaranteed /// to execute. In other words, we only promote such calls in basic blocks that are definitely /// not dead code. Here we cache the result of computing that set of basic blocks. - promotion_safe_blocks: Option>, + promotion_safe_blocks: Option>, } impl<'a, 'tcx> std::ops::Deref for Validator<'a, 'tcx> { @@ -600,8 +600,8 @@ impl<'tcx> Validator<'_, 'tcx> { /// Computes the sets of blocks of this MIR that are definitely going to be executed /// if the function returns successfully. That makes it safe to promote calls in them /// that might fail. - fn promotion_safe_blocks(body: &mir::Body<'tcx>) -> FxHashSet { - let mut safe_blocks = FxHashSet::default(); + fn promotion_safe_blocks(body: &mir::Body<'tcx>) -> GxHashSet { + let mut safe_blocks = GxHashSet::default(); let mut safe_block = START_BLOCK; loop { safe_blocks.insert(safe_block); diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index 801ef14c9cd90..c16b4e4716e5d 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; use rustc_middle::bug; @@ -254,7 +254,7 @@ fn compute_replacement<'tcx>( let mut finder = ReplacementFinder { targets: &mut targets, can_perform_opt, - allowed_replacements: FxHashSet::default(), + allowed_replacements: GxHashSet::default(), }; let reachable_blocks = traversal::reachable_as_bitset(body); for (bb, bbdata) in body.basic_blocks.iter_enumerated() { @@ -276,7 +276,7 @@ fn compute_replacement<'tcx>( struct ReplacementFinder<'a, 'tcx, F> { targets: &'a mut IndexVec>, can_perform_opt: F, - allowed_replacements: FxHashSet<(Local, Location)>, + allowed_replacements: GxHashSet<(Local, Location)>, } impl<'tcx, F> Visitor<'tcx> for ReplacementFinder<'_, 'tcx, F> @@ -348,7 +348,7 @@ struct Replacer<'tcx> { tcx: TyCtxt<'tcx>, targets: IndexVec>, storage_to_remove: BitSet, - allowed_replacements: FxHashSet<(Local, Location)>, + allowed_replacements: GxHashSet<(Local, Location)>, any_replacement: bool, } diff --git a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs index 1404a45f4d2db..0ad46db8346bf 100644 --- a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs +++ b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs @@ -1,7 +1,7 @@ //! A pass that eliminates branches on uninhabited or unreachable enum variants. use crate::MirPass; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::bug; use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::{ @@ -52,10 +52,10 @@ fn variant_discriminants<'tcx>( layout: &TyAndLayout<'tcx>, ty: Ty<'tcx>, tcx: TyCtxt<'tcx>, -) -> FxHashSet { +) -> GxHashSet { match &layout.variants { Variants::Single { index } => { - let mut res = FxHashSet::default(); + let mut res = GxHashSet::default(); res.insert( ty.discriminant_for_variant(tcx, *index) .map_or(index.as_u32() as u128, |discr| discr.val), diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs index a6c3c3b189ed0..7d32dbb51988a 100644 --- a/compiler/rustc_mir_transform/src/unreachable_prop.rs +++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs @@ -2,7 +2,7 @@ //! when all of their successors are unreachable. This is achieved through a //! post-order traversal of the blocks. -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::bug; use rustc_middle::mir::interpret::Scalar; use rustc_middle::mir::patch::MirPatch; @@ -20,7 +20,7 @@ impl MirPass<'_> for UnreachablePropagation { fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); - let mut unreachable_blocks = FxHashSet::default(); + let mut unreachable_blocks = GxHashSet::default(); for (bb, bb_data) in traversal::postorder(body) { let terminator = bb_data.terminator(); @@ -63,7 +63,7 @@ impl MirPass<'_> for UnreachablePropagation { fn remove_successors_from_switch<'tcx>( tcx: TyCtxt<'tcx>, bb: BasicBlock, - unreachable_blocks: &FxHashSet, + unreachable_blocks: &GxHashSet, body: &Body<'tcx>, patch: &mut MirPatch<'tcx>, ) -> bool { diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs index 2018a8fe667d7..cbb1f8beabae1 100644 --- a/compiler/rustc_mir_transform/src/validate.rs +++ b/compiler/rustc_mir_transform/src/validate.rs @@ -1,6 +1,6 @@ //! Validates the MIR to ensure that invariants are upheld. -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir::LangItem; use rustc_index::bit_set::BitSet; use rustc_index::IndexVec; @@ -83,7 +83,7 @@ impl<'tcx> MirPass<'tcx> for Validator { mir_phase, unwind_edge_count: 0, reachable_blocks: traversal::reachable_as_bitset(body), - value_cache: FxHashSet::default(), + value_cache: GxHashSet::default(), can_unwind, }; cfg_checker.visit_body(body); @@ -133,7 +133,7 @@ struct CfgChecker<'a, 'tcx> { mir_phase: MirPhase, unwind_edge_count: usize, reachable_blocks: BitSet, - value_cache: FxHashSet, + value_cache: GxHashSet, // If `false`, then the MIR must not contain `UnwindAction::Continue` or // `TerminatorKind::Resume`. can_unwind: bool, @@ -192,7 +192,7 @@ impl<'a, 'tcx> CfgChecker<'a, 'tcx> { return; } let doms = self.body.basic_blocks.dominators(); - let mut post_contract_node = FxHashMap::default(); + let mut post_contract_node = GxHashMap::default(); // Reusing the allocation across invocations of the closure let mut dom_path = vec![]; let mut get_post_contract_node = |mut bb| { @@ -244,7 +244,7 @@ impl<'a, 'tcx> CfgChecker<'a, 'tcx> { } // Check for cycles - let mut stack = FxHashSet::default(); + let mut stack = GxHashSet::default(); for i in 0..parent.len() { let mut bb = BasicBlock::from_usize(i); stack.clear(); diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 9a7c488833a1a..0bcf39272f3b6 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -98,7 +98,7 @@ use std::fs::{self, File}; use std::io::{BufWriter, Write}; use std::path::{Path, PathBuf}; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet}; use rustc_data_structures::sync; use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_hir::def::DefKind; @@ -262,7 +262,7 @@ where // going via another root item. This includes drop-glue, functions from // external crates, and local functions the definition of which is // marked with `#[inline]`. - let mut reachable_inlined_items = FxIndexSet::default(); + let mut reachable_inlined_items = GxIndexSet::default(); get_reachable_inlined_items(cx.tcx, mono_item, cx.usage_map, &mut reachable_inlined_items); // Add those inlined items. It's possible an inlined item is reachable @@ -300,7 +300,7 @@ where tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>, usage_map: &UsageMap<'tcx>, - visited: &mut FxIndexSet>, + visited: &mut GxIndexSet>, ) { usage_map.for_each_inlined_used_item(tcx, item, |inlined_item| { let is_new = visited.insert(inlined_item); @@ -1245,7 +1245,7 @@ fn dump_mono_items_stats<'tcx>( let mut file = BufWriter::new(file); // Gather instantiated mono items grouped by def_id - let mut items_per_def_id: FxIndexMap<_, Vec<_>> = Default::default(); + let mut items_per_def_id: GxIndexMap<_, Vec<_>> = Default::default(); for cgu in codegen_units { cgu.items() .keys() diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 81d5f0fca0ec9..93cc1e440bba1 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -32,7 +32,7 @@ use rustc_ast::{ PatKind, Path, PathSegment, QSelf, Recovered, Ty, TyKind, }; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{ pluralize, Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PErr, PResult, Subdiagnostic, @@ -2412,7 +2412,7 @@ impl<'a> Parser<'a> { fn consume_tts( &mut self, mut acc: i64, // `i64` because malformed code can have more closing delims than opening. - // Not using `FxHashMap` due to `token::TokenKind: !Eq + !Hash`. + // Not using `GxHashMap` due to `token::TokenKind: !Eq + !Hash`. modifier: &[(token::TokenKind, i64)], ) { while acc > 0 { @@ -2435,7 +2435,7 @@ impl<'a> Parser<'a> { /// the local scope), but if we find the same name multiple times, like in `fn foo(i8, i8)`, /// we deduplicate them to not complain about duplicated parameter names. pub(super) fn deduplicate_recovered_params_names(&self, fn_inputs: &mut ThinVec) { - let mut seen_inputs = FxHashSet::default(); + let mut seen_inputs = GxHashSet::default(); for input in fn_inputs.iter_mut() { let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err(_)) = (&input.pat.kind, &input.ty.kind) diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index cfd0a72c056d5..93dca98f69f9f 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -29,7 +29,7 @@ use rustc_ast::{ VisibilityKind, DUMMY_NODE_ID, }; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, Diag, FatalError, MultiSpan, PResult}; use rustc_session::parse::ParseSess; @@ -236,7 +236,7 @@ enum Capturing { struct CaptureState { capturing: Capturing, replace_ranges: Vec, - inner_attr_ranges: FxHashMap, + inner_attr_ranges: GxHashMap, } /// Iterator over a `TokenStream` that produces `Token`s. It's a bit odd that diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 5f8e4a8b7a761..6e4311b389d62 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -7,7 +7,7 @@ use crate::{errors, fluent_generated as fluent}; use rustc_ast::{ast, AttrKind, AttrStyle, Attribute, LitKind}; use rustc_ast::{MetaItemKind, MetaItemLit, NestedMetaItem}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{Applicability, IntoDiagArg, MultiSpan}; use rustc_errors::{DiagCtxtHandle, StashKey}; use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; @@ -109,9 +109,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> { target: Target, item: Option>, ) { - let mut doc_aliases = FxHashMap::default(); + let mut doc_aliases = GxHashMap::default(); let mut specified_inline = None; - let mut seen = FxHashMap::default(); + let mut seen = GxHashMap::default(); let attrs = self.tcx.hir().attrs(hir_id); for attr in attrs { match attr.path().as_slice() { @@ -679,7 +679,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { hir_id: HirId, target: Target, is_list: bool, - aliases: &mut FxHashMap, + aliases: &mut GxHashMap, ) -> bool { let tcx = self.tcx; let span = meta.name_value_literal_span().unwrap_or_else(|| meta.span()); @@ -781,7 +781,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { meta: &NestedMetaItem, hir_id: HirId, target: Target, - aliases: &mut FxHashMap, + aliases: &mut GxHashMap, ) -> bool { if let Some(values) = meta.meta_item_list() { let mut errors = 0; @@ -1077,7 +1077,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { hir_id: HirId, target: Target, specified_inline: &mut Option<(bool, Span)>, - aliases: &mut FxHashMap, + aliases: &mut GxHashMap, ) -> bool { let mut is_valid = true; @@ -2590,7 +2590,7 @@ fn check_duplicates( attr: &Attribute, hir_id: HirId, duplicates: AttributeDuplicates, - seen: &mut FxHashMap, + seen: &mut GxHashMap, ) { use AttributeDuplicates::*; if matches!(duplicates, WarnFollowingWordOnly) && !attr.is_word() { diff --git a/compiler/rustc_passes/src/hir_stats.rs b/compiler/rustc_passes/src/hir_stats.rs index 0ba61f8e8b40f..2d2da79416b43 100644 --- a/compiler/rustc_passes/src/hir_stats.rs +++ b/compiler/rustc_passes/src/hir_stats.rs @@ -5,7 +5,7 @@ use rustc_ast::visit as ast_visit; use rustc_ast::visit::BoundKind; use rustc_ast::{self as ast, AttrId, NodeId}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir as hir; use rustc_hir::intravisit as hir_visit; use rustc_hir::HirId; @@ -35,12 +35,12 @@ impl NodeStats { struct Node { stats: NodeStats, - subnodes: FxHashMap<&'static str, NodeStats>, + subnodes: GxHashMap<&'static str, NodeStats>, } impl Node { fn new() -> Node { - Node { stats: NodeStats::new(), subnodes: FxHashMap::default() } + Node { stats: NodeStats::new(), subnodes: GxHashMap::default() } } } @@ -63,15 +63,15 @@ impl Node { /// unfortunate. struct StatCollector<'k> { krate: Option>, - nodes: FxHashMap<&'static str, Node>, - seen: FxHashSet, + nodes: GxHashMap<&'static str, Node>, + seen: GxHashSet, } pub fn print_hir_stats(tcx: TyCtxt<'_>) { let mut collector = StatCollector { krate: Some(tcx.hir()), - nodes: FxHashMap::default(), - seen: FxHashSet::default(), + nodes: GxHashMap::default(), + seen: GxHashSet::default(), }; tcx.hir().walk_toplevel_module(&mut collector); tcx.hir().walk_attributes(&mut collector); @@ -82,7 +82,7 @@ pub fn print_ast_stats(krate: &ast::Crate, title: &str, prefix: &str) { use rustc_ast::visit::Visitor; let mut collector = - StatCollector { krate: None, nodes: FxHashMap::default(), seen: FxHashSet::default() }; + StatCollector { krate: None, nodes: GxHashMap::default(), seen: GxHashSet::default() }; collector.visit_crate(krate); collector.print(title, prefix); } diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs index b3722e99e1684..11448f9dd3a02 100644 --- a/compiler/rustc_passes/src/lang_items.rs +++ b/compiler/rustc_passes/src/lang_items.rs @@ -14,7 +14,7 @@ use crate::weak_lang_items; use rustc_ast as ast; use rustc_ast::visit; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::lang_items::{extract, GenericRequirement}; use rustc_hir::{LangItem, LanguageItems, MethodKind, Target}; @@ -37,7 +37,7 @@ struct LanguageItemCollector<'ast, 'tcx> { resolver: &'ast ResolverAstLowering, // FIXME(#118552): We should probably feed def_span eagerly on def-id creation // so we can avoid constructing this map for local def-ids. - item_spans: FxHashMap, + item_spans: GxHashMap, parent_item: Option<&'ast ast::Item>, } @@ -50,7 +50,7 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> { tcx, resolver, items: LanguageItems::new(), - item_spans: FxHashMap::default(), + item_spans: GxHashMap::default(), parent_item: None, } } diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index dfa7dfa339817..f7ae221b775ce 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -86,7 +86,7 @@ use crate::errors; use self::LiveNodeKind::*; use self::VarKind::*; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::LocalDefId; @@ -1547,7 +1547,7 @@ impl<'tcx> Liveness<'_, 'tcx> { // bindings, and we also consider the first pattern to be the "authoritative" set of ids. // However, we should take the ids and spans of variables with the same name from the later // patterns so the suggestions to prefix with underscores will apply to those too. - let mut vars: FxIndexMap)> = + let mut vars: GxIndexMap)> = <_>::default(); pat.each_binding(|_, hir_id, pat_sp, ident| { diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 6bdfaf0c90897..02f43fd750665 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -6,7 +6,7 @@ use rustc_attr::{ self as attr, ConstStability, DeprecatedSince, Stability, StabilityLevel, StableSince, Unstable, UnstableReason, VERSION_PLACEHOLDER, }; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -934,7 +934,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { } let declared_lib_features = &tcx.features().declared_lib_features; - let mut remaining_lib_features = FxIndexMap::default(); + let mut remaining_lib_features = GxIndexMap::default(); for (feature, span) in declared_lib_features { if !tcx.sess.opts.unstable_features.is_nightly_build() { tcx.dcx().emit_err(errors::FeatureOnlyOnNightly { @@ -978,7 +978,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { /// time, less loading from metadata is performed and thus compiler performance is improved. fn check_features<'tcx>( tcx: TyCtxt<'tcx>, - remaining_lib_features: &mut FxIndexMap<&Symbol, Span>, + remaining_lib_features: &mut GxIndexMap<&Symbol, Span>, remaining_implications: &mut UnordMap, defined_features: &LibFeatures, all_implications: &UnordMap, diff --git a/compiler/rustc_passes/src/upvars.rs b/compiler/rustc_passes/src/upvars.rs index f2454514e4d32..2e29374597138 100644 --- a/compiler/rustc_passes/src/upvars.rs +++ b/compiler/rustc_passes/src/upvars.rs @@ -1,6 +1,6 @@ //! Upvar (closure capture) collection from cross-body HIR uses of `Res::Local`s. -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_hir::intravisit::{self, Visitor}; @@ -24,7 +24,7 @@ pub fn provide(providers: &mut Providers) { let mut capture_collector = CaptureCollector { tcx, locals: &local_collector.locals, - upvars: FxIndexMap::default(), + upvars: GxIndexMap::default(), }; capture_collector.visit_body(&body); @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers) { #[derive(Default)] struct LocalCollector { // FIXME(eddyb) perhaps use `ItemLocalId` instead? - locals: FxHashSet, + locals: GxHashSet, } impl<'tcx> Visitor<'tcx> for LocalCollector { @@ -53,8 +53,8 @@ impl<'tcx> Visitor<'tcx> for LocalCollector { struct CaptureCollector<'a, 'tcx> { tcx: TyCtxt<'tcx>, - locals: &'a FxHashSet, - upvars: FxIndexMap, + locals: &'a GxHashSet, + upvars: GxIndexMap, } impl CaptureCollector<'_, '_> { diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs index 90691ca17908b..20fda26e20f93 100644 --- a/compiler/rustc_passes/src/weak_lang_items.rs +++ b/compiler/rustc_passes/src/weak_lang_items.rs @@ -2,7 +2,7 @@ use rustc_ast as ast; use rustc_ast::visit; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::lang_items::{self, LangItem}; use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS; use rustc_middle::middle::lang_items::required; @@ -67,7 +67,7 @@ fn verify(tcx: TyCtxt<'_>, items: &lang_items::LanguageItems) { return; } - let mut missing = FxHashSet::default(); + let mut missing = GxHashSet::default(); for &cnum in tcx.crates(()).iter() { for &item in tcx.missing_lang_items(cnum).iter() { missing.insert(item); diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index 6e96a93473f7d..4f53cd87825b1 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -712,7 +712,7 @@ use self::PlaceValidity::*; use crate::constructor::{Constructor, ConstructorSet, IntRange}; use crate::pat::{DeconstructedPat, PatId, PatOrWild, WitnessPat}; use crate::{Captures, MatchArm, PatCx, PrivateUninhabitedField}; -use rustc_hash::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_index::bit_set::BitSet; use smallvec::{smallvec, SmallVec}; use std::fmt; @@ -731,7 +731,7 @@ struct UsefulnessCtxt<'a, Cx: PatCx> { tycx: &'a Cx, /// Collect the patterns found useful during usefulness checking. This is used to lint /// unreachable (sub)patterns. - useful_subpatterns: FxHashSet, + useful_subpatterns: GxHashSet, complexity_limit: Option, complexity_level: usize, } @@ -1717,11 +1717,11 @@ pub enum Usefulness<'p, Cx: PatCx> { /// Report whether this pattern was found useful, and its subpatterns that were not useful if any. fn collect_pattern_usefulness<'p, Cx: PatCx>( - useful_subpatterns: &FxHashSet, + useful_subpatterns: &GxHashSet, pat: &'p DeconstructedPat, ) -> Usefulness<'p, Cx> { fn pat_is_useful<'p, Cx: PatCx>( - useful_subpatterns: &FxHashSet, + useful_subpatterns: &GxHashSet, pat: &'p DeconstructedPat, ) -> bool { if useful_subpatterns.contains(&pat.uid) { @@ -1780,7 +1780,7 @@ pub fn compute_match_usefulness<'p, Cx: PatCx>( ) -> Result, Cx::Error> { let mut cx = UsefulnessCtxt { tycx, - useful_subpatterns: FxHashSet::default(), + useful_subpatterns: GxHashSet::default(), complexity_limit, complexity_level: 0, }; diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index d37056269385d..6d50c7dff11ab 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -13,7 +13,7 @@ mod errors; use rustc_ast::visit::{try_visit, VisitorResult}; use rustc_ast::MacroDef; use rustc_attr as attr; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::intern::Interned; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -101,7 +101,7 @@ pub trait DefIdVisitor<'tcx> { pub struct DefIdVisitorSkeleton<'v, 'tcx, V: ?Sized> { def_id_visitor: &'v mut V, - visited_opaque_tys: FxHashSet, + visited_opaque_tys: GxHashSet, dummy: PhantomData>, } @@ -401,7 +401,7 @@ struct EmbargoVisitor<'tcx> { /// pub macro m() { /// n::p::f() /// } - macro_reachable: FxHashSet<(LocalModDefId, LocalModDefId)>, + macro_reachable: GxHashSet<(LocalModDefId, LocalModDefId)>, /// Preliminary pass for marking all underlying types of `impl Trait`s as reachable. impl_trait_pass: bool, /// Has something changed in the level map? diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs index e0d7a4f0451a2..3af9f74546a54 100644 --- a/compiler/rustc_query_impl/src/profiling_support.rs +++ b/compiler/rustc_query_impl/src/profiling_support.rs @@ -1,5 +1,5 @@ use measureme::{StringComponent, StringId}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::profiling::SelfProfiler; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE}; use rustc_hir::definitions::DefPathData; @@ -9,7 +9,7 @@ use std::fmt::Debug; use std::io::Write; pub(crate) struct QueryKeyStringCache { - def_id_cache: FxHashMap, + def_id_cache: GxHashMap, } impl QueryKeyStringCache { diff --git a/compiler/rustc_query_system/src/cache.rs b/compiler/rustc_query_system/src/cache.rs index 6e862db0b2547..65067b68bac65 100644 --- a/compiler/rustc_query_system/src/cache.rs +++ b/compiler/rustc_query_system/src/cache.rs @@ -2,13 +2,13 @@ use crate::dep_graph::{DepContext, DepNodeIndex}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lock; use std::hash::Hash; pub struct Cache { - hashmap: Lock>>, + hashmap: Lock>>, } impl Clone for Cache { diff --git a/compiler/rustc_query_system/src/dep_graph/debug.rs b/compiler/rustc_query_system/src/dep_graph/debug.rs index 103a6c01bd274..62857e77a9768 100644 --- a/compiler/rustc_query_system/src/dep_graph/debug.rs +++ b/compiler/rustc_query_system/src/dep_graph/debug.rs @@ -1,7 +1,7 @@ //! Code for debugging the dep-graph. use super::{DepNode, DepNodeIndex}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sync::Lock; use std::error::Error; @@ -39,7 +39,7 @@ impl DepNodeFilter { pub struct EdgeFilter { pub source: DepNodeFilter, pub target: DepNodeFilter, - pub index_to_node: Lock>, + pub index_to_node: Lock>, } impl EdgeFilter { @@ -51,7 +51,7 @@ impl EdgeFilter { Ok(EdgeFilter { source: DepNodeFilter::new(parts[0]), target: DepNodeFilter::new(parts[1]), - index_to_node: Lock::new(FxHashMap::default()), + index_to_node: Lock::new(GxHashMap::default()), }) } } diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 66fb3136805e1..3022946f88ba5 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -1,5 +1,5 @@ use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::profiling::{QueryInvocationId, SelfProfilerRef}; use rustc_data_structures::sharded::{self, Sharded}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -92,7 +92,7 @@ pub(crate) struct DepGraphData { colors: DepNodeColorMap, - processed_side_effects: Lock>, + processed_side_effects: Lock>, /// When we load, there may be `.o` files, cached MIR, or other such /// things available to us. If we find that they are not dirty, we @@ -100,12 +100,12 @@ pub(crate) struct DepGraphData { /// this map. We can later look for and extract that data. previous_work_products: WorkProductMap, - dep_node_debug: Lock>, + dep_node_debug: Lock>, /// Used by incremental compilation tests to assert that /// a particular query result was decoded from disk /// (not just marked green) - debug_loaded_from_disk: Lock>, + debug_loaded_from_disk: Lock>, } pub fn hash_result(hcx: &mut StableHashingContext<'_>, result: &R) -> Fingerprint @@ -1054,7 +1054,7 @@ rustc_index::newtype_index! { /// first, and `data` second. pub(super) struct CurrentDepGraph { encoder: GraphEncoder, - new_node_to_index: Sharded>, + new_node_to_index: Sharded>, prev_index_to_index: Lock>>, /// This is used to verify that fingerprints do not change between the creation of a node @@ -1124,7 +1124,7 @@ impl CurrentDepGraph { previous, ), new_node_to_index: Sharded::new(|| { - FxHashMap::with_capacity_and_hasher( + GxHashMap::with_capacity_and_hasher( new_node_count_estimate / sharded::shards(), Default::default(), ) @@ -1295,7 +1295,7 @@ pub struct TaskDeps { #[cfg(debug_assertions)] node: Option, reads: EdgesVec, - read_set: FxHashSet, + read_set: GxHashSet, phantom_data: PhantomData, } @@ -1305,7 +1305,7 @@ impl Default for TaskDeps { #[cfg(debug_assertions)] node: None, reads: EdgesVec::new(), - read_set: FxHashSet::default(), + read_set: GxHashSet::default(), phantom_data: PhantomData, } } diff --git a/compiler/rustc_query_system/src/dep_graph/query.rs b/compiler/rustc_query_system/src/dep_graph/query.rs index 5969e5fbe98f4..3ba26218873a2 100644 --- a/compiler/rustc_query_system/src/dep_graph/query.rs +++ b/compiler/rustc_query_system/src/dep_graph/query.rs @@ -1,12 +1,12 @@ -use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::graph::implementation::{Direction, Graph, NodeIndex, INCOMING}; +use rustc_data_structures::gx::GxHashMap; use rustc_index::IndexVec; use super::{DepNode, DepNodeIndex}; pub struct DepGraphQuery { pub graph: Graph, - pub indices: FxHashMap, + pub indices: GxHashMap, pub dep_index_to_index: IndexVec>, } @@ -16,7 +16,7 @@ impl DepGraphQuery { let edge_count = 6 * node_count; let graph = Graph::with_capacity(node_count, edge_count); - let indices = FxHashMap::default(); + let indices = GxHashMap::default(); let dep_index_to_index = IndexVec::new(); DepGraphQuery { graph, indices, dep_index_to_index } diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index 8e91d9dd60b3c..1d512f5ae673b 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -40,7 +40,7 @@ use super::{DepKind, DepNode, DepNodeIndex, Deps}; use crate::dep_graph::edges::EdgesVec; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fingerprint::PackedFingerprint; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::outline; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::sync::Lock; @@ -471,7 +471,7 @@ struct EncoderState { encoder: FileEncoder, total_node_count: usize, total_edge_count: usize, - stats: Option>, + stats: Option>, /// Stores the number of times we've encoded each dep kind. kind_stats: Vec, @@ -485,7 +485,7 @@ impl EncoderState { encoder, total_edge_count: 0, total_node_count: 0, - stats: record_stats.then(FxHashMap::default), + stats: record_stats.then(GxHashMap::default), kind_stats: iter::repeat(0).take(D::DEP_KIND_MAX as usize + 1).collect(), marker: PhantomData, } diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs index acc29b67cccec..7599d877a32c9 100644 --- a/compiler/rustc_query_system/src/query/caches.rs +++ b/compiler/rustc_query_system/src/query/caches.rs @@ -1,6 +1,6 @@ use crate::dep_graph::DepNodeIndex; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sharded::{self, Sharded}; use rustc_data_structures::sync::{Lock, OnceLock}; use rustc_hir::def_id::LOCAL_CRATE; @@ -23,7 +23,7 @@ pub trait QueryCache: Sized { } pub struct DefaultCache { - cache: Sharded>, + cache: Sharded>, } impl Default for DefaultCache { @@ -141,7 +141,7 @@ where pub struct DefIdCache { /// Stores the local DefIds in a dense map. Local queries are much more often dense, so this is - /// a win over hashing query keys at marginal memory cost (~5% at most) compared to FxHashMap. + /// a win over hashing query keys at marginal memory cost (~5% at most) compared to GxHashMap. /// /// The second element of the tuple is the set of keys actually present in the IndexVec, used /// for faster iteration in `iter()`. diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index 3f44b11850e58..bf07230473f32 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -3,7 +3,7 @@ use crate::error::CycleStack; use crate::query::plumbing::CycleError; use crate::query::DepKind; use crate::query::{QueryContext, QueryStackFrame}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{Diag, DiagCtxtHandle}; use rustc_hir::def::DefKind; use rustc_session::Session; @@ -16,7 +16,7 @@ use std::num::NonZero; #[cfg(parallel_compiler)] use { parking_lot::{Condvar, Mutex}, - rustc_data_structures::fx::FxHashSet, + rustc_data_structures::gx::GxHashSet, rustc_data_structures::jobserver, rustc_span::DUMMY_SP, std::iter, @@ -31,7 +31,7 @@ pub struct QueryInfo { pub query: QueryStackFrame, } -pub type QueryMap = FxHashMap; +pub type QueryMap = GxHashMap; /// A value uniquely identifying an active query job. #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] @@ -323,7 +323,7 @@ fn cycle_check( query: QueryJobId, span: Span, stack: &mut Vec<(Span, QueryJobId)>, - visited: &mut FxHashSet, + visited: &mut GxHashSet, ) -> Option> { if !visited.insert(query) { return if let Some(p) = stack.iter().position(|q| q.1 == query) { @@ -362,7 +362,7 @@ fn cycle_check( fn connected_to_root( query_map: &QueryMap, query: QueryJobId, - visited: &mut FxHashSet, + visited: &mut GxHashSet, ) -> bool { // We already visited this or we're deliberately ignoring it if !visited.insert(query) { @@ -413,7 +413,7 @@ fn remove_cycle( jobs: &mut Vec, wakelist: &mut Vec>, ) -> bool { - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); let mut stack = Vec::new(); // Look for a cycle starting with the last query in `jobs` if let Some(waiter) = @@ -449,7 +449,7 @@ fn remove_cycle( // Find all the direct waiters who lead to the root visit_waiters(query_map, query, |span, waiter| { // Mark all the other queries in the cycle as already visited - let mut visited = FxHashSet::from_iter(stack.iter().map(|q| q.1)); + let mut visited = GxHashSet::from_iter(stack.iter().map(|q| q.1)); if connected_to_root(query_map, waiter, &mut visited) { waiters.push((span, waiter)); diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index d37d5bce9cc36..8fccac5ad1f84 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -13,7 +13,7 @@ use crate::query::SerializedDepNodeIndex; use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame}; use crate::HandleCycleError; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::sharded::Sharded; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::Lock; @@ -32,7 +32,7 @@ use tracing::instrument; use super::QueryConfig; pub struct QueryState { - active: Sharded>, + active: Sharded>, } /// Indicates the state of a query for a given key in a query map. diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index fc3669fecc2ad..f808e1946d8d5 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -30,7 +30,7 @@ use crate::Resolver; use crate::{LexicalScopeBinding, NameBindingKind}; use rustc_ast as ast; use rustc_ast::visit::{self, Visitor}; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap, GxIndexSet}; use rustc_data_structures::unord::UnordSet; use rustc_errors::MultiSpan; use rustc_hir::def::{DefKind, Res}; @@ -56,7 +56,7 @@ impl UnusedImport { struct UnusedImportCheckVisitor<'a, 'b, 'tcx> { r: &'a mut Resolver<'b, 'tcx>, /// All the (so far) unused imports, grouped path list - unused_imports: FxIndexMap, + unused_imports: GxIndexMap, extern_crate_items: Vec, base_use_tree: Option<&'a ast::UseTree>, base_id: ast::NodeId, @@ -141,7 +141,7 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> { fn report_unused_extern_crate_items( &mut self, - maybe_unused_extern_crates: FxHashMap, + maybe_unused_extern_crates: GxHashMap, ) { let tcx = self.r.tcx(); for extern_crate in &self.extern_crate_items { @@ -378,7 +378,7 @@ fn calc_unused_spans( impl Resolver<'_, '_> { pub(crate) fn check_unused(&mut self, krate: &ast::Crate) { let tcx = self.tcx; - let mut maybe_unused_extern_crates = FxHashMap::default(); + let mut maybe_unused_extern_crates = GxHashMap::default(); for import in self.potentially_unused_imports.iter() { match import.kind { @@ -492,7 +492,7 @@ impl Resolver<'_, '_> { } let unused_imports = visitor.unused_imports; - let mut check_redundant_imports = FxIndexSet::default(); + let mut check_redundant_imports = GxIndexSet::default(); for module in self.arenas.local_modules().iter() { for (_key, resolution) in self.resolutions(*module).borrow().iter() { let resolution = resolution.borrow(); @@ -555,7 +555,7 @@ impl Resolver<'_, '_> { fn is_unused_import( import: Import<'_>, - unused_imports: &FxIndexMap, + unused_imports: &GxIndexMap, ) -> bool { if let Some(unused_import) = unused_imports.get(&import.root_id) && let Some(id) = import.id() diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 263daa11ec316..2fab078b4a11d 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -4,7 +4,7 @@ use rustc_ast::visit::{self, Visitor}; use rustc_ast::{self as ast, Crate, ItemKind, ModKind, NodeId, Path, CRATE_NODE_ID}; use rustc_ast::{MetaItemKind, NestedMetaItem}; use rustc_ast_pretty::pprust; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_errors::{ codes::*, report_ambiguity_error, struct_span_code_err, Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, MultiSpan, SuggestionStyle, @@ -155,7 +155,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - let mut reported_spans = FxHashSet::default(); + let mut reported_spans = GxHashSet::default(); for error in std::mem::take(&mut self.privacy_errors) { if reported_spans.insert(error.dedup_span) { self.report_privacy_error(&error); @@ -1151,7 +1151,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { FilterFn: Fn(Res) -> bool, { let mut candidates = Vec::new(); - let mut seen_modules = FxHashSet::default(); + let mut seen_modules = GxHashSet::default(); let start_did = start_module.def_id(); let mut worklist = vec![( start_module, @@ -2810,7 +2810,7 @@ fn show_candidates( let mut kinds = accessible_path_strings .iter() .map(|(_, descr, _, _, _)| *descr) - .collect::>() + .collect::>() .into_iter(); let kind = if let Some(kind) = kinds.next() && let None = kinds.next() diff --git a/compiler/rustc_resolve/src/effective_visibilities.rs b/compiler/rustc_resolve/src/effective_visibilities.rs index dabed23883866..8efd45f48b10a 100644 --- a/compiler/rustc_resolve/src/effective_visibilities.rs +++ b/compiler/rustc_resolve/src/effective_visibilities.rs @@ -4,7 +4,7 @@ use rustc_ast::visit; use rustc_ast::visit::Visitor; use rustc_ast::Crate; use rustc_ast::EnumDef; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::LocalDefId; use rustc_hir::def_id::CRATE_DEF_ID; use rustc_middle::middle::privacy::Level; @@ -73,7 +73,7 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> { pub(crate) fn compute_effective_visibilities<'c>( r: &'r mut Resolver<'a, 'tcx>, krate: &'c Crate, - ) -> FxHashSet> { + ) -> GxHashSet> { let mut visitor = EffectiveVisibilitiesVisitor { r, def_effective_visibilities: Default::default(), @@ -91,7 +91,7 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> { } visitor.r.effective_visibilities = visitor.def_effective_visibilities; - let mut exported_ambiguities = FxHashSet::default(); + let mut exported_ambiguities = GxHashSet::default(); // Update visibilities for import def ids. These are not used during the // `EffectiveVisibilitiesVisitor` pass, because we have more detailed binding-based diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 3896fe4c4fa64..6447f6abff211 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -15,7 +15,7 @@ use crate::{Finalize, Module, ModuleOrUniformRoot, ParentScope, PerNS, ScopeSet} use crate::{NameBinding, NameBindingData, NameBindingKind, PathResult, Used}; use rustc_ast::NodeId; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::intern::Interned; use rustc_errors::{codes::*, pluralize, struct_span_code_err, Applicability, MultiSpan}; use rustc_hir::def::{self, DefKind, PartialRes}; @@ -224,7 +224,7 @@ impl<'a> ImportData<'a> { pub(crate) struct NameResolution<'a> { /// Single imports that may define the name in the namespace. /// Imports are arena-allocated, so it's ok to use pointers as keys. - pub single_imports: FxHashSet>, + pub single_imports: GxHashSet>, /// The least shadowable known binding for this name, or None if there are no known bindings. pub binding: Option>, pub shadowed_glob: Option>, @@ -526,7 +526,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.finalize_resolutions_in(*module); } - let mut seen_spans = FxHashSet::default(); + let mut seen_spans = GxHashSet::default(); let mut errors = vec![]; let mut prev_root_id: NodeId = NodeId::ZERO; let determined_imports = mem::take(&mut self.determined_imports); @@ -603,7 +603,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { pub(crate) fn check_hidden_glob_reexports( &mut self, - exported_ambiguities: FxHashSet>, + exported_ambiguities: GxHashSet>, ) { for module in self.arenas.local_modules().iter() { for (key, resolution) in self.resolutions(*module).borrow().iter() { diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 66a1c05289b7d..23a2ba2d8d398 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -14,7 +14,7 @@ use crate::{ResolutionError, Resolver, Segment, TyCtxt, UseError}; use rustc_ast::ptr::P; use rustc_ast::visit::{visit_opt, walk_list, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor}; use rustc_ast::*; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap}; use rustc_errors::{codes::*, Applicability, DiagArgValue, IntoDiagArg, StashKey}; use rustc_hir::def::Namespace::{self, *}; use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS}; @@ -41,7 +41,7 @@ mod diagnostics; type Res = def::Res; -type IdentMap = FxHashMap; +type IdentMap = GxHashMap; use diagnostics::{ElisionFnParameter, LifetimeElisionCandidate, MissingLifetime}; @@ -366,7 +366,7 @@ impl LifetimeBinderKind { struct LifetimeRib { kind: LifetimeRibKind, // We need to preserve insertion order for async fns. - bindings: FxIndexMap, + bindings: GxIndexMap, } impl LifetimeRib { @@ -611,7 +611,7 @@ struct DiagMetadata<'ast> { /// A list of labels as of yet unused. Labels will be removed from this map when /// they are used (in a `break` or `continue` statement) - unused_labels: FxHashMap, + unused_labels: GxHashMap, /// Only used for better errors on `let x = { foo: bar };`. /// In the case of a parse error with `let x = { foo: bar, };`, this isn't needed, it's only @@ -695,7 +695,7 @@ struct LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { in_func_body: bool, /// Count the number of places a lifetime is used. - lifetime_uses: FxHashMap, + lifetime_uses: GxHashMap, } /// Walks the whole crate in DFS order, visiting each item, resolving names as it goes. @@ -2126,7 +2126,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { let local_candidates = self.lifetime_elision_candidates.take(); if let Some(candidates) = local_candidates { - let distinct: FxHashSet<_> = candidates.iter().map(|(res, _)| *res).collect(); + let distinct: GxHashSet<_> = candidates.iter().map(|(res, _)| *res).collect(); let lifetime_count = distinct.len(); if lifetime_count != 0 { parameter_info.push(ElisionFnParameter { @@ -2629,9 +2629,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { let mut function_type_rib = Rib::new(kind); let mut function_value_rib = Rib::new(kind); let mut function_lifetime_rib = LifetimeRib::new(lifetime_kind); - let mut seen_bindings = FxHashMap::default(); + let mut seen_bindings = GxHashMap::default(); // Store all seen lifetimes names from outer scopes. - let mut seen_lifetimes = FxHashSet::default(); + let mut seen_lifetimes = GxHashSet::default(); // We also can't shadow bindings from the parent item if let RibKind::AssocItem = kind { @@ -3042,7 +3042,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { fn resolve_impl_item( &mut self, item: &'ast AssocItem, - seen_trait_items: &mut FxHashMap, + seen_trait_items: &mut GxHashMap, trait_id: Option, ) { use crate::ResolutionError::*; @@ -3191,7 +3191,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { kind: &AssocItemKind, ns: Namespace, span: Span, - seen_trait_items: &mut FxHashMap, + seen_trait_items: &mut GxHashMap, err: F, ) where F: FnOnce(Ident, String, Option) -> ResolutionError<'a>, @@ -3386,8 +3386,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { fn compute_and_check_binding_map( &mut self, pat: &Pat, - ) -> Result, IsNeverPattern> { - let mut binding_map = FxIndexMap::default(); + ) -> Result, IsNeverPattern> { + let mut binding_map = GxIndexMap::default(); let mut is_never_pat = false; pat.walk(&mut |pat| { @@ -3452,9 +3452,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { fn compute_and_check_or_pat_binding_map( &mut self, pats: &[P], - ) -> Result, IsNeverPattern> { - let mut missing_vars = FxIndexMap::default(); - let mut inconsistent_vars = FxIndexMap::default(); + ) -> Result, IsNeverPattern> { + let mut missing_vars = GxIndexMap::default(); + let mut inconsistent_vars = GxIndexMap::default(); // 1) Compute the binding maps of all arms; we must ignore never patterns here. let not_never_pats = pats @@ -3521,7 +3521,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { // All the patterns are never patterns, so the whole or-pattern is one too. Err(IsNeverPattern) } else { - let mut binding_map = FxIndexMap::default(); + let mut binding_map = GxIndexMap::default(); for (bm, _) in not_never_pats { binding_map.extend(bm); } @@ -3562,7 +3562,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { &mut self, pat: &'ast Pat, pat_src: PatternSource, - bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet); 1]>, + bindings: &mut SmallVec<[(PatBoundCtx, GxHashSet); 1]>, ) { // We walk the pattern before declaring the pattern's inner bindings, // so that we avoid resolving a literal expression to a binding defined @@ -3596,7 +3596,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { &mut self, pat: &Pat, pat_src: PatternSource, - bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet); 1]>, + bindings: &mut SmallVec<[(PatBoundCtx, GxHashSet); 1]>, ) { // Visit all direct subpatterns of this pattern. pat.walk(&mut |pat| { @@ -3665,7 +3665,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { ident: Ident, pat_id: NodeId, pat_src: PatternSource, - bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet); 1]>, + bindings: &mut SmallVec<[(PatBoundCtx, GxHashSet); 1]>, ) -> Res { // Add the binding to the local ribs, if it doesn't already exist in the bindings map. // (We must not add it if it's in the bindings map because that breaks the assumptions diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 764cc350182a6..eedf1554cbea3 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -16,8 +16,8 @@ use rustc_ast::{ MethodCall, NodeId, Path, Ty, TyKind, DUMMY_NODE_ID, }; use rustc_ast_pretty::pprust::where_bound_predicate_to_string; -use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxHashSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{ codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, SuggestionStyle, @@ -2280,7 +2280,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { fn find_module(&mut self, def_id: DefId) -> Option<(Module<'a>, ImportSuggestion)> { let mut result = None; - let mut seen_modules = FxHashSet::default(); + let mut seen_modules = GxHashSet::default(); let root_did = self.r.graph_root.def_id(); let mut worklist = vec![( self.r.graph_root, @@ -2782,9 +2782,9 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { | LifetimeBinderKind::WhereBound ); - let mut rm_inner_binders: FxIndexSet = Default::default(); + let mut rm_inner_binders: GxIndexSet = Default::default(); let (span, sugg) = if span.is_empty() { - let mut binder_idents: FxIndexSet = Default::default(); + let mut binder_idents: GxIndexSet = Default::default(); binder_idents.insert(Ident::from_str(name.unwrap_or("'a"))); // We need to special case binders in the following situation: diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 94cdce1025fe5..83bd020e72563 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -28,7 +28,7 @@ use rustc_ast::expand::StrippedCfgItem; use rustc_ast::node_id::NodeMap; use rustc_ast::{self as ast, attr, NodeId, CRATE_NODE_ID}; use rustc_ast::{AngleBracketedArg, Crate, Expr, ExprKind, GenericArg, GenericArgs, LitKind, Path}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap, GxIndexSet}; use rustc_data_structures::intern::Interned; use rustc_data_structures::steal::Steal; use rustc_data_structures::sync::{FreezeReadGuard, Lrc}; @@ -511,7 +511,7 @@ impl BindingKey { } } -type Resolutions<'a> = RefCell>>>; +type Resolutions<'a> = RefCell>>>; /// One node in the tree of modules. /// @@ -537,7 +537,7 @@ struct ModuleData<'a> { populate_on_access: Cell, /// Macro invocations that can expand into items in this module. - unexpanded_invocations: RefCell>, + unexpanded_invocations: RefCell>, /// Whether `#[no_implicit_prelude]` is active. no_implicit_prelude: bool, @@ -982,19 +982,19 @@ pub struct Resolver<'a, 'tcx> { tcx: TyCtxt<'tcx>, /// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`. - expn_that_defined: FxHashMap, + expn_that_defined: GxHashMap, graph_root: Module<'a>, prelude: Option>, - extern_prelude: FxHashMap>, + extern_prelude: GxHashMap>, /// N.B., this is used only for better diagnostics, not name resolution itself. field_def_ids: LocalDefIdMap<&'tcx [DefId]>, /// Span of the privacy modifier in fields of an item `DefId` accessible with dot syntax. /// Used for hints during error reporting. - field_visibility_spans: FxHashMap>, + field_visibility_spans: GxHashMap>, /// All imports known to succeed or fail. determined_imports: Vec>, @@ -1018,7 +1018,7 @@ pub struct Resolver<'a, 'tcx> { extra_lifetime_params_map: NodeMap>, /// `CrateNum` resolutions of `extern crate` items. - extern_crate_map: FxHashMap, + extern_crate_map: GxHashMap, module_children: LocalDefIdMap>, trait_map: NodeMap>, @@ -1041,19 +1041,19 @@ pub struct Resolver<'a, 'tcx> { /// some AST passes can generate identifiers that only resolve to local or /// lang items. empty_module: Module<'a>, - module_map: FxHashMap>, - binding_parent_modules: FxHashMap, Module<'a>>, + module_map: GxHashMap>, + binding_parent_modules: GxHashMap, Module<'a>>, underscore_disambiguator: u32, /// Disambiguator for anonymous adts. empty_disambiguator: u32, /// Maps glob imports to the names of items actually imported. - glob_map: FxHashMap>, + glob_map: GxHashMap>, glob_error: Option, visibilities_for_hashing: Vec<(LocalDefId, ty::Visibility)>, - used_imports: FxHashSet, - maybe_unused_trait_imports: FxIndexSet, + used_imports: GxHashSet, + maybe_unused_trait_imports: GxIndexSet, /// Privacy errors are delayed until the end in order to deduplicate them. privacy_errors: Vec>, @@ -1066,27 +1066,27 @@ pub struct Resolver<'a, 'tcx> { arenas: &'a ResolverArenas<'a>, dummy_binding: NameBinding<'a>, - builtin_types_bindings: FxHashMap>, - builtin_attrs_bindings: FxHashMap>, - registered_tool_bindings: FxHashMap>, + builtin_types_bindings: GxHashMap>, + builtin_attrs_bindings: GxHashMap>, + registered_tool_bindings: GxHashMap>, /// Binding for implicitly declared names that come with a module, /// like `self` (not yet used), or `crate`/`$crate` (for root modules). - module_self_bindings: FxHashMap, NameBinding<'a>>, + module_self_bindings: GxHashMap, NameBinding<'a>>, - used_extern_options: FxHashSet, - macro_names: FxHashSet, - builtin_macros: FxHashMap, + used_extern_options: GxHashSet, + macro_names: GxHashSet, + builtin_macros: GxHashMap, registered_tools: &'tcx RegisteredTools, - macro_use_prelude: FxHashMap>, - macro_map: FxHashMap, + macro_use_prelude: GxHashMap>, + macro_map: GxHashMap, dummy_ext_bang: Lrc, dummy_ext_derive: Lrc, non_macro_attr: MacroData, - local_macro_def_scopes: FxHashMap>, - ast_transform_scopes: FxHashMap>, - unused_macros: FxHashMap, - unused_macro_rules: FxHashMap<(LocalDefId, usize), (Ident, Span)>, - proc_macro_stubs: FxHashSet, + local_macro_def_scopes: GxHashMap>, + ast_transform_scopes: GxHashMap>, + unused_macros: GxHashMap, + unused_macro_rules: GxHashMap<(LocalDefId, usize), (Ident, Span)>, + proc_macro_stubs: GxHashSet, /// Traces collected during macro resolution and validated when it's complete. single_segment_macro_resolutions: Vec<(Ident, MacroKind, ParentScope<'a>, Option>)>, @@ -1096,23 +1096,23 @@ pub struct Resolver<'a, 'tcx> { /// `derive(Copy)` marks items they are applied to so they are treated specially later. /// Derive macros cannot modify the item themselves and have to store the markers in the global /// context, so they attach the markers to derive container IDs using this resolver table. - containers_deriving_copy: FxHashSet, + containers_deriving_copy: GxHashSet, /// Parent scopes in which the macros were invoked. /// FIXME: `derives` are missing in these parent scopes and need to be taken from elsewhere. - invocation_parent_scopes: FxHashMap>, + invocation_parent_scopes: GxHashMap>, /// `macro_rules` scopes *produced* by expanding the macro invocations, /// include all the `macro_rules` items and other invocations generated by them. - output_macro_rules_scopes: FxHashMap>, + output_macro_rules_scopes: GxHashMap>, /// `macro_rules` scopes produced by `macro_rules` item definitions. - macro_rules_scopes: FxHashMap>, + macro_rules_scopes: GxHashMap>, /// Helper attributes that are in scope for the given expansion. - helper_attrs: FxHashMap)>>, + helper_attrs: GxHashMap)>>, /// Ready or in-progress results of resolving paths inside the `#[derive(...)]` attribute /// with the given `ExpnId`. - derive_data: FxHashMap, + derive_data: GxHashMap, /// Avoid duplicated errors for "name already defined". - name_already_seen: FxHashMap, + name_already_seen: GxHashMap, potentially_unused_imports: Vec>, @@ -1124,7 +1124,7 @@ pub struct Resolver<'a, 'tcx> { struct_constructors: LocalDefIdMap<(Res, ty::Visibility, Vec>)>, /// Features declared for this crate. - declared_features: FxHashSet, + declared_features: GxHashSet, lint_buffer: LintBuffer, @@ -1134,46 +1134,46 @@ pub struct Resolver<'a, 'tcx> { def_id_to_node_id: IndexVec, /// Indices of unnamed struct or variant fields with unresolved attributes. - placeholder_field_indices: FxHashMap, + placeholder_field_indices: GxHashMap, /// When collecting definitions from an AST fragment produced by a macro invocation `ExpnId` /// we know what parent node that fragment should be attached to thanks to this table, /// and how the `impl Trait` fragments were introduced. - invocation_parents: FxHashMap, + invocation_parents: GxHashMap, /// Some way to know that we are in a *trait* impl in `visit_assoc_item`. /// FIXME: Replace with a more general AST map (together with some other fields). - trait_impl_items: FxHashSet, + trait_impl_items: GxHashSet, - legacy_const_generic_args: FxHashMap>>, + legacy_const_generic_args: GxHashMap>>, /// Amount of lifetime parameters for each item in the crate. - item_generics_num_lifetimes: FxHashMap, + item_generics_num_lifetimes: GxHashMap, delegation_fn_sigs: LocalDefIdMap, main_def: Option, - trait_impls: FxIndexMap>, + trait_impls: GxIndexMap>, /// A list of proc macro LocalDefIds, written out in the order in which /// they are declared in the static array generated by proc_macro_harness. proc_macros: Vec, - confused_type_with_std_module: FxHashMap, + confused_type_with_std_module: GxHashMap, /// Whether lifetime elision was successful. - lifetime_elision_allowed: FxHashSet, + lifetime_elision_allowed: GxHashSet, /// Names of items that were stripped out via cfg with their corresponding cfg meta item. stripped_cfg_items: Vec>, effective_visibilities: EffectiveVisibilities, - doc_link_resolutions: FxHashMap, - doc_link_traits_in_scope: FxHashMap>, - all_macro_rules: FxHashMap, + doc_link_resolutions: GxHashMap, + doc_link_traits_in_scope: GxHashMap>, + all_macro_rules: GxHashMap, /// Invocation ids of all glob delegations. - glob_delegation_invoc_ids: FxHashSet, + glob_delegation_invoc_ids: GxHashSet, /// Analogue of module `unexpanded_invocations` but in trait impls, excluding glob delegations. /// Needed because glob delegations wait for all other neighboring macros to expand. - impl_unexpanded_invocations: FxHashMap>, + impl_unexpanded_invocations: GxHashMap>, /// Simplified analogue of module `resolutions` but in trait impls, excluding glob delegations. /// Needed because glob delegations exclude explicitly defined names. - impl_binding_keys: FxHashMap>, + impl_binding_keys: GxHashMap>, } /// Nothing really interesting here; it just provides memory for the rest of the crate. @@ -1195,8 +1195,8 @@ impl<'a> ResolverArenas<'a> { expn_id: ExpnId, span: Span, no_implicit_prelude: bool, - module_map: &mut FxHashMap>, - module_self_bindings: &mut FxHashMap, NameBinding<'a>>, + module_map: &mut GxHashMap>, + module_self_bindings: &mut GxHashMap, NameBinding<'a>>, ) -> Module<'a> { let module = Module(Interned::new_unchecked(self.modules.alloc(ModuleData::new( parent, @@ -1339,8 +1339,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { arenas: &'a ResolverArenas<'a>, ) -> Resolver<'a, 'tcx> { let root_def_id = CRATE_DEF_ID.to_def_id(); - let mut module_map = FxHashMap::default(); - let mut module_self_bindings = FxHashMap::default(); + let mut module_map = GxHashMap::default(); + let mut module_self_bindings = GxHashMap::default(); let graph_root = arenas.new_module( None, ModuleKind::Def(DefKind::Mod, root_def_id, kw::Empty), @@ -1356,8 +1356,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ExpnId::root(), DUMMY_SP, true, - &mut FxHashMap::default(), - &mut FxHashMap::default(), + &mut GxHashMap::default(), + &mut GxHashMap::default(), ); let mut def_id_to_node_id = IndexVec::default(); @@ -1369,10 +1369,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let crate_feed = crate_feed.downgrade(); node_id_to_def_id.insert(CRATE_NODE_ID, crate_feed); - let mut invocation_parents = FxHashMap::default(); + let mut invocation_parents = GxHashMap::default(); invocation_parents.insert(LocalExpnId::ROOT, (CRATE_DEF_ID, ImplTraitContext::Existential)); - let mut extern_prelude: FxHashMap> = tcx + let mut extern_prelude: GxHashMap> = tcx .sess .opts .externs @@ -1406,7 +1406,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { extern_prelude, field_def_ids: Default::default(), - field_visibility_spans: FxHashMap::default(), + field_visibility_spans: GxHashMap::default(), determined_imports: Vec::new(), indeterminate_imports: Vec::new(), @@ -1425,13 +1425,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { empty_module, module_map, block_map: Default::default(), - binding_parent_modules: FxHashMap::default(), - ast_transform_scopes: FxHashMap::default(), + binding_parent_modules: GxHashMap::default(), + ast_transform_scopes: GxHashMap::default(), glob_map: Default::default(), glob_error: None, visibilities_for_hashing: Default::default(), - used_imports: FxHashSet::default(), + used_imports: GxHashSet::default(), maybe_unused_trait_imports: Default::default(), privacy_errors: Vec::new(), @@ -1469,11 +1469,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { module_self_bindings, used_extern_options: Default::default(), - macro_names: FxHashSet::default(), + macro_names: GxHashSet::default(), builtin_macros: Default::default(), registered_tools, - macro_use_prelude: FxHashMap::default(), - macro_map: FxHashMap::default(), + macro_use_prelude: GxHashMap::default(), + macro_map: GxHashMap::default(), dummy_ext_bang: Lrc::new(SyntaxExtension::dummy_bang(edition)), dummy_ext_derive: Lrc::new(SyntaxExtension::dummy_derive(edition)), non_macro_attr: MacroData::new(Lrc::new(SyntaxExtension::non_macro_attr(edition))), @@ -1482,8 +1482,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { macro_rules_scopes: Default::default(), helper_attrs: Default::default(), derive_data: Default::default(), - local_macro_def_scopes: FxHashMap::default(), - name_already_seen: FxHashMap::default(), + local_macro_def_scopes: GxHashMap::default(), + name_already_seen: GxHashMap::default(), potentially_unused_imports: Vec::new(), potentially_unnecessary_qualifications: Default::default(), struct_constructors: Default::default(), diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index 66b4981eb55ba..5dd82d74c6686 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -1,7 +1,7 @@ use pulldown_cmark::{BrokenLink, CowStr, Event, LinkType, Options, Parser, Tag}; use rustc_ast as ast; use rustc_ast::util::comments::beautify_doc_string; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; use rustc_span::symbol::{kw, sym, Symbol}; @@ -232,8 +232,8 @@ fn span_for_value(attr: &ast::Attribute) -> Span { /// early and late doc link resolution regardless of their position. pub fn prepare_to_doc_link_resolution( doc_fragments: &[DocFragment], -) -> FxHashMap, String> { - let mut res = FxHashMap::default(); +) -> GxHashMap, String> { + let mut res = GxHashMap::default(); for fragment in doc_fragments { let out_str = res.entry(fragment.item_id).or_default(); add_doc_fragment(out_str, fragment); diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs index f998fd599b7c0..b1783a478beda 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs @@ -8,7 +8,7 @@ use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::ALPHANUMERIC_ONLY; use rustc_data_structures::base_n::CASE_INSENSITIVE; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir as hir; use rustc_middle::bug; use rustc_middle::ty::layout::IntegerExt; @@ -49,7 +49,7 @@ pub enum TyQ { /// Substitutes a component if found in the substitution dictionary (see /// ). fn compress<'tcx>( - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, key: DictKey<'tcx>, comp: &mut String, ) { @@ -71,7 +71,7 @@ fn encode_args<'tcx>( args: GenericArgsRef<'tcx>, for_def: DefId, has_erased_self: bool, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: EncodeTyOptions, ) -> String { // [IE] as part of vendor extended type @@ -107,7 +107,7 @@ fn encode_const<'tcx>( tcx: TyCtxt<'tcx>, c: Const<'tcx>, ct_ty: Ty<'tcx>, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: EncodeTyOptions, ) -> String { // L[n][]E as literal argument @@ -173,7 +173,7 @@ fn encode_const<'tcx>( fn encode_fnsig<'tcx>( tcx: TyCtxt<'tcx>, fn_sig: &FnSig<'tcx>, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: TypeIdOptions, ) -> String { // Function types are delimited by an "F..E" pair @@ -229,7 +229,7 @@ fn encode_fnsig<'tcx>( fn encode_predicate<'tcx>( tcx: TyCtxt<'tcx>, predicate: ty::PolyExistentialPredicate<'tcx>, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: EncodeTyOptions, ) -> String { // u[IE], where is , as vendor @@ -270,7 +270,7 @@ fn encode_predicate<'tcx>( fn encode_predicates<'tcx>( tcx: TyCtxt<'tcx>, predicates: &List>, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: EncodeTyOptions, ) -> String { // E as part of vendor extended type @@ -283,7 +283,7 @@ fn encode_predicates<'tcx>( } /// Encodes a region using the Itanium C++ ABI as a vendor extended type. -fn encode_region<'tcx>(region: Region<'tcx>, dict: &mut FxHashMap, usize>) -> String { +fn encode_region<'tcx>(region: Region<'tcx>, dict: &mut GxHashMap, usize>) -> String { // u6region[I[][]E] as vendor extended type let mut s = String::new(); match region.kind() { @@ -321,7 +321,7 @@ fn encode_region<'tcx>(region: Region<'tcx>, dict: &mut FxHashMap, pub fn encode_ty<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, - dict: &mut FxHashMap, usize>, + dict: &mut GxHashMap, usize>, options: EncodeTyOptions, ) -> String { let mut typeid = String::new(); diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs index ac664c53f4454..f486f9a06e8ca 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs @@ -4,7 +4,7 @@ //! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, //! see design document in the tracking issue #89653. -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_middle::bug; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; use rustc_target::abi::call::{Conv, FnAbi, PassMode}; @@ -40,7 +40,7 @@ pub fn typeid_for_fnabi<'tcx>( // A dictionary of substitution candidates used for compression (see // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression). - let mut dict: FxHashMap, usize> = FxHashMap::default(); + let mut dict: GxHashMap, usize> = GxHashMap::default(); let mut encode_ty_options = EncodeTyOptions::from_bits(options.bits()) .unwrap_or_else(|| bug!("typeid_for_fnabi: invalid option(s) `{:?}`", options.bits())); diff --git a/compiler/rustc_session/src/code_stats.rs b/compiler/rustc_session/src/code_stats.rs index 93839fa1186af..beadc5eeb77ce 100644 --- a/compiler/rustc_session/src/code_stats.rs +++ b/compiler/rustc_session/src/code_stats.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::sync::Lock; use rustc_span::def_id::DefId; use rustc_span::Symbol; @@ -91,8 +91,8 @@ pub struct VTableSizeInfo { #[derive(Default)] pub struct CodeStats { - type_sizes: Lock>, - vtable_sizes: Lock>, + type_sizes: Lock>, + vtable_sizes: Lock>, } impl CodeStats { diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 2d38ad3713328..7337415ac303e 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -10,7 +10,7 @@ use crate::search_paths::SearchPath; use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind}; use crate::{filesearch, lint, HashStableContext}; use crate::{EarlyDiagCtxt, Session}; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_data_structures::stable_hasher::{StableOrd, ToStableHashKey}; use rustc_errors::emitter::HumanReadableErrorType; use rustc_errors::{ColorConfig, DiagArgValue, DiagCtxtFlags, IntoDiagArg}; @@ -1158,7 +1158,7 @@ impl Default for Options { pretty: None, working_dir: RealFileName::LocalPath(std::env::current_dir().unwrap()), color: ColorConfig::Auto, - logical_env: FxIndexMap::default(), + logical_env: GxIndexMap::default(), verbose: false, } } @@ -1923,7 +1923,7 @@ fn collect_print_requests( // cfg=output.txt --print link-args=output.txt`, because outputs are printed // by disparate pieces of the compiler, and keeping track of which files // need to be overwritten vs appended to is annoying. - let mut printed_paths = FxHashSet::default(); + let mut printed_paths = GxHashSet::default(); prints.extend(matches.opt_strs("print").into_iter().map(|req| { let (req, out) = split_out_file_name(&req); @@ -2363,8 +2363,8 @@ fn parse_remap_path_prefix( fn parse_logical_env( early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, -) -> FxIndexMap { - let mut vars = FxIndexMap::default(); +) -> GxIndexMap { + let mut vars = GxIndexMap::default(); for arg in matches.opt_strs("env-set") { if let Some((name, val)) = arg.split_once('=') { @@ -2970,7 +2970,7 @@ pub(crate) mod dep_tracking { }; use crate::lint; use crate::utils::NativeLib; - use rustc_data_structures::fx::FxIndexMap; + use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::stable_hasher::Hash64; use rustc_errors::LanguageIdentifier; use rustc_feature::UnstableFeatures; @@ -3133,7 +3133,7 @@ pub(crate) mod dep_tracking { } } - impl DepTrackingHash for FxIndexMap { + impl DepTrackingHash for GxIndexMap { fn hash( &self, hasher: &mut DefaultHasher, diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index 2fa04bbe345e8..d6d5a8664ca12 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -19,7 +19,7 @@ //! so that the compiler can know the cfg is expected //! - Add the feature gating in `compiler/rustc_feature/src/builtin_attrs.rs` -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexSet}; use rustc_span::symbol::{sym, Symbol}; use rustc_target::abi::Align; use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet}; @@ -34,9 +34,9 @@ use std::iter; /// The parsed `--cfg` options that define the compilation environment of the /// crate, used to drive conditional compilation. /// -/// An `FxIndexSet` is used to ensure deterministic ordering of error messages +/// An `GxIndexSet` is used to ensure deterministic ordering of error messages /// relating to `--cfg`. -pub type Cfg = FxIndexSet<(Symbol, Option)>; +pub type Cfg = GxIndexSet<(Symbol, Option)>; /// The parsed `--check-cfg` options. #[derive(Default)] @@ -46,13 +46,13 @@ pub struct CheckCfg { /// Is well known values activated pub exhaustive_values: bool, /// All the expected values for a config name - pub expecteds: FxHashMap>, + pub expecteds: GxHashMap>, /// Well known names (only used for diagnostics purposes) - pub well_known_names: FxHashSet, + pub well_known_names: GxHashSet, } pub enum ExpectedValues { - Some(FxHashSet>), + Some(GxHashSet>), Any, } @@ -228,14 +228,14 @@ impl CheckCfg { // for `#[cfg(foo)]` (ie. cfg value is none) let no_values = || { - let mut values = FxHashSet::default(); + let mut values = GxHashSet::default(); values.insert(None); ExpectedValues::Some(values) }; // preparation for inserting some values let empty_values = || { - let values = FxHashSet::default(); + let values = GxHashSet::default(); ExpectedValues::Some(values) }; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 9a10adeb6d1a1..f17e2ea0a3eab 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2,7 +2,7 @@ use crate::config::*; use crate::search_paths::SearchPath; use crate::utils::NativeLib; use crate::{lint, EarlyDiagCtxt}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::profiling::TimePassesFormat; use rustc_data_structures::stable_hasher::Hash64; use rustc_errors::ColorConfig; @@ -149,7 +149,7 @@ top_level_options!( target_triple: TargetTriple [TRACKED], /// Effective logical environment used by `env!`/`option_env!` macros - logical_env: FxIndexMap [TRACKED], + logical_env: GxIndexMap [TRACKED], test: bool [TRACKED], error_format: ErrorOutputType [UNTRACKED], diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 200505aaea209..ae78c68a92355 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -11,7 +11,7 @@ use crate::lint::{ }; use crate::Session; use rustc_ast::node_id::NodeId; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap, GxIndexSet}; use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc}; use rustc_errors::emitter::{stderr_destination, HumanEmitter, SilentEmitter}; use rustc_errors::{ @@ -31,7 +31,7 @@ use std::str; /// used and should be feature gated accordingly in `check_crate`. #[derive(Default)] pub struct GatedSpans { - pub spans: Lock>>, + pub spans: Lock>>, } impl GatedSpans { @@ -51,7 +51,7 @@ impl GatedSpans { } /// Prepend the given set of `spans` onto the set in `self`. - pub fn merge(&self, mut spans: FxHashMap>) { + pub fn merge(&self, mut spans: GxHashMap>) { let mut inner = self.spans.borrow_mut(); // The entries will be moved to another map so the drain order does not // matter. @@ -66,7 +66,7 @@ impl GatedSpans { #[derive(Default)] pub struct SymbolGallery { /// All symbols occurred and their first occurrence span. - pub symbols: Lock>, + pub symbols: Lock>, } impl SymbolGallery { @@ -212,19 +212,19 @@ pub struct ParseSess { /// Places where identifiers that contain invalid Unicode codepoints but that look like they /// should be. Useful to avoid bad tokenization when encountering emoji. We group them to /// provide a single error per unique incorrect identifier. - pub bad_unicode_identifiers: Lock>>, + pub bad_unicode_identifiers: Lock>>, source_map: Lrc, pub buffered_lints: Lock>, /// Contains the spans of block expressions that could have been incomplete based on the /// operation token that followed it, but that the parser cannot identify without further /// analysis. - pub ambiguous_block_expr_parse: Lock>, + pub ambiguous_block_expr_parse: Lock>, pub gated_spans: GatedSpans, pub symbol_gallery: SymbolGallery, /// Environment variables accessed during the build and their values when they exist. - pub env_depinfo: Lock)>>, + pub env_depinfo: Lock)>>, /// File paths accessed during the build. - pub file_depinfo: Lock>, + pub file_depinfo: Lock>, /// Whether cfg(version) should treat the current release as incomplete pub assume_incomplete_release: bool, /// Spans passed to `proc_macro::quote_span`. Each span has a numerical diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 89d029fa6e0ed..5d399d0e0b864 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -11,7 +11,7 @@ use crate::search_paths::{PathKind, SearchPath}; use crate::{filesearch, lint}; use rustc_data_structures::flock; -use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexSet}; use rustc_data_structures::jobserver::{self, Client}; use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef}; use rustc_data_structures::sync::{ @@ -177,7 +177,7 @@ pub struct Session { pub registered_lints: bool, /// Cap lint level specified by a driver specifically. - pub driver_lint_caps: FxHashMap, + pub driver_lint_caps: GxHashMap, /// Tracks the current behavior of the CTFE engine when an error occurs. /// Options range from returning the error without a backtrace to returning an error @@ -197,10 +197,10 @@ pub struct Session { pub asm_arch: Option, /// Set of enabled features for the current target. - pub target_features: FxIndexSet, + pub target_features: GxIndexSet, /// Set of enabled features for the current target, including unstable ones. - pub unstable_target_features: FxIndexSet, + pub unstable_target_features: GxIndexSet, /// The version of the rustc process, possibly including a commit hash and description. pub cfg_version: &'static str, @@ -1012,7 +1012,7 @@ pub fn build_session( bundle: Option>, registry: rustc_errors::registry::Registry, fluent_resources: Vec<&'static str>, - driver_lint_caps: FxHashMap, + driver_lint_caps: GxHashMap, target: Target, sysroot: PathBuf, cfg_version: &'static str, diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs index 810ffc142a09f..37600a9090c7d 100644 --- a/compiler/rustc_smir/src/rustc_internal/mod.rs +++ b/compiler/rustc_smir/src/rustc_internal/mod.rs @@ -4,8 +4,8 @@ //! until stable MIR is complete. use crate::rustc_smir::{context::TablesWrapper, Stable, Tables}; -use rustc_data_structures::fx; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx; +use rustc_data_structures::gx::GxIndexMap; use rustc_middle::mir::interpret::AllocId; use rustc_middle::ty; use rustc_middle::ty::TyCtxt; @@ -395,15 +395,15 @@ macro_rules! run_driver { }}; } -/// Simmilar to rustc's `FxIndexMap`, `IndexMap` with extra +/// Simmilar to rustc's `IndexMap`, `IndexMap` with extra /// safety features added. pub struct IndexMap { - index_map: fx::FxIndexMap, + index_map: gx::GxIndexMap, } impl Default for IndexMap { fn default() -> Self { - Self { index_map: FxIndexMap::default() } + Self { index_map: GxIndexMap::default() } } } diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index 5456303b36fe4..47ae37317e6be 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -243,7 +243,7 @@ impl !Ord for DefId {} impl !PartialOrd for DefId {} // On 64-bit systems, we can hash the whole `DefId` as one `u64` instead of two `u32`s. This -// improves performance without impairing `FxHash` quality. So the below code gets compiled to a +// improves performance without impairing `GxHash` quality. So the below code gets compiled to a // noop on little endian systems because the memory layout of `DefId` is as follows: // // ``` @@ -252,14 +252,14 @@ impl !PartialOrd for DefId {} // +-------------------+-------------------+ // ``` // -// The order here has direct impact on `FxHash` quality because we have far more `DefIndex` per +// The order here has direct impact on `GxHash` quality because we have far more `DefIndex` per // crate than we have `Crate`s within one compilation. Or in other words, this arrangement puts -// more entropy in the low bits than the high bits. The reason this matters is that `FxHash`, which +// more entropy in the low bits than the high bits. The reason this matters is that `GxHash`, which // is used throughout rustc, has problems distributing the entropy from the high bits, so reversing // the order would lead to a large number of collisions and thus far worse performance. // // On 64-bit big-endian systems, this compiles to a 64-bit rotation by 32 bits, which is still -// faster than another `FxHash` round. +// faster than another `GxHash` round. #[cfg(target_pointer_width = "64")] impl Hash for DefId { fn hash(&self, h: &mut H) { diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 483e32c645393..2bc60a79db38e 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -29,7 +29,7 @@ use crate::edition::Edition; use crate::symbol::{kw, sym, Symbol}; use crate::{with_session_globals, HashStableContext, Span, SpanDecoder, SpanEncoder, DUMMY_SP}; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::stable_hasher::{Hash64, HashStable, HashingControls, StableHasher}; use rustc_data_structures::sync::{Lock, Lrc, WorkerLocal}; use rustc_data_structures::unhash::UnhashMap; @@ -327,11 +327,11 @@ pub(crate) struct HygieneData { local_expn_hashes: IndexVec, /// Data and hash information from external crates. We may eventually want to remove these /// maps, and fetch the information directly from the other crate's metadata like DefIds do. - foreign_expn_data: FxHashMap, - foreign_expn_hashes: FxHashMap, + foreign_expn_data: GxHashMap, + foreign_expn_hashes: GxHashMap, expn_hash_to_expn_id: UnhashMap, syntax_context_data: Vec, - syntax_context_map: FxHashMap<(SyntaxContext, ExpnId, Transparency), SyntaxContext>, + syntax_context_map: GxHashMap<(SyntaxContext, ExpnId, Transparency), SyntaxContext>, /// Maps the `local_hash` of an `ExpnData` to the next disambiguator value. /// This is used by `update_disambiguator` to keep track of which `ExpnData`s /// would have collisions without a disambiguator. @@ -353,8 +353,8 @@ impl HygieneData { HygieneData { local_expn_data: IndexVec::from_elem_n(Some(root_data), 1), local_expn_hashes: IndexVec::from_elem_n(ExpnHash(Fingerprint::ZERO), 1), - foreign_expn_data: FxHashMap::default(), - foreign_expn_hashes: FxHashMap::default(), + foreign_expn_data: GxHashMap::default(), + foreign_expn_hashes: GxHashMap::default(), expn_hash_to_expn_id: std::iter::once((ExpnHash(Fingerprint::ZERO), ExpnId::root())) .collect(), syntax_context_data: vec![SyntaxContextData { @@ -365,7 +365,7 @@ impl HygieneData { opaque_and_semitransparent: SyntaxContext(0), dollar_crate_name: kw::DollarCrate, }], - syntax_context_map: FxHashMap::default(), + syntax_context_map: GxHashMap::default(), expn_data_disambiguators: UnhashMap::default(), } } @@ -1185,16 +1185,16 @@ pub struct HygieneEncodeContext { /// All `SyntaxContexts` for which we have written `SyntaxContextData` into crate metadata. /// This is `None` after we finish encoding `SyntaxContexts`, to ensure /// that we don't accidentally try to encode any more `SyntaxContexts` - serialized_ctxts: Lock>, + serialized_ctxts: Lock>, /// The `SyntaxContexts` that we have serialized (e.g. as a result of encoding `Spans`) /// in the most recent 'round' of serializing. Serializing `SyntaxContextData` /// may cause us to serialize more `SyntaxContext`s, so serialize in a loop /// until we reach a fixed point. - latest_ctxts: Lock>, + latest_ctxts: Lock>, - serialized_expns: Lock>, + serialized_expns: Lock>, - latest_expns: Lock>, + latest_expns: Lock>, } impl HygieneEncodeContext { @@ -1259,7 +1259,7 @@ struct HygieneDecodeContextInner { remapped_ctxts: Vec>, /// Maps serialized `SyntaxContext` ids that are currently being decoded to a `SyntaxContext`. - decoding: FxHashMap, + decoding: GxHashMap, } #[derive(Default)] @@ -1268,7 +1268,7 @@ pub struct HygieneDecodeContext { inner: Lock, /// A set of serialized `SyntaxContext` ids that are currently being decoded on each thread. - local_in_progress: WorkerLocal>>, + local_in_progress: WorkerLocal>>, } /// Register an expansion which has been decoded from the on-disk-cache for the local crate. diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 266956d63d710..d3c30fa263794 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -70,7 +70,7 @@ pub mod fatal_error; pub mod profiling; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::stable_hasher::{Hash128, Hash64, HashStable, StableHasher}; use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock, Lrc}; @@ -99,7 +99,7 @@ pub struct SessionGlobals { span_interner: Lock, /// Maps a macro argument token into use of the corresponding metavariable in the macro body. /// Collisions are possible and processed in `maybe_use_metavar_location` on best effort basis. - metavar_spans: Lock>, + metavar_spans: Lock>, hygiene_data: Lock, /// The session's source map, if there is one. This field should only be @@ -174,7 +174,7 @@ pub fn create_default_session_globals_then(f: impl FnOnce() -> R) -> R { scoped_tls::scoped_thread_local!(static SESSION_GLOBALS: SessionGlobals); #[inline] -pub fn with_metavar_spans(f: impl FnOnce(&mut FxHashMap) -> R) -> R { +pub fn with_metavar_spans(f: impl FnOnce(&mut GxHashMap) -> R) -> R { with_session_globals(|session_globals| f(&mut session_globals.metavar_spans.lock())) } @@ -876,7 +876,7 @@ impl Span { /// Check if you can select metavar spans for the given spans to get matching contexts. fn try_metavars(a: SpanData, b: SpanData, a_orig: Span, b_orig: Span) -> (SpanData, SpanData) { - let get = |mspans: &FxHashMap<_, _>, s| mspans.get(&s).copied(); + let get = |mspans: &GxHashMap<_, _>, s| mspans.get(&s).copied(); match with_metavar_spans(|mspans| (get(mspans, a_orig), get(mspans, b_orig))) { (None, None) => {} (Some(meta_a), None) => { diff --git a/compiler/rustc_span/src/span_encoding.rs b/compiler/rustc_span/src/span_encoding.rs index 53d7b7511a621..ab549add7ea64 100644 --- a/compiler/rustc_span/src/span_encoding.rs +++ b/compiler/rustc_span/src/span_encoding.rs @@ -3,7 +3,7 @@ use crate::hygiene::SyntaxContext; use crate::SPAN_TRACK; use crate::{BytePos, SpanData}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; // This code is very hot and uses lots of arithmetic, avoid overflow checks for performance. // See https://github.com/rust-lang/rust/pull/119440#issuecomment-1874255727 @@ -427,7 +427,7 @@ impl Span { #[derive(Default)] pub struct SpanInterner { - spans: FxIndexSet, + spans: GxIndexSet, } impl SpanInterner { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 6d4a8c29bc902..ebdaa1df84c96 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -3,7 +3,7 @@ //! type, and vice versa. use rustc_arena::DroplessArena; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_data_structures::stable_hasher::{ HashStable, StableCompare, StableHasher, ToStableHashKey, }; @@ -2366,7 +2366,7 @@ pub(crate) struct Interner(Lock); // between `Interner`s. struct InternerInner { arena: DroplessArena, - strings: FxIndexSet<&'static str>, + strings: GxIndexSet<&'static str>, } impl Interner { diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 42c4fa83d1bf0..97ef557934809 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -1,5 +1,5 @@ use rustc_data_structures::base_n::ToBaseN; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_data_structures::intern::Interned; use rustc_hir as hir; use rustc_hir::def::CtorKind; @@ -34,9 +34,9 @@ pub(super) fn mangle<'tcx>( let mut cx: SymbolMangler<'_> = SymbolMangler { tcx, start_offset: prefix.len(), - paths: FxHashMap::default(), - types: FxHashMap::default(), - consts: FxHashMap::default(), + paths: GxHashMap::default(), + types: GxHashMap::default(), + consts: GxHashMap::default(), binders: vec![], out: String::from(prefix), }; @@ -74,9 +74,9 @@ pub(super) fn mangle_typeid_for_trait_ref<'tcx>( let mut cx = SymbolMangler { tcx, start_offset: 0, - paths: FxHashMap::default(), - types: FxHashMap::default(), - consts: FxHashMap::default(), + paths: GxHashMap::default(), + types: GxHashMap::default(), + consts: GxHashMap::default(), binders: vec![], out: String::new(), }; @@ -106,9 +106,9 @@ struct SymbolMangler<'tcx> { /// The length of the prefix in `out` (e.g. 2 for `_R`). start_offset: usize, /// The values are start positions in `out`, in bytes. - paths: FxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>, - types: FxHashMap, usize>, - consts: FxHashMap, usize>, + paths: GxHashMap<(DefId, &'tcx [GenericArg<'tcx>]), usize>, + types: GxHashMap, usize>, + consts: GxHashMap, usize>, } impl<'tcx> SymbolMangler<'tcx> { diff --git a/compiler/rustc_target/src/asm/aarch64.rs b/compiler/rustc_target/src/asm/aarch64.rs index 1a3218da1af04..0a172a23ef90d 100644 --- a/compiler/rustc_target/src/asm/aarch64.rs +++ b/compiler/rustc_target/src/asm/aarch64.rs @@ -1,6 +1,6 @@ use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use crate::spec::{RelocModel, Target}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_span::Symbol; use std::fmt; @@ -75,7 +75,7 @@ pub fn target_reserves_x18(target: &Target) -> bool { fn reserved_x18( _arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -89,7 +89,7 @@ fn reserved_x18( fn restricted_for_arm64ec( arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { diff --git a/compiler/rustc_target/src/asm/arm.rs b/compiler/rustc_target/src/asm/arm.rs index 70fcaab184757..28bc7e4fde30e 100644 --- a/compiler/rustc_target/src/asm/arm.rs +++ b/compiler/rustc_target/src/asm/arm.rs @@ -1,6 +1,6 @@ use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use crate::spec::{RelocModel, Target}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_span::{sym, Symbol}; use std::fmt; @@ -65,14 +65,14 @@ impl ArmInlineAsmRegClass { } // This uses the same logic as useR7AsFramePointer in LLVM -fn frame_pointer_is_r7(target_features: &FxIndexSet, target: &Target) -> bool { +fn frame_pointer_is_r7(target_features: &GxIndexSet, target: &Target) -> bool { target.is_like_osx || (!target.is_like_windows && target_features.contains(&sym::thumb_mode)) } fn frame_pointer_r11( arch: InlineAsmArch, reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, target: &Target, is_clobber: bool, ) -> Result<(), &'static str> { @@ -88,7 +88,7 @@ fn frame_pointer_r11( fn frame_pointer_r7( _arch: InlineAsmArch, _reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -102,7 +102,7 @@ fn frame_pointer_r7( fn not_thumb1( _arch: InlineAsmArch, _reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, _target: &Target, is_clobber: bool, ) -> Result<(), &'static str> { @@ -119,7 +119,7 @@ fn not_thumb1( fn reserved_r9( arch: InlineAsmArch, reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, target: &Target, is_clobber: bool, ) -> Result<(), &'static str> { diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index b057bf94a087a..f1965bfdf5bdb 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -1,6 +1,6 @@ use crate::spec::Target; use crate::{abi::Size, spec::RelocModel}; -use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxIndexSet}; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_span::Symbol; use std::fmt; @@ -47,16 +47,16 @@ macro_rules! def_reg_class { } } - pub(super) fn regclass_map() -> rustc_data_structures::fx::FxHashMap< + pub(super) fn regclass_map() -> rustc_data_structures::gx::GxHashMap< super::InlineAsmRegClass, - rustc_data_structures::fx::FxIndexSet, + rustc_data_structures::gx::GxIndexSet, > { - use rustc_data_structures::fx::FxHashMap; - use rustc_data_structures::fx::FxIndexSet; + use rustc_data_structures::gx::GxHashMap; + use rustc_data_structures::gx::GxIndexSet; use super::InlineAsmRegClass; - let mut map = FxHashMap::default(); + let mut map = GxHashMap::default(); $( - map.insert(InlineAsmRegClass::$arch($arch_regclass::$class), FxIndexSet::default()); + map.insert(InlineAsmRegClass::$arch($arch_regclass::$class), GxIndexSet::default()); )* map } @@ -107,7 +107,7 @@ macro_rules! def_regs { pub fn validate(self, _arch: super::InlineAsmArch, _reloc_model: crate::spec::RelocModel, - _target_features: &rustc_data_structures::fx::FxIndexSet, + _target_features: &rustc_data_structures::gx::GxIndexSet, _target: &crate::spec::Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -131,11 +131,11 @@ macro_rules! def_regs { pub(super) fn fill_reg_map( _arch: super::InlineAsmArch, _reloc_model: crate::spec::RelocModel, - _target_features: &rustc_data_structures::fx::FxIndexSet, + _target_features: &rustc_data_structures::gx::GxIndexSet, _target: &crate::spec::Target, - _map: &mut rustc_data_structures::fx::FxHashMap< + _map: &mut rustc_data_structures::gx::GxHashMap< super::InlineAsmRegClass, - rustc_data_structures::fx::FxIndexSet, + rustc_data_structures::gx::GxIndexSet, >, ) { #[allow(unused_imports)] @@ -375,7 +375,7 @@ impl InlineAsmReg { self, arch: InlineAsmArch, reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, target: &Target, is_clobber: bool, ) -> Result<(), &'static str> { @@ -787,9 +787,9 @@ impl fmt::Display for InlineAsmType { pub fn allocatable_registers( arch: InlineAsmArch, reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, target: &crate::spec::Target, -) -> FxHashMap> { +) -> GxHashMap> { match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { let mut map = x86::regclass_map(); diff --git a/compiler/rustc_target/src/asm/riscv.rs b/compiler/rustc_target/src/asm/riscv.rs index 02a4a5e2ece59..a5e77d1ca622c 100644 --- a/compiler/rustc_target/src/asm/riscv.rs +++ b/compiler/rustc_target/src/asm/riscv.rs @@ -1,6 +1,6 @@ use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use crate::spec::{RelocModel, Target}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_span::{sym, Symbol}; use std::fmt; @@ -55,7 +55,7 @@ impl RiscVInlineAsmRegClass { fn not_e( _arch: InlineAsmArch, _reloc_model: RelocModel, - target_features: &FxIndexSet, + target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { diff --git a/compiler/rustc_target/src/asm/x86.rs b/compiler/rustc_target/src/asm/x86.rs index 8452961c17c0f..4f110effcc1b8 100644 --- a/compiler/rustc_target/src/asm/x86.rs +++ b/compiler/rustc_target/src/asm/x86.rs @@ -1,6 +1,6 @@ use super::{InlineAsmArch, InlineAsmType, ModifierInfo}; use crate::spec::{RelocModel, Target}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_span::Symbol; use std::fmt; @@ -142,7 +142,7 @@ impl X86InlineAsmRegClass { fn x86_64_only( arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -156,7 +156,7 @@ fn x86_64_only( fn high_byte( arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -169,7 +169,7 @@ fn high_byte( fn rbx_reserved( arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { @@ -185,7 +185,7 @@ fn rbx_reserved( fn esi_reserved( arch: InlineAsmArch, _reloc_model: RelocModel, - _target_features: &FxIndexSet, + _target_features: &GxIndexSet, _target: &Target, _is_clobber: bool, ) -> Result<(), &'static str> { diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs index 643d5f804808a..5fde72cc27296 100644 --- a/compiler/rustc_trait_selection/src/solve/delegate.rs +++ b/compiler/rustc_trait_selection/src/solve/delegate.rs @@ -1,6 +1,6 @@ use std::ops::Deref; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_infer::infer::canonical::query_response::make_query_region_constraints; use rustc_infer::infer::canonical::{ @@ -305,7 +305,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate< assert_eq!(region_constraints.member_constraints, vec![]); - let mut seen = FxHashSet::default(); + let mut seen = GxHashSet::default(); region_constraints .outlives .into_iter() diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index 1d32ef2ccd94b..78230d16f8663 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -7,7 +7,7 @@ use crate::errors::UnableToConstructConstantValue; use crate::infer::region_constraints::{Constraint, RegionConstraintData}; use crate::traits::project::ProjectAndUnifyResult; -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet, IndexEntry}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet, IndexEntry}; use rustc_data_structures::unord::UnordSet; use rustc_infer::infer::DefineOpaqueTypes; use rustc_middle::mir::interpret::ErrorHandled; @@ -25,8 +25,8 @@ pub enum RegionTarget<'tcx> { #[derive(Default, Debug, Clone)] pub struct RegionDeps<'tcx> { - pub larger: FxIndexSet>, - pub smaller: FxIndexSet>, + pub larger: GxIndexSet>, + pub smaller: GxIndexSet>, } pub enum AutoTraitResult { @@ -38,7 +38,7 @@ pub enum AutoTraitResult { pub struct AutoTraitInfo<'cx> { pub full_user_env: ty::ParamEnv<'cx>, pub region_data: RegionConstraintData<'cx>, - pub vid_to_region: FxIndexMap>, + pub vid_to_region: GxIndexMap>, } pub struct AutoTraitFinder<'tcx> { @@ -100,7 +100,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { } let infcx = tcx.infer_ctxt().build(); - let mut fresh_preds = FxIndexSet::default(); + let mut fresh_preds = GxIndexSet::default(); // Due to the way projections are handled by SelectionContext, we need to run // evaluate_predicates twice: once on the original param env, and once on the result of @@ -222,7 +222,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { ty: Ty<'tcx>, param_env: ty::ParamEnv<'tcx>, user_env: ty::ParamEnv<'tcx>, - fresh_preds: &mut FxIndexSet>, + fresh_preds: &mut GxIndexSet>, ) -> Option<(ty::ParamEnv<'tcx>, ty::ParamEnv<'tcx>)> { let tcx = infcx.tcx; @@ -245,7 +245,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { })); let computed_preds = param_env.caller_bounds().iter().map(|c| c.as_predicate()); - let mut user_computed_preds: FxIndexSet<_> = + let mut user_computed_preds: GxIndexSet<_> = user_env.caller_bounds().iter().map(|c| c.as_predicate()).collect(); let mut new_env = param_env; @@ -365,7 +365,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { /// not just one specific lifetime (e.g., `'static`). fn add_user_pred( &self, - user_computed_preds: &mut FxIndexSet>, + user_computed_preds: &mut GxIndexSet>, new_pred: ty::Predicate<'tcx>, ) { let mut should_add_new = true; @@ -454,9 +454,9 @@ impl<'tcx> AutoTraitFinder<'tcx> { fn map_vid_to_region<'cx>( &self, regions: &RegionConstraintData<'cx>, - ) -> FxIndexMap> { - let mut vid_map = FxIndexMap::, RegionDeps<'cx>>::default(); - let mut finished_map = FxIndexMap::default(); + ) -> GxIndexMap> { + let mut vid_map = GxIndexMap::, RegionDeps<'cx>>::default(); + let mut finished_map = GxIndexMap::default(); for (constraint, _) in ®ions.constraints { match constraint { @@ -564,8 +564,8 @@ impl<'tcx> AutoTraitFinder<'tcx> { &self, ty: Ty<'_>, nested: impl Iterator>, - computed_preds: &mut FxIndexSet>, - fresh_preds: &mut FxIndexSet>, + computed_preds: &mut GxIndexSet>, + fresh_preds: &mut GxIndexSet>, predicates: &mut VecDeque>, selcx: &mut SelectionContext<'_, 'tcx>, ) -> bool { diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index a4177d8a93f47..6047897f338a3 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -13,7 +13,7 @@ use crate::traits::NormalizeExt; use crate::traits::SkipLeakCheck; use crate::traits::{util, FulfillmentErrorCode}; use crate::traits::{Obligation, ObligationCause, PredicateObligation, SelectionContext}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{Diag, EmissionGuarantee}; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; @@ -63,7 +63,7 @@ pub enum Conflict { pub struct OverlapResult<'tcx> { pub impl_header: ty::ImplHeader<'tcx>, - pub intercrate_ambiguity_causes: FxIndexSet>, + pub intercrate_ambiguity_causes: GxIndexSet>, /// `true` if the overlap might've been permitted before the shift /// to universes. @@ -1042,8 +1042,8 @@ where fn compute_intercrate_ambiguity_causes<'tcx>( infcx: &InferCtxt<'tcx>, obligations: &[PredicateObligation<'tcx>], -) -> FxIndexSet> { - let mut causes: FxIndexSet> = Default::default(); +) -> GxIndexSet> { + let mut causes: GxIndexSet> = Default::default(); for obligation in obligations { search_ambiguity_causes(infcx, obligation.clone().into(), &mut causes); @@ -1053,7 +1053,7 @@ fn compute_intercrate_ambiguity_causes<'tcx>( } struct AmbiguityCausesVisitor<'a, 'tcx> { - causes: &'a mut FxIndexSet>, + causes: &'a mut GxIndexSet>, } impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> { @@ -1188,7 +1188,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> { fn search_ambiguity_causes<'tcx>( infcx: &InferCtxt<'tcx>, goal: Goal<'tcx, ty::Predicate<'tcx>>, - causes: &mut FxIndexSet>, + causes: &mut GxIndexSet>, ) { infcx.probe(|_| infcx.visit_proof_tree(goal, &mut AmbiguityCausesVisitor { causes })); } diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs index 811f61d2bf37f..1b238d12a41ef 100644 --- a/compiler/rustc_trait_selection/src/traits/engine.rs +++ b/compiler/rustc_trait_selection/src/traits/engine.rs @@ -11,7 +11,7 @@ use crate::traits::fulfill::OldSolverError; use crate::traits::NormalizeExt; use crate::traits::StructurallyNormalizeExt; use crate::traits::{FulfillmentError, Obligation, ObligationCause, PredicateObligation}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_infer::infer::at::ToTrace; @@ -236,7 +236,7 @@ impl<'tcx> ObligationCtxt<'_, 'tcx, FulfillmentError<'tcx>> { &self, param_env: ty::ParamEnv<'tcx>, def_id: LocalDefId, - ) -> Result>, ErrorGuaranteed> { + ) -> Result>, ErrorGuaranteed> { self.assumed_wf_types(param_env, def_id) .map_err(|errors| self.infcx.err_ctxt().report_fulfillment_errors(errors)) } @@ -268,9 +268,9 @@ where &self, param_env: ty::ParamEnv<'tcx>, def_id: LocalDefId, - ) -> Result>, Vec> { + ) -> Result>, Vec> { let tcx = self.infcx.tcx; - let mut implied_bounds = FxIndexSet::default(); + let mut implied_bounds = GxIndexSet::default(); let mut errors = Vec::new(); for &(ty, span) in tcx.assumed_wf_types(def_id) { // FIXME(@lcnr): rustc currently does not check wf for types diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 32c8a454b40b5..d84da0ad985be 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -5,7 +5,7 @@ use rustc_ast::AttrArgsEq; use rustc_ast::AttrKind; use rustc_ast::{Attribute, MetaItem, NestedMetaItem}; use rustc_attr as attr; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -700,7 +700,7 @@ impl<'tcx> OnUnimplementedDirective { let mut append_const_msg = None; info!("evaluate({:?}, trait_ref={:?}, options={:?})", self, trait_ref, options); - let options_map: FxHashMap = + let options_map: GxHashMap = options.iter().filter_map(|(k, v)| v.clone().map(|v| (*k, v))).collect(); for command in self.subcommands.iter().chain(Some(self)).rev() { @@ -910,7 +910,7 @@ impl<'tcx> OnUnimplementedFormatString { &self, tcx: TyCtxt<'tcx>, trait_ref: ty::TraitRef<'tcx>, - options: &FxHashMap, + options: &GxHashMap, long_ty_file: &mut Option, ) -> String { let name = tcx.item_name(trait_ref.def_id); @@ -933,7 +933,7 @@ impl<'tcx> OnUnimplementedFormatString { let name = param.name; Some((name, value)) }) - .collect::>(); + .collect::>(); let empty_string = String::new(); let s = self.symbol.as_str(); diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index f4a026c0367f4..f131a01afa2c8 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -10,7 +10,7 @@ use crate::infer::InferCtxt; use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt}; use hir::def::CtorOf; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{ codes::*, pluralize, struct_span_code_err, Applicability, Diag, EmissionGuarantee, MultiSpan, @@ -2698,7 +2698,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { param_env: ty::ParamEnv<'tcx>, cause_code: &ObligationCauseCode<'tcx>, obligated_types: &mut Vec>, - seen_requirements: &mut FxHashSet, + seen_requirements: &mut GxHashSet, ) where T: Upcast, ty::Predicate<'tcx>>, { diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index d3096cf4b52ce..e13f53b1fdc05 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -19,7 +19,7 @@ use crate::traits::{ SelectionError, SignatureMismatch, TraitNotObjectSafe, }; use core::ops::ControlFlow; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_data_structures::unord::UnordSet; use rustc_errors::codes::*; use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan, StringPart}; @@ -98,7 +98,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { index: Option, // None if this is an old error } - let mut error_map: FxIndexMap<_, Vec<_>> = self + let mut error_map: GxIndexMap<_, Vec<_>> = self .reported_trait_errors .borrow() .iter() @@ -2836,7 +2836,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ) -> bool { struct ParamToVarFolder<'a, 'tcx> { infcx: &'a InferCtxt<'tcx>, - var_map: FxHashMap, Ty<'tcx>>, + var_map: GxHashMap, Ty<'tcx>>, } impl<'a, 'tcx> TypeFolder> for ParamToVarFolder<'a, 'tcx> { diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index baec2268629dc..f2fb23f2a3e4c 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -4,7 +4,7 @@ use crate::regions::InferCtxtRegionExt; use crate::traits::{self, FulfillmentError, ObligationCause}; use hir::LangItem; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir as hir; use rustc_infer::infer::outlives::env::OutlivesEnvironment; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; @@ -192,7 +192,7 @@ pub fn all_fields_implement_trait<'tcx>( infcx.implied_bounds_tys( param_env, parent_cause.body_id, - &FxIndexSet::from_iter([self_type]), + &GxIndexSet::from_iter([self_type]), ), ); let errors = infcx.resolve_regions(&outlives_env); diff --git a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs index 1dc2ebfaa7a30..19a3bcbbc0873 100644 --- a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs @@ -1,6 +1,6 @@ use crate::infer::InferCtxt; use crate::traits::{ObligationCause, ObligationCtxt}; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_infer::infer::resolve::OpportunisticRegionResolver; use rustc_infer::infer::InferOk; use rustc_macros::extension; @@ -119,7 +119,7 @@ impl<'a, 'tcx: 'a> InferCtxt<'tcx> { &'a self, param_env: ParamEnv<'tcx>, body_id: LocalDefId, - tys: &'a FxIndexSet>, + tys: &'a GxIndexSet>, compat: bool, ) -> BoundsCompat<'a, 'tcx> { tys.iter() @@ -132,7 +132,7 @@ impl<'a, 'tcx: 'a> InferCtxt<'tcx> { &'a self, param_env: ParamEnv<'tcx>, body_id: LocalDefId, - tys: &'a FxIndexSet>, + tys: &'a GxIndexSet>, ) -> Bounds<'a, 'tcx> { tys.iter().flat_map(move |ty| { implied_outlives_bounds( diff --git a/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs b/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs index 7dc051e6fe959..55bd6c5765ca4 100644 --- a/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs +++ b/compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs @@ -2,7 +2,7 @@ use crate::traits::query::normalize::QueryNormalizeExt; use crate::traits::query::NoSolution; use crate::traits::{Normalized, ObligationCause, ObligationCtxt}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_middle::traits::query::{DropckConstraint, DropckOutlivesResult}; use rustc_middle::ty::{self, EarlyBinder, ParamEnvAnd, Ty, TyCtxt}; use rustc_span::{Span, DUMMY_SP}; @@ -124,7 +124,7 @@ pub fn compute_dropck_outlives_inner<'tcx>( let mut ty_stack = vec![(for_ty, 0)]; // Set used to detect infinite recursion. - let mut ty_set = FxHashSet::default(); + let mut ty_set = GxHashSet::default(); let cause = ObligationCause::dummy(); let mut constraints = DropckConstraint::empty(); diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs index b38841db9233e..23db6f31240f6 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs @@ -87,7 +87,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>( // process it next. Because the resulting predicates aren't always // guaranteed to be a subset of the original type, so we need to store the // WF args we've computed in a set. - let mut checked_wf_args = rustc_data_structures::fx::FxHashSet::default(); + let mut checked_wf_args = rustc_data_structures::gx::GxHashSet::default(); let mut wf_args = vec![ty.into(), normalize_op(ty)?.into()]; let mut outlives_bounds: Vec> = vec![]; @@ -158,7 +158,7 @@ pub fn compute_implied_outlives_bounds_compat_inner<'tcx>( // process it next. Because the resulting predicates aren't always // guaranteed to be a subset of the original type, so we need to store the // WF args we've computed in a set. - let mut checked_wf_args = rustc_data_structures::fx::FxHashSet::default(); + let mut checked_wf_args = rustc_data_structures::gx::GxHashSet::default(); let mut wf_args = vec![ty.into()]; let mut outlives_bounds: Vec>> = vec![]; diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index e36a9ca8bd1c2..5658a80e9c05d 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -10,7 +10,7 @@ use std::ops::ControlFlow; use hir::def_id::DefId; use hir::LangItem; -use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexSet}; use rustc_hir as hir; use rustc_infer::traits::ObligationCause; use rustc_infer::traits::{Obligation, PolyTraitObligation, SelectionError}; @@ -183,7 +183,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // The bounds returned by `item_bounds` may contain duplicates after // normalization, so try to deduplicate when possible to avoid // unnecessary ambiguity. - let mut distinct_normalized_bounds = FxHashSet::default(); + let mut distinct_normalized_bounds = GxHashSet::default(); self.for_each_item_bound::( placeholder_trait_predicate.self_ty(), |selcx, bound, idx| { @@ -1002,7 +1002,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // We may upcast to auto traits that are either explicitly listed in // the object type's bounds, or implied by the principal trait ref's // supertraits. - let a_auto_traits: FxIndexSet = a_data + let a_auto_traits: GxIndexSet = a_data .auto_traits() .chain(principal_def_id_a.into_iter().flat_map(|principal_def_id| { self.tcx() diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 68cc04bc8e63d..97ecc6ebc9022 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -27,7 +27,7 @@ use crate::traits::project::ProjectAndUnifyResult; use crate::traits::project::ProjectionCacheKeyExt; use crate::traits::ProjectionCacheKey; use crate::traits::Unimplemented; -use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap, GxIndexSet}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::{Diag, EmissionGuarantee}; use rustc_hir as hir; @@ -138,7 +138,7 @@ pub struct SelectionContext<'cx, 'tcx> { /// We don't do his until we detect a coherence error because it can /// lead to false overflow results (#47139) and because always /// computing it may negatively impact performance. - intercrate_ambiguity_causes: Option>>, + intercrate_ambiguity_causes: Option>>, /// The mode that trait queries run in, which informs our error handling /// policy. In essence, canonicalized queries need their errors propagated @@ -247,7 +247,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { pub fn enable_tracking_intercrate_ambiguity_causes(&mut self) { assert!(self.is_intercrate()); assert!(self.intercrate_ambiguity_causes.is_none()); - self.intercrate_ambiguity_causes = Some(FxIndexSet::default()); + self.intercrate_ambiguity_causes = Some(GxIndexSet::default()); debug!("selcx: enable_tracking_intercrate_ambiguity_causes"); } @@ -256,7 +256,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { /// tracking is not enabled, just returns an empty vector. pub fn take_intercrate_ambiguity_causes( &mut self, - ) -> FxIndexSet> { + ) -> GxIndexSet> { assert!(self.is_intercrate()); self.intercrate_ambiguity_causes.take().unwrap_or_default() } @@ -2593,7 +2593,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> { // We may upcast to auto traits that are either explicitly listed in // the object type's bounds, or implied by the principal trait ref's // supertraits. - let a_auto_traits: FxIndexSet = a_data + let a_auto_traits: GxIndexSet = a_data .auto_traits() .chain(a_data.principal_def_id().into_iter().flat_map(|principal_def_id| { tcx.supertrait_def_ids(principal_def_id).filter(|def_id| tcx.trait_is_auto(*def_id)) @@ -2938,7 +2938,7 @@ struct ProvisionalEvaluationCache<'tcx> { /// - then we determine that `E` is in error -- we will then clear /// all cache values whose DFN is >= 4 -- in this case, that /// means the cached value for `F`. - map: RefCell, ProvisionalEvaluation>>, + map: RefCell, ProvisionalEvaluation>>, /// The stack of args that we assume to be true because a `WF(arg)` predicate /// is on the stack above (and because of wellformedness is coinductive). @@ -3154,7 +3154,7 @@ fn bind_coroutine_hidden_types_above<'tcx>( bound_vars: &ty::List, ) -> ty::Binder<'tcx, Vec>> { let tcx = infcx.tcx; - let mut seen_tys = FxHashSet::default(); + let mut seen_tys = GxHashSet::default(); let considering_regions = infcx.considering_regions; diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index c9bb0d330e1fd..182ddee8ad5df 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -20,7 +20,7 @@ use crate::traits::select::IntercrateAmbiguityCause; use crate::traits::{ self, coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt, }; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_errors::{codes::*, Diag, EmissionGuarantee}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::bug; @@ -40,7 +40,7 @@ pub struct OverlapError<'tcx> { pub with_impl: DefId, pub trait_ref: ty::TraitRef<'tcx>, pub self_ty: Option>, - pub intercrate_ambiguity_causes: FxIndexSet>, + pub intercrate_ambiguity_causes: GxIndexSet>, pub involves_placeholder: bool, pub overflowing_predicates: Vec>, } @@ -498,7 +498,7 @@ pub(crate) fn to_pretty_impl_header(tcx: TyCtxt<'_>, impl_def_id: DefId) -> Opti // FIXME: Currently only handles ?Sized. // Needs to support ?Move and ?DynSized when they are implemented. - let mut types_without_default_bounds = FxIndexSet::default(); + let mut types_without_default_bounds = GxIndexSet::default(); let sized_trait = tcx.lang_items().sized_trait(); let arg_names = args.iter().map(|k| k.to_string()).filter(|k| k != "'_").collect::>(); diff --git a/compiler/rustc_trait_selection/src/traits/structural_match.rs b/compiler/rustc_trait_selection/src/traits/structural_match.rs index d4535db951e25..9a1cbe8d9d8c8 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_match.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_match.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_middle::bug; use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor}; @@ -33,7 +33,7 @@ pub fn search_for_structural_match_violation<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, ) -> Option> { - ty.visit_with(&mut Search { tcx, seen: FxHashSet::default() }).break_value() + ty.visit_with(&mut Search { tcx, seen: GxHashSet::default() }).break_value() } /// This implements the traversal over the structure of a given type to try to @@ -44,7 +44,7 @@ struct Search<'tcx> { /// Tracks ADTs previously encountered during search, so that /// we will not recur on them again. - seen: FxHashSet, + seen: GxHashSet, } impl<'tcx> Search<'tcx> { diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index f132e36468ac2..e1e9cd319f46c 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use super::NormalizeExt; use super::{ObligationCause, PredicateObligation, SelectionContext}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::Diag; use rustc_hir::def_id::DefId; use rustc_infer::infer::{InferCtxt, InferOk}; @@ -336,8 +336,8 @@ pub struct BoundVarReplacer<'me, 'tcx> { // These three maps track the bound variable that were replaced by placeholders. It might be // nice to remove these since we already have the `kind` in the placeholder; we really just need // the `var` (but we *could* bring that into scope if we were to track them as we pass them). - mapped_regions: FxIndexMap, - mapped_types: FxIndexMap, + mapped_regions: GxIndexMap, + mapped_types: GxIndexMap, mapped_consts: BTreeMap, // The current depth relative to *this* folding, *not* the entire normalization. In other words, // the depth of binders we've passed here. @@ -356,13 +356,13 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> { value: T, ) -> ( T, - FxIndexMap, - FxIndexMap, + GxIndexMap, + GxIndexMap, BTreeMap, ) { - let mapped_regions: FxIndexMap = - FxIndexMap::default(); - let mapped_types: FxIndexMap = FxIndexMap::default(); + let mapped_regions: GxIndexMap = + GxIndexMap::default(); + let mapped_types: GxIndexMap = GxIndexMap::default(); let mapped_consts: BTreeMap = BTreeMap::new(); let mut replacer = BoundVarReplacer { @@ -480,8 +480,8 @@ impl<'tcx> TypeFolder> for BoundVarReplacer<'_, 'tcx> { /// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came. pub struct PlaceholderReplacer<'me, 'tcx> { infcx: &'me InferCtxt<'tcx>, - mapped_regions: FxIndexMap, - mapped_types: FxIndexMap, + mapped_regions: GxIndexMap, + mapped_types: GxIndexMap, mapped_consts: BTreeMap, universe_indices: &'me [Option], current_index: ty::DebruijnIndex, @@ -490,8 +490,8 @@ pub struct PlaceholderReplacer<'me, 'tcx> { impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> { pub fn replace_placeholders>>( infcx: &'me InferCtxt<'tcx>, - mapped_regions: FxIndexMap, - mapped_types: FxIndexMap, + mapped_regions: GxIndexMap, + mapped_types: GxIndexMap, mapped_consts: BTreeMap, universe_indices: &'me [Option], value: T, diff --git a/compiler/rustc_traits/src/dropck_outlives.rs b/compiler/rustc_traits/src/dropck_outlives.rs index 55abd6098ec97..87e87970efb5c 100644 --- a/compiler/rustc_traits/src/dropck_outlives.rs +++ b/compiler/rustc_traits/src/dropck_outlives.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::DefId; use rustc_infer::infer::canonical::{Canonical, QueryResponse}; use rustc_infer::infer::TyCtxtInferExt; @@ -69,8 +69,8 @@ pub(crate) fn adt_dtorck_constraint( } fn dedup_dtorck_constraint(c: &mut DropckConstraint<'_>) { - let mut outlives = FxHashSet::default(); - let mut dtorck_types = FxHashSet::default(); + let mut outlives = GxHashSet::default(); + let mut dtorck_types = GxHashSet::default(); c.outlives.retain(|&val| outlives.replace(val).is_none()); c.dtorck_types.retain(|&val| dtorck_types.replace(val).is_none()); diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs index 2b052412e6b61..3e51c6798df58 100644 --- a/compiler/rustc_transmute/src/lib.rs +++ b/compiler/rustc_transmute/src/lib.rs @@ -4,7 +4,7 @@ #![feature(never_type)] // tidy-alphabetical-end -pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set}; +pub(crate) use rustc_data_structures::gx::{GxIndexMap as Map, GxIndexSet as Set}; pub mod layout; mod maybe_transmutable; diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index 4395eb57cd6d2..0a373a15e263d 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::gx::GxIndexSet; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId}; @@ -183,7 +183,7 @@ fn associated_types_for_impl_traits_in_associated_fn( match tcx.def_kind(parent_def_id) { DefKind::Trait => { struct RPITVisitor<'tcx> { - rpits: FxIndexSet, + rpits: GxIndexSet, tcx: TyCtxt<'tcx>, } @@ -202,7 +202,7 @@ fn associated_types_for_impl_traits_in_associated_fn( } } - let mut visitor = RPITVisitor { tcx, rpits: FxIndexSet::default() }; + let mut visitor = RPITVisitor { tcx, rpits: GxIndexSet::default() }; if let Some(output) = tcx.hir().get_fn_output(fn_def_id) { visitor.visit_fn_ret_ty(output); diff --git a/compiler/rustc_ty_utils/src/implied_bounds.rs b/compiler/rustc_ty_utils/src/implied_bounds.rs index 6f71951b51629..e8c9fe2acb391 100644 --- a/compiler/rustc_ty_utils/src/implied_bounds.rs +++ b/compiler/rustc_ty_utils/src/implied_bounds.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::LocalDefId; @@ -63,7 +63,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<' // Side-note: We don't really need to do this remapping for early-bound // lifetimes because they're already "linked" by the bidirectional outlives // predicates we insert in the `explicit_predicates_of` query for RPITITs. - let mut mapping = FxHashMap::default(); + let mut mapping = GxHashMap::default(); let generics = tcx.generics_of(def_id); // For each captured opaque lifetime, if it's late-bound (`ReLateParam` in this diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs index 205b3f2760f36..93ea66c5e6aaa 100644 --- a/compiler/rustc_ty_utils/src/needs_drop.rs +++ b/compiler/rustc_ty_utils/src/needs_drop.rs @@ -1,6 +1,6 @@ //! Check whether a type has (potentially) non-trivial drop glue. -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::DefId; use rustc_middle::bug; use rustc_middle::query::Providers; @@ -87,7 +87,7 @@ struct NeedsDropTypes<'tcx, F> { // to `false` unless we compute `needs_drop` for a coroutine witness. reveal_coroutine_witnesses: bool, query_ty: Ty<'tcx>, - seen_tys: FxHashSet>, + seen_tys: GxHashSet>, /// A stack of types left to process, and the recursion depth when we /// pushed that type. Each round, we pop something from the stack and check /// if it needs drop. If the result depends on whether some other types @@ -104,7 +104,7 @@ impl<'tcx, F> NeedsDropTypes<'tcx, F> { ty: Ty<'tcx>, adt_components: F, ) -> Self { - let mut seen_tys = FxHashSet::default(); + let mut seen_tys = GxHashSet::default(); seen_tys.insert(ty); Self { tcx, diff --git a/compiler/rustc_ty_utils/src/opaque_types.rs b/compiler/rustc_ty_utils/src/opaque_types.rs index 686f2f04ad9a7..a01633c34eb1a 100644 --- a/compiler/rustc_ty_utils/src/opaque_types.rs +++ b/compiler/rustc_ty_utils/src/opaque_types.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::intravisit::Visitor; use rustc_hir::{def::DefKind, def_id::LocalDefId}; use rustc_hir::{intravisit, CRATE_HIR_ID}; @@ -19,7 +19,7 @@ struct OpaqueTypeCollector<'tcx> { item: LocalDefId, /// Avoid infinite recursion due to recursive declarations. - seen: FxHashSet, + seen: GxHashSet, span: Option, diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index 38950c97c9d58..c5e3a71c0b9f5 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::LangItem; @@ -143,7 +143,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { fn_def_id: def_id, bound_vars: sig.bound_vars(), predicates: &mut predicates, - seen: FxHashSet::default(), + seen: GxHashSet::default(), depth: ty::INNERMOST, }); } @@ -167,7 +167,7 @@ struct ImplTraitInTraitFinder<'a, 'tcx> { predicates: &'a mut Vec>, fn_def_id: DefId, bound_vars: &'tcx ty::List, - seen: FxHashSet, + seen: GxHashSet, depth: ty::DebruijnIndex, } diff --git a/compiler/rustc_type_ir/src/codec.rs b/compiler/rustc_type_ir/src/codec.rs index 71f9eb0ef8a82..b616f59519e63 100644 --- a/compiler/rustc_type_ir/src/codec.rs +++ b/compiler/rustc_type_ir/src/codec.rs @@ -1,6 +1,6 @@ use crate::{Interner, PredicateKind}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_span::{SpanDecoder, SpanEncoder}; /// The shorthand encoding uses an enum's variant index `usize` @@ -11,7 +11,7 @@ pub const SHORTHAND_OFFSET: usize = 0x80; /// Trait for decoding to a reference. /// /// This is a separate trait from `Decodable` so that we can implement it for -/// upstream types, such as `FxHashSet`. +/// upstream types, such as `GxHashSet`. /// /// The `TyDecodable` derive macro will use this trait for fields that are /// references (and don't use a type alias to hide that). @@ -28,9 +28,9 @@ pub trait TyEncoder: SpanEncoder { fn position(&self) -> usize; - fn type_shorthands(&mut self) -> &mut FxHashMap<::Ty, usize>; + fn type_shorthands(&mut self) -> &mut GxHashMap<::Ty, usize>; - fn predicate_shorthands(&mut self) -> &mut FxHashMap, usize>; + fn predicate_shorthands(&mut self) -> &mut GxHashMap, usize>; fn encode_alloc_id(&mut self, alloc_id: &::AllocId); } diff --git a/compiler/rustc_type_ir/src/data_structures.rs b/compiler/rustc_type_ir/src/data_structures.rs index 6d8ab61b722fd..c859813709222 100644 --- a/compiler/rustc_type_ir/src/data_structures.rs +++ b/compiler/rustc_type_ir/src/data_structures.rs @@ -1,9 +1,9 @@ #[cfg(feature = "nightly")] mod impl_ { - pub use rustc_data_structures::fx::FxHashMap as HashMap; - pub use rustc_data_structures::fx::FxHashSet as HashSet; - pub use rustc_data_structures::fx::FxIndexMap as IndexMap; - pub use rustc_data_structures::fx::FxIndexSet as IndexSet; + pub use rustc_data_structures::gx::GxHashMap as HashMap; + pub use rustc_data_structures::gx::GxHashSet as HashSet; + pub use rustc_data_structures::gx::GxIndexMap as IndexMap; + pub use rustc_data_structures::gx::GxIndexSet as IndexSet; pub use rustc_data_structures::sso::SsoHashMap; pub use rustc_data_structures::sso::SsoHashSet; pub use rustc_data_structures::stack::ensure_sufficient_stack; diff --git a/meowcheck b/meowcheck new file mode 100644 index 0000000000000..7dda3d018963e --- /dev/null +++ b/meowcheck @@ -0,0 +1,16 @@ +WARNING: you have not made a `config.toml` +HELP: consider running `./x.py setup` or copying `config.example.toml` by running `cp config.example.toml config.toml` +Checking stage0 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-unknown-linux-gnu) +Checking stage0 library test/bench/example targets (x86_64-unknown-linux-gnu) +Checking stage0 library artifacts (x86_64-unknown-linux-gnu) +Checking stage0 compiler artifacts {rustc-main, rustc_abi, rustc_arena, rustc_ast, rustc_ast_ir, rustc_ast_lowering, rustc_ast_passes, rustc_ast_pretty, rustc_attr, rustc_baked_icu_data, rustc_borrowck, rustc_builtin_macros, rustc_codegen_llvm, rustc_codegen_ssa, rustc_const_eval, rustc_data_structures, rustc_driver, rustc_driver_impl, rustc_error_codes, rustc_error_messages, rustc_errors, rustc_expand, rustc_feature, rustc_fluent_macro, rustc_fs_util, rustc_graphviz, rustc_hir, rustc_hir_analysis, rustc_hir_pretty, rustc_hir_typeck, rustc_incremental, rustc_index, rustc_index_macros, rustc_infer, rustc_interface, rustc_lexer, rustc_lint, rustc_lint_defs, rustc_llvm, rustc_log, rustc_macros, rustc_metadata, rustc_middle, rustc_mir_build, rustc_mir_dataflow, rustc_mir_transform, rustc_monomorphize, rustc_next_trait_solver, rustc_parse, rustc_parse_format, rustc_passes, rustc_pattern_analysis, rustc_privacy, rustc_query_impl, rustc_query_system, rustc_resolve, rustc_sanitizers, rustc_serialize, rustc_session, rustc_smir, rustc_span, rustc_symbol_mangling, rustc_target, rustc_trait_selection, rustc_traits, rustc_transmute, rustc_ty_utils, rustc_type_ir, rustc_type_ir_macros, stable_mir} (x86_64-unknown-linux-gnu) +Checking stage0 rustdoc artifacts (x86_64-unknown-linux-gnu) +Checking stage0 cranelift (x86_64-unknown-linux-gnu) +Checking stage0 gcc (x86_64-unknown-linux-gnu) +Checking stage0 clippy artifacts (x86_64-unknown-linux-gnu) +Checking stage0 miri artifacts (x86_64-unknown-linux-gnu) +Checking stage0 cargomiri artifacts (x86_64-unknown-linux-gnu) +Checking stage0 miropttesttools artifacts (x86_64-unknown-linux-gnu) +Checking stage0 rls artifacts (x86_64-unknown-linux-gnu) +Checking stage0 rustfmt artifacts (x86_64-unknown-linux-gnu) +Checking stage0 rust-analyzer artifacts (x86_64-unknown-linux-gnu) diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index ac927e9a19426..f0f5b42beb8d6 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxIndexMap, FxIndexSet, IndexEntry}; +use rustc_data_structures::gx::{GxIndexMap, GxIndexSet, IndexEntry}; use rustc_hir as hir; use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData}; use rustc_middle::bug; @@ -144,7 +144,7 @@ fn clean_param_env<'tcx>( item_def_id: DefId, param_env: ty::ParamEnv<'tcx>, region_data: RegionConstraintData<'tcx>, - vid_to_region: FxIndexMap>, + vid_to_region: GxIndexMap>, ) -> clean::Generics { let tcx = cx.tcx; let generics = tcx.generics_of(item_def_id); @@ -167,7 +167,7 @@ fn clean_param_env<'tcx>( .collect(); // FIXME(#111101): Incorporate the explicit predicates of the item here... - let item_predicates: FxIndexSet<_> = + let item_predicates: GxIndexSet<_> = tcx.param_env(item_def_id).caller_bounds().iter().collect(); let where_predicates = param_env .caller_bounds() @@ -224,8 +224,8 @@ fn clean_region_outlives_constraints<'tcx>( // between `Region`s. This gives us the information we need to create the where-predicates. // This flattening is done in two parts. - let mut outlives_predicates = FxIndexMap::<_, Vec<_>>::default(); - let mut map = FxIndexMap::, auto_trait::RegionDeps<'_>>::default(); + let mut outlives_predicates = GxIndexMap::<_, Vec<_>>::default(); + let mut map = GxIndexMap::, auto_trait::RegionDeps<'_>>::default(); // (1) We insert all of the constraints into a map. // Each `RegionTarget` (a `RegionVid` or a `Region`) maps to its smaller and larger regions. @@ -325,7 +325,7 @@ fn clean_region_outlives_constraints<'tcx>( } } - let region_params: FxIndexSet<_> = generics + let region_params: GxIndexSet<_> = generics .own_params .iter() .filter_map(|param| match param.kind { @@ -337,7 +337,7 @@ fn clean_region_outlives_constraints<'tcx>( region_params .iter() .filter_map(|&name| { - let bounds: FxIndexSet<_> = outlives_predicates + let bounds: GxIndexSet<_> = outlives_predicates .get(&name)? .iter() .map(|®ion| { diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 2814e83dcd757..c1ce67eb406a7 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -8,7 +8,7 @@ use std::mem; use std::ops; use rustc_ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem}; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_feature::Features; use rustc_session::parse::ParseSess; use rustc_span::symbol::{sym, Symbol}; @@ -46,7 +46,7 @@ impl Cfg { /// Parses a `NestedMetaItem` into a `Cfg`. fn parse_nested( nested_cfg: &NestedMetaItem, - exclude: &FxHashSet, + exclude: &GxHashSet, ) -> Result, InvalidCfgError> { match nested_cfg { NestedMetaItem::MetaItem(ref cfg) => Cfg::parse_without(cfg, exclude), @@ -58,7 +58,7 @@ impl Cfg { pub(crate) fn parse_without( cfg: &MetaItem, - exclude: &FxHashSet, + exclude: &GxHashSet, ) -> Result, InvalidCfgError> { let name = match cfg.ident() { Some(ident) => ident.name, @@ -123,7 +123,7 @@ impl Cfg { /// If the content is not properly formatted, it will return an error indicating what and where /// the error is. pub(crate) fn parse(cfg: &MetaItem) -> Result { - Self::parse_without(cfg, &FxHashSet::default()).map(|ret| ret.unwrap()) + Self::parse_without(cfg, &GxHashSet::default()).map(|ret| ret.unwrap()) } /// Checks whether the given configuration can be matched in the current session. diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 0024e246ef007..8eaee94199a0b 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use thin_vec::{thin_vec, ThinVec}; use rustc_ast as ast; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, DefIdSet, LocalModDefId}; @@ -173,7 +173,7 @@ pub(crate) fn try_inline_glob( res: Res, current_mod: LocalModDefId, visited: &mut DefIdSet, - inlined_names: &mut FxHashSet<(ItemType, Symbol)>, + inlined_names: &mut GxHashSet<(ItemType, Symbol)>, import: &hir::Item<'_>, ) -> Option> { let did = res.opt_def_id()?; @@ -634,7 +634,7 @@ pub(crate) fn build_impl( } fn build_module(cx: &mut DocContext<'_>, did: DefId, visited: &mut DefIdSet) -> clean::Module { - let items = build_module_items(cx, did, visited, &mut FxHashSet::default(), None, None); + let items = build_module_items(cx, did, visited, &mut GxHashSet::default(), None, None); let span = clean::Span::new(cx.tcx.def_span(did)); clean::Module { items, span } @@ -644,7 +644,7 @@ fn build_module_items( cx: &mut DocContext<'_>, did: DefId, visited: &mut DefIdSet, - inlined_names: &mut FxHashSet<(ItemType, Symbol)>, + inlined_names: &mut GxHashSet<(ItemType, Symbol)>, allowed_def_ids: Option<&DefIdSet>, attrs: Option<(&[ast::Attribute], Option)>, ) -> Vec { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 22565ea402803..f845cc25db0bc 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -34,7 +34,7 @@ use rustc_ast as ast; use rustc_ast::token::{Token, TokenKind}; use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_attr as attr; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet, IndexEntry}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexMap, GxIndexSet, IndexEntry}; use rustc_errors::{codes::*, struct_span_code_err, FatalError}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Res}; @@ -68,7 +68,7 @@ pub(crate) use self::utils::{krate, register_res, synthesize_auto_trait_and_blan pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<'tcx>) -> Item { let mut items: Vec = vec![]; - let mut inserted = FxHashSet::default(); + let mut inserted = GxHashSet::default(); items.extend(doc.foreigns.iter().map(|(item, renamed)| { let item = clean_maybe_renamed_foreign_item(cx, item, *renamed); if let Some(name) = item.name @@ -683,8 +683,8 @@ pub(crate) fn clean_generics<'tcx>( }) .collect::>(); - let mut bound_predicates = FxIndexMap::default(); - let mut region_predicates = FxIndexMap::default(); + let mut bound_predicates = GxIndexMap::default(); + let mut region_predicates = GxIndexMap::default(); let mut eq_predicates = ThinVec::default(); for pred in gens.predicates.iter().filter_map(|x| clean_where_predicate(x, cx)) { match pred { @@ -816,7 +816,7 @@ fn clean_ty_generics<'tcx>( // param index -> [(trait DefId, associated type name & generics, term)] let mut impl_trait_proj = - FxHashMap::>)>>::default(); + GxHashMap::>)>>::default(); let where_predicates = preds .predicates @@ -2146,7 +2146,7 @@ pub(crate) fn clean_middle_ty<'tcx>( }) .collect(); - let late_bound_regions: FxIndexSet<_> = obj + let late_bound_regions: GxIndexSet<_> = obj .iter() .flat_map(|pred| pred.bound_vars()) .filter_map(|var| match var { @@ -2815,7 +2815,7 @@ fn clean_maybe_renamed_item<'tcx>( return clean_extern_crate(item, name, orig_name, cx); } ItemKind::Use(path, kind) => { - return clean_use_statement(item, name, path, kind, cx, &mut FxHashSet::default()); + return clean_use_statement(item, name, path, kind, cx, &mut GxHashSet::default()); } _ => unreachable!("not yet converted"), }; @@ -2939,7 +2939,7 @@ fn clean_use_statement<'tcx>( path: &hir::UsePath<'tcx>, kind: hir::UseKind, cx: &mut DocContext<'tcx>, - inlined_names: &mut FxHashSet<(ItemType, Symbol)>, + inlined_names: &mut GxHashSet<(ItemType, Symbol)>, ) -> Vec { let mut items = Vec::new(); let hir::UsePath { segments, ref res, span } = *path; @@ -2956,7 +2956,7 @@ fn clean_use_statement_inner<'tcx>( path: &hir::Path<'tcx>, kind: hir::UseKind, cx: &mut DocContext<'tcx>, - inlined_names: &mut FxHashSet<(ItemType, Symbol)>, + inlined_names: &mut GxHashSet<(ItemType, Symbol)>, ) -> Vec { if should_ignore_res(path.res) { return Vec::new(); diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index af61eb6ae8de8..dddab068bd2a1 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -11,7 +11,7 @@ //! This module attempts to reconstruct the original where and/or parameter //! bounds by special casing scenarios such as these. Fun! -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_data_structures::unord::UnordSet; use rustc_hir::def_id::DefId; use rustc_middle::ty; @@ -25,9 +25,9 @@ use crate::core::DocContext; pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: ThinVec) -> ThinVec { // First, partition the where clause into its separate components. // - // We use `FxIndexMap` so that the insertion order is preserved to prevent messing up to + // We use `GxIndexMap` so that the insertion order is preserved to prevent messing up to // the order of the generated bounds. - let mut tybounds = FxIndexMap::default(); + let mut tybounds = GxIndexMap::default(); let mut lifetimes = Vec::new(); let mut equalities = Vec::new(); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index c4020f2a450bc..628533201236c 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -14,7 +14,7 @@ use rustc_ast as ast; use rustc_ast_pretty::pprust; use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel, StableSince}; use rustc_const_eval::const_eval::is_unstable_const_fn; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -56,7 +56,7 @@ pub(crate) use self::Type::{ #[cfg(test)] mod tests; -pub(crate) type ItemIdSet = FxHashSet; +pub(crate) type ItemIdSet = GxHashSet; #[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)] pub(crate) enum ItemId { @@ -114,7 +114,7 @@ impl From for ItemId { pub(crate) struct Crate { pub(crate) module: Item, /// Only here so that they can be filtered through the rustdoc passes. - pub(crate) external_traits: Rc>>, + pub(crate) external_traits: Rc>>, } impl Crate { @@ -952,7 +952,7 @@ pub(crate) trait AttributesExt { fn iter<'a>(&'a self) -> Self::Attributes<'a>; - fn cfg(&self, tcx: TyCtxt<'_>, hidden_cfg: &FxHashSet) -> Option> { + fn cfg(&self, tcx: TyCtxt<'_>, hidden_cfg: &GxHashSet) -> Option> { let sess = tcx.sess; let doc_cfg_active = tcx.features().doc_cfg; let doc_auto_cfg_active = tcx.features().doc_auto_cfg; @@ -1207,7 +1207,7 @@ impl Attributes { } pub(crate) fn get_doc_aliases(&self) -> Box<[Symbol]> { - let mut aliases = FxHashSet::default(); + let mut aliases = GxHashSet::default(); for attr in self.other_attrs.lists(sym::doc).filter(|a| a.has_name(sym::alias)) { if let Some(values) = attr.meta_item_list() { @@ -1762,7 +1762,7 @@ pub(crate) enum PrimitiveType { Never, } -type SimplifiedTypes = FxHashMap>; +type SimplifiedTypes = GxHashMap>; impl PrimitiveType { pub(crate) fn from_hir(prim: hir::PrimTy) -> PrimitiveType { use ast::{FloatTy, IntTy, UintTy}; @@ -1930,10 +1930,10 @@ impl PrimitiveType { /// In particular, if a crate depends on both `std` and another crate that also defines /// `rustc_doc_primitive`, then it's entirely random whether `std` or the other crate is picked. /// (no_std crates are usually fine unless multiple dependencies define a primitive.) - pub(crate) fn primitive_locations(tcx: TyCtxt<'_>) -> &FxHashMap { - static PRIMITIVE_LOCATIONS: OnceCell> = OnceCell::new(); + pub(crate) fn primitive_locations(tcx: TyCtxt<'_>) -> &GxHashMap { + static PRIMITIVE_LOCATIONS: OnceCell> = OnceCell::new(); PRIMITIVE_LOCATIONS.get_or_init(|| { - let mut primitive_locations = FxHashMap::default(); + let mut primitive_locations = GxHashMap::default(); // NOTE: technically this misses crates that are only passed with `--extern` and not loaded when checking the crate. // This is a degenerate case that I don't plan to support. for &crate_num in tcx.crates(()) { @@ -2459,7 +2459,7 @@ pub(crate) struct Impl { } impl Impl { - pub(crate) fn provided_trait_methods(&self, tcx: TyCtxt<'_>) -> FxHashSet { + pub(crate) fn provided_trait_methods(&self, tcx: TyCtxt<'_>) -> GxHashSet { self.trait_ .as_ref() .map(|t| t.def_id()) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 45bd1616e83cd..082fc2ce6df9d 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -7,7 +7,7 @@ use std::path::Path; use std::path::PathBuf; use std::str::FromStr; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::DiagCtxtHandle; use rustc_session::config::{ self, parse_crate_types_from_list, parse_externs, parse_target_triple, CrateType, @@ -250,7 +250,7 @@ pub(crate) struct RenderOptions { pub(crate) extern_html_root_takes_precedence: bool, /// A map of the default settings (values are as for DOM storage API). Keys should lack the /// `rustdoc-` prefix. - pub(crate) default_settings: FxHashMap, + pub(crate) default_settings: GxHashMap, /// If present, suffix added to CSS/JavaScript files when referencing them in generated pages. pub(crate) resource_suffix: String, /// Whether to create an index page in the root of the output directory. If this is true but diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 5d8e61f9fa0d4..51c75d97e04db 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unord::UnordSet; use rustc_errors::emitter::{stderr_destination, DynEmitter, HumanEmitter}; @@ -41,7 +41,7 @@ pub(crate) struct DocContext<'tcx> { /// Most of this logic is copied from rustc_lint::late. pub(crate) param_env: ParamEnv<'tcx>, /// Later on moved through `clean::Crate` into `cache` - pub(crate) external_traits: Rc>>, + pub(crate) external_traits: Rc>>, /// Used while populating `external_traits` to ensure we don't process the same trait twice at /// the same time. pub(crate) active_extern_traits: DefIdSet, @@ -54,17 +54,17 @@ pub(crate) struct DocContext<'tcx> { pub(crate) args: DefIdMap, pub(crate) current_type_aliases: DefIdMap, /// Table synthetic type parameter for `impl Trait` in argument position -> bounds - pub(crate) impl_trait_bounds: FxHashMap>, + pub(crate) impl_trait_bounds: GxHashMap>, /// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`. // FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set. - pub(crate) generated_synthetics: FxHashSet<(Ty<'tcx>, DefId)>, + pub(crate) generated_synthetics: GxHashSet<(Ty<'tcx>, DefId)>, pub(crate) auto_traits: Vec, /// The options given to rustdoc that could be relevant to a pass. pub(crate) render_options: RenderOptions, /// This same cache is used throughout rustdoc, including in [`crate::html::render`]. pub(crate) cache: Cache, /// Used by [`clean::inline`] to tell if an item has already been inlined. - pub(crate) inlined: FxHashSet, + pub(crate) inlined: GxHashSet, /// Used by `calculate_doc_coverage`. pub(crate) output_format: OutputFormat, /// Used by `strip_private`. @@ -341,7 +341,7 @@ pub(crate) fn run_global_ctxt( generated_synthetics: Default::default(), auto_traits, cache: Cache::new(render_options.document_private, render_options.document_hidden), - inlined: FxHashSet::default(), + inlined: GxHashSet::default(), output_format, render_options, show_coverage, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 40cc4a9d44122..6d9800251b4eb 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -6,7 +6,7 @@ pub(crate) use make::make_test; pub(crate) use markdown::test as test_markdown; use rustc_ast as ast; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_errors::{ColorConfig, DiagCtxtHandle, ErrorGuaranteed, FatalError}; use rustc_hir::def_id::LOCAL_CRATE; use rustc_hir::CRATE_HIR_ID; @@ -208,12 +208,12 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, options: RustdocOptions) -> Result<() let unused_extern_reports: Vec<_> = std::mem::take(&mut unused_extern_reports.lock().unwrap()); if unused_extern_reports.len() == compiling_test_count { - let extern_names = externs.iter().map(|(name, _)| name).collect::>(); + let extern_names = externs.iter().map(|(name, _)| name).collect::>(); let mut unused_extern_names = unused_extern_reports .iter() - .map(|uexts| uexts.unused_extern_names.iter().collect::>()) + .map(|uexts| uexts.unused_extern_names.iter().collect::>()) .fold(extern_names, |uextsa, uextsb| { - uextsa.intersection(&uextsb).copied().collect::>() + uextsa.intersection(&uextsb).copied().collect::>() }) .iter() .map(|v| (*v).clone()) @@ -625,7 +625,7 @@ struct CreateRunnableDoctests { rustdoc_options: Arc, opts: GlobalTestOptions, - visited_tests: FxHashMap<(String, usize), usize>, + visited_tests: GxHashMap<(String, usize), usize>, unused_extern_reports: Arc>>, compiling_test_count: AtomicUsize, } @@ -636,7 +636,7 @@ impl CreateRunnableDoctests { tests: Vec::new(), rustdoc_options: Arc::new(rustdoc_options), opts, - visited_tests: FxHashMap::default(), + visited_tests: GxHashMap::default(), unused_extern_reports: Default::default(), compiling_test_count: AtomicUsize::new(0), } diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs index fc8e119ccc232..a73e73e7d31ec 100644 --- a/src/librustdoc/doctest/rust.rs +++ b/src/librustdoc/doctest/rust.rs @@ -2,7 +2,7 @@ use std::env; -use rustc_data_structures::{fx::FxHashSet, sync::Lrc}; +use rustc_data_structures::{gx::GxHashSet, sync::Lrc}; use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID}; use rustc_hir::{self as hir, intravisit, CRATE_HIR_ID}; use rustc_middle::hir::map::Map; @@ -105,7 +105,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> { nested: F, ) { let ast_attrs = self.tcx.hir().attrs(self.tcx.local_def_id_to_hir_id(def_id)); - if let Some(ref cfg) = ast_attrs.cfg(self.tcx, &FxHashSet::default()) { + if let Some(ref cfg) = ast_attrs.cfg(self.tcx, &GxHashSet::default()) { if !cfg.matches(&self.sess.psess, Some(self.tcx.features())) { return; } diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index a3b88a880f2af..66d3a53136fbe 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -1,6 +1,6 @@ use std::mem; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet, GxIndexSet}; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet}; use rustc_middle::ty::{self, TyCtxt}; use rustc_span::Symbol; @@ -40,11 +40,11 @@ pub(crate) struct Cache { /// URLs when a type is being linked to. External paths are not located in /// this map because the `External` type itself has all the information /// necessary. - pub(crate) paths: FxHashMap, ItemType)>, + pub(crate) paths: GxHashMap, ItemType)>, /// Similar to `paths`, but only holds external paths. This is only used for /// generating explicit hyperlinks to other crates. - pub(crate) external_paths: FxHashMap, ItemType)>, + pub(crate) external_paths: GxHashMap, ItemType)>, /// Maps local `DefId`s of exported types to fully qualified paths. /// Unlike 'paths', this mapping ignores any renames that occur @@ -62,18 +62,18 @@ pub(crate) struct Cache { /// Implementations of a crate should inherit the documentation of the /// parent trait if no extra documentation is specified, and default methods /// should show up in documentation about trait implementations. - pub(crate) traits: FxHashMap, + pub(crate) traits: GxHashMap, /// When rendering traits, it's often useful to be able to list all /// implementors of the trait, and this mapping is exactly, that: a mapping /// of trait ids to the list of known implementors of the trait - pub(crate) implementors: FxHashMap>, + pub(crate) implementors: GxHashMap>, /// Cache of where external crate documentation can be found. - pub(crate) extern_locations: FxHashMap, + pub(crate) extern_locations: GxHashMap, /// Cache of where documentation for primitives can be found. - pub(crate) primitive_locations: FxHashMap, + pub(crate) primitive_locations: GxHashMap, // Note that external items for which `doc(hidden)` applies to are shown as // non-reachable while local items aren't. This is because we're reusing @@ -93,7 +93,7 @@ pub(crate) struct Cache { /// Crates marked with [`#[doc(masked)]`][doc_masked]. /// /// [doc_masked]: https://doc.rust-lang.org/nightly/unstable-book/language-features/doc-masked.html - pub(crate) masked_crates: FxHashSet, + pub(crate) masked_crates: GxHashSet, // Private fields only used when initially crawling a crate to build a cache stack: Vec, @@ -116,14 +116,14 @@ pub(crate) struct Cache { // crawl. In order to prevent crashes when looking for notable traits or // when gathering trait documentation on a type, hold impls here while // folding and add them to the cache later on if we find the trait. - orphan_trait_impls: Vec<(DefId, FxHashSet, Impl)>, + orphan_trait_impls: Vec<(DefId, GxHashSet, Impl)>, /// All intra-doc links resolved so far. /// /// Links are indexed by the DefId of the item they document. - pub(crate) intra_doc_links: FxHashMap>, + pub(crate) intra_doc_links: GxHashMap>, /// Cfg that have been hidden via #![doc(cfg_hide(...))] - pub(crate) hidden_cfg: FxHashSet, + pub(crate) hidden_cfg: GxHashSet, /// Contains the list of `DefId`s which have been inlined. It is used when generating files /// to check if a stripped item should get its file generated or not: if it's inside a @@ -502,7 +502,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { // Figure out the id of this impl. This may map to a // primitive rather than always to a struct/enum. // Note: matching twice to restrict the lifetime of the `i` borrow. - let mut dids = FxHashSet::default(); + let mut dids = GxHashSet::default(); match i.for_ { clean::Type::Path { ref path } | clean::BorrowedRef { type_: box clean::Type::Path { ref path }, .. } => { diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4268fadd6c59c..effadab4153a4 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -15,7 +15,7 @@ use std::iter::{self, once}; use rustc_ast as ast; use rustc_attr::{ConstStability, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; @@ -169,7 +169,7 @@ pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>( cx: &'a Context<'tcx>, ) -> impl Display + 'a + Captures<'tcx> { display_fn(move |f| { - let mut bounds_dup = FxHashSet::default(); + let mut bounds_dup = GxHashSet::default(); for (i, bound) in bounds.iter().filter(|b| bounds_dup.insert(*b)).enumerate() { if i > 0 { diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 336d18a1df1c6..c0730f4025db0 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -12,7 +12,7 @@ use crate::html::render::{Context, LinkFromSrc}; use std::collections::VecDeque; use std::fmt::{Display, Write}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_lexer::{Cursor, LiteralKind, TokenKind}; use rustc_span::edition::Edition; use rustc_span::symbol::Symbol; @@ -35,7 +35,7 @@ pub(crate) struct HrefContext<'a, 'tcx> { /// Decorations are represented as a map from CSS class to vector of character ranges. /// Each range will be wrapped in a span with that class. #[derive(Default)] -pub(crate) struct DecorationInfo(pub(crate) FxHashMap<&'static str, Vec<(u32, u32)>>); +pub(crate) struct DecorationInfo(pub(crate) GxHashMap<&'static str, Vec<(u32, u32)>>); #[derive(Eq, PartialEq, Clone, Copy)] pub(crate) enum Tooltip { diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index 4c0874a686fe9..b7f5b4f4ac777 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -1,7 +1,7 @@ use super::{write_code, DecorationInfo}; use crate::html::format::Buffer; use expect_test::expect_file; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_span::create_default_session_globals_then; const STYLE: &str = r#" @@ -72,7 +72,7 @@ fn test_decorations() { let y = 2; let z = 3; let a = 4;"; - let mut decorations = FxHashMap::default(); + let mut decorations = GxHashMap::default(); decorations.insert("example", vec![(0, 10), (11, 21)]); decorations.insert("example2", vec![(22, 32)]); diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index d4b4db0f3fda6..8cec107be5e71 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use crate::externalfiles::ExternalHtml; use crate::html::format::{Buffer, Print}; @@ -15,7 +15,7 @@ pub(crate) struct Layout { pub(crate) logo: String, pub(crate) favicon: String, pub(crate) external_html: ExternalHtml, - pub(crate) default_settings: FxHashMap, + pub(crate) default_settings: GxHashMap, pub(crate) krate: String, pub(crate) krate_version: String, /// The given user css file which allow to customize the generated diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index bae929c64eab2..f5800329544e9 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -25,7 +25,7 @@ //! // ... something using html //! ``` -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::{Diag, DiagMessage}; use rustc_hir::def_id::DefId; use rustc_middle::ty::TyCtxt; @@ -647,12 +647,12 @@ impl<'a, I: Iterator>> Iterator for SummaryLine<'a, I> { /// references. struct Footnotes<'a, I> { inner: I, - footnotes: FxHashMap>, u16)>, + footnotes: GxHashMap>, u16)>, } impl<'a, I> Footnotes<'a, I> { fn new(iter: I) -> Self { - Footnotes { inner: iter, footnotes: FxHashMap::default() } + Footnotes { inner: iter, footnotes: GxHashMap::default() } } fn get_entry(&mut self, key: &str) -> &mut (Vec>, u16) { @@ -1934,14 +1934,14 @@ pub(crate) fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_>) -> Vec, usize>, + map: GxHashMap, usize>, } // The map is pre-initialized and cloned each time to avoid reinitializing it repeatedly. -static DEFAULT_ID_MAP: OnceLock, usize>> = OnceLock::new(); +static DEFAULT_ID_MAP: OnceLock, usize>> = OnceLock::new(); -fn init_id_map() -> FxHashMap, usize> { - let mut map = FxHashMap::default(); +fn init_id_map() -> GxHashMap, usize> { + let mut map = GxHashMap::default(); // This is the list of IDs used in JavaScript. map.insert("help".into(), 1); map.insert("settings".into(), 1); diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index db1119eca1d3d..105843a795592 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::mpsc::{channel, Receiver}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -72,14 +72,14 @@ pub(crate) struct Context<'tcx> { /// `true`. pub(crate) include_sources: bool, /// Collection of all types with notable traits referenced in the current module. - pub(crate) types_with_notable_traits: FxHashSet, + pub(crate) types_with_notable_traits: GxHashSet, /// Field used during rendering, to know if we're inside an inlined item. pub(crate) is_inside_inlined_module: bool, } // `Context` is cloned a lot, so we don't want the size to grow unexpectedly. #[cfg(all(not(windows), target_pointer_width = "64"))] -rustc_data_structures::static_assert_size!(Context<'_>, 160); +rustc_data_structures::static_assert_size!(Context<'_>, 208); #[cfg(all(windows, target_pointer_width = "64"))] rustc_data_structures::static_assert_size!(Context<'_>, 168); @@ -93,7 +93,7 @@ pub(crate) struct SharedContext<'tcx> { /// creation of the context (contains info like the favicon and added html). pub(crate) layout: layout::Layout, /// The local file sources we've emitted and their respective url-paths. - pub(crate) local_sources: FxHashMap, + pub(crate) local_sources: GxHashMap, /// Show the memory layout of types in the docs. pub(super) show_type_layout: bool, /// The base-URL of the issue tracker for when an item has been tagged with @@ -101,7 +101,7 @@ pub(crate) struct SharedContext<'tcx> { pub(super) issue_tracker_base_url: Option, /// The directories that have already been created in this doc run. Used to reduce the number /// of spurious `create_dir_all` calls. - created_dirs: RefCell>, + created_dirs: RefCell>, /// This flag indicates whether listings of modules (in the side bar and documentation itself) /// should be ordered alphabetically or in order of appearance (in the source code). pub(super) module_sorting: ModuleSorting, @@ -124,11 +124,11 @@ pub(crate) struct SharedContext<'tcx> { /// `None` by default, depends on the `generate-redirect-map` option flag. If this field is set /// to `Some(...)`, it'll store redirections and then generate a JSON file at the top level of /// the crate. - redirections: Option>>, + redirections: Option>>, /// Correspondence map used to link types used in the source code pages to allow to click on /// links to jump to the type's definition. - pub(crate) span_correspondence_map: FxHashMap, + pub(crate) span_correspondence_map: GxHashMap, /// The [`Cache`] used during rendering. pub(crate) cache: Cache, @@ -283,7 +283,7 @@ impl<'tcx> Context<'tcx> { fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap> { // BTreeMap instead of HashMap to get a sorted output let mut map: BTreeMap<_, Vec<_>> = BTreeMap::new(); - let mut inserted: FxHashMap> = FxHashMap::default(); + let mut inserted: GxHashMap> = GxHashMap::default(); for item in &m.items { if item.is_stripped() { @@ -567,7 +567,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { deref_id_map: Default::default(), shared: Rc::new(scx), include_sources, - types_with_notable_traits: FxHashSet::default(), + types_with_notable_traits: GxHashSet::default(), is_inside_inlined_module: false, }; @@ -597,7 +597,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { id_map: IdMap::new(), shared: Rc::clone(&self.shared), include_sources: self.include_sources, - types_with_notable_traits: FxHashSet::default(), + types_with_notable_traits: GxHashSet::default(), is_inside_inlined_module: self.is_inside_inlined_module, } } diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 877a00e206d11..c870c0af69250 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -49,7 +49,7 @@ use std::str; use askama::Template; use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_hir::Mutability; use rustc_middle::ty::print::PrintTraitRefExt; @@ -330,25 +330,25 @@ impl Ord for ItemEntry { #[derive(Debug)] struct AllTypes { - structs: FxHashSet, - enums: FxHashSet, - unions: FxHashSet, - primitives: FxHashSet, - traits: FxHashSet, - macros: FxHashSet, - functions: FxHashSet, - type_aliases: FxHashSet, - opaque_tys: FxHashSet, - statics: FxHashSet, - constants: FxHashSet, - attribute_macros: FxHashSet, - derive_macros: FxHashSet, - trait_aliases: FxHashSet, + structs: GxHashSet, + enums: GxHashSet, + unions: GxHashSet, + primitives: GxHashSet, + traits: GxHashSet, + macros: GxHashSet, + functions: GxHashSet, + type_aliases: GxHashSet, + opaque_tys: GxHashSet, + statics: GxHashSet, + constants: GxHashSet, + attribute_macros: GxHashSet, + derive_macros: GxHashSet, + trait_aliases: GxHashSet, } impl AllTypes { fn new() -> AllTypes { - let new_set = |cap| FxHashSet::with_capacity_and_hasher(cap, Default::default()); + let new_set = |cap| GxHashSet::with_capacity_and_hasher(cap, Default::default()); AllTypes { structs: new_set(100), enums: new_set(100), @@ -395,8 +395,8 @@ impl AllTypes { } } - fn item_sections(&self) -> FxHashSet { - let mut sections = FxHashSet::default(); + fn item_sections(&self) -> GxHashSet { + let mut sections = GxHashSet::default(); if !self.structs.is_empty() { sections.insert(ItemSection::Structs); @@ -445,7 +445,7 @@ impl AllTypes { } fn print(self, f: &mut Buffer) { - fn print_entries(f: &mut Buffer, e: &FxHashSet, kind: ItemSection) { + fn print_entries(f: &mut Buffer, e: &GxHashSet, kind: ItemSection) { if !e.is_empty() { let mut e: Vec<&ItemEntry> = e.iter().collect(); e.sort(); @@ -1156,7 +1156,7 @@ fn render_attributes_in_code(w: &mut impl fmt::Write, it: &clean::Item, cx: &Con #[derive(Copy, Clone)] enum AssocItemLink<'a> { Anchor(Option<&'a str>), - GotoSource(ItemId, &'a FxHashSet), + GotoSource(ItemId, &'a GxHashSet), } impl<'a> AssocItemLink<'a> { @@ -1493,7 +1493,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) { for it in &impl_.items { if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind { out.push_str("
"); - let empty_set = FxHashSet::default(); + let empty_set = GxHashSet::default(); let src_link = AssocItemLink::GotoSource(trait_did.into(), &empty_set); assoc_type( &mut out, @@ -2299,7 +2299,7 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection { /// picked up the impl fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec { let mut out = Vec::new(); - let mut visited = FxHashSet::default(); + let mut visited = GxHashSet::default(); let mut work = VecDeque::new(); let mut process_path = |did: DefId| { @@ -2475,7 +2475,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c })() .unwrap_or(DUMMY_SP); - let mut decoration_info = FxHashMap::default(); + let mut decoration_info = GxHashMap::default(); decoration_info.insert("highlight focus", vec![byte_ranges.remove(0)]); decoration_info.insert("highlight", byte_ranges); diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 0097386591529..6abf82839f226 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1,5 +1,5 @@ use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir as hir; use rustc_hir::def::CtorKind; use rustc_hir::def_id::DefId; @@ -953,7 +953,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: let cloned_shared = Rc::clone(&cx.shared); let cache = &cloned_shared.cache; - let mut extern_crates = FxHashSet::default(); + let mut extern_crates = GxHashSet::default(); if !t.is_object_safe(cx.tcx()) { write_section_heading( @@ -973,7 +973,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: if let Some(implementors) = cache.implementors.get(&it.item_id.expect_def_id()) { // The DefId is for the first Type found with that name. The bool is // if any Types with the same name but different DefId have been found. - let mut implementor_dups: FxHashMap = FxHashMap::default(); + let mut implementor_dups: GxHashMap = GxHashMap::default(); for implementor in implementors { if let Some(did) = implementor.inner_impl().for_.without_borrowed_ref().def_id(cache) && !did.is_local() @@ -2112,7 +2112,7 @@ fn render_implementor( implementor: &Impl, trait_: &clean::Item, w: &mut Buffer, - implementor_dups: &FxHashMap, + implementor_dups: &GxHashMap, aliases: &[String], ) { // If there's already another implementor that has the same abridged name, use the diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index bc8bdffc33145..46cf8fec36ea6 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -3,7 +3,7 @@ pub(crate) mod encode; use std::collections::hash_map::Entry; use std::collections::{BTreeMap, VecDeque}; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::gx::{GxHashMap, GxIndexMap}; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; use rustc_span::sym; @@ -60,9 +60,9 @@ pub(crate) fn build_index<'tcx>( tcx: TyCtxt<'tcx>, ) -> SerializedSearchIndex { // Maps from ID to position in the `crate_paths` array. - let mut itemid_to_pathid = FxHashMap::default(); - let mut primitives = FxHashMap::default(); - let mut associated_types = FxHashMap::default(); + let mut itemid_to_pathid = GxHashMap::default(); + let mut primitives = GxHashMap::default(); + let mut associated_types = GxHashMap::default(); // item type, display path, re-exported internal path let mut crate_paths: Vec<(ItemType, Vec, Option>)> = vec![]; @@ -128,7 +128,7 @@ pub(crate) fn build_index<'tcx>( let mut search_index = std::mem::replace(&mut cache.search_index, Vec::new()); for item in search_index.iter_mut() { fn insert_into_map( - map: &mut FxHashMap, + map: &mut GxHashMap, itemid: F, lastpathid: &mut isize, crate_paths: &mut Vec<(ItemType, Vec, Option>)>, @@ -155,9 +155,9 @@ pub(crate) fn build_index<'tcx>( fn convert_render_type_id( id: RenderTypeId, cache: &mut Cache, - itemid_to_pathid: &mut FxHashMap, - primitives: &mut FxHashMap, - associated_types: &mut FxHashMap, + itemid_to_pathid: &mut GxHashMap, + primitives: &mut GxHashMap, + associated_types: &mut GxHashMap, lastpathid: &mut isize, crate_paths: &mut Vec<(ItemType, Vec, Option>)>, ) -> Option { @@ -227,9 +227,9 @@ pub(crate) fn build_index<'tcx>( fn convert_render_type( ty: &mut RenderType, cache: &mut Cache, - itemid_to_pathid: &mut FxHashMap, - primitives: &mut FxHashMap, - associated_types: &mut FxHashMap, + itemid_to_pathid: &mut GxHashMap, + primitives: &mut GxHashMap, + associated_types: &mut GxHashMap, lastpathid: &mut isize, crate_paths: &mut Vec<(ItemType, Vec, Option>)>, ) { @@ -405,7 +405,7 @@ pub(crate) fn build_index<'tcx>( .collect(); // Find associated items that need disambiguators - let mut associated_item_duplicates = FxHashMap::<(isize, ItemType, Symbol), usize>::default(); + let mut associated_item_duplicates = GxHashMap::<(isize, ItemType, Symbol), usize>::default(); for &item in &crate_items { if item.impl_id.is_some() @@ -475,12 +475,12 @@ pub(crate) fn build_index<'tcx>( where S: Serializer, { - let mut extra_paths = FxHashMap::default(); + let mut extra_paths = GxHashMap::default(); // We need to keep the order of insertion, hence why we use an `IndexMap`. Then we will // insert these "extra paths" (which are paths of items from external crates) into the // `full_paths` list at the end. - let mut revert_extra_paths = FxIndexMap::default(); - let mut mod_paths = FxHashMap::default(); + let mut revert_extra_paths = GxIndexMap::default(); + let mut mod_paths = GxHashMap::default(); for (index, item) in self.items.iter().enumerate() { if item.path.is_empty() { continue; @@ -754,7 +754,7 @@ pub(crate) fn get_function_type_for_search<'tcx>( fn get_index_type( clean_type: &clean::Type, generics: Vec, - rgen: &mut FxHashMap)>, + rgen: &mut GxHashMap)>, ) -> RenderType { RenderType { id: get_index_type_id(clean_type, rgen), @@ -765,7 +765,7 @@ fn get_index_type( fn get_index_type_id( clean_type: &clean::Type, - rgen: &mut FxHashMap)>, + rgen: &mut GxHashMap)>, ) -> Option { use rustc_hir::def::{DefKind, Res}; match *clean_type { @@ -830,7 +830,7 @@ fn simplify_fn_type<'tcx, 'a>( tcx: TyCtxt<'tcx>, recurse: usize, res: &mut Vec, - rgen: &mut FxHashMap)>, + rgen: &mut GxHashMap)>, is_return: bool, cache: &Cache, ) { @@ -1166,7 +1166,7 @@ fn simplify_fn_constraint<'tcx, 'a>( tcx: TyCtxt<'tcx>, recurse: usize, res: &mut Vec<(RenderTypeId, Vec)>, - rgen: &mut FxHashMap)>, + rgen: &mut GxHashMap)>, is_return: bool, cache: &Cache, ) { @@ -1253,7 +1253,7 @@ fn get_fn_inputs_and_outputs<'tcx>( ) -> (Vec, Vec, Vec>) { let decl = &func.decl; - let mut rgen: FxHashMap)> = Default::default(); + let mut rgen: GxHashMap)> = Default::default(); let combined_generics; let (self_, generics) = if let Some((impl_self, impl_generics)) = impl_or_trait_generics { diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index 3d28937eb99e1..5ff6027a17a60 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, rc::Rc}; use askama::Template; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::{def::CtorKind, def_id::DefIdSet}; use rustc_middle::ty::{self, TyCtxt}; @@ -304,7 +304,7 @@ fn sidebar_assoc_items<'a>( let mut assoc_consts = Vec::new(); let mut methods = Vec::new(); if let Some(v) = cache.impls.get(&did) { - let mut used_links = FxHashSet::default(); + let mut used_links = GxHashSet::default(); let mut id_map = IdMap::new(); { @@ -375,7 +375,7 @@ fn sidebar_deref_methods<'a>( impl_: &Impl, v: &[Impl], derefs: &mut DefIdSet, - used_links: &mut FxHashSet, + used_links: &mut GxHashSet, ) { let c = cx.cache(); @@ -468,7 +468,7 @@ fn sidebar_enum<'a>( } pub(crate) fn sidebar_module_like( - item_sections_in_use: FxHashSet, + item_sections_in_use: GxHashSet, ) -> LinkBlock<'static> { let item_sections = ItemSection::ALL .iter() @@ -480,7 +480,7 @@ pub(crate) fn sidebar_module_like( } fn sidebar_module(items: &[clean::Item]) -> LinkBlock<'static> { - let item_sections_in_use: FxHashSet<_> = items + let item_sections_in_use: GxHashSet<_> = items .iter() .filter(|it| { !it.is_stripped() @@ -518,7 +518,7 @@ fn sidebar_render_assoc_items( blanket_impl: Vec<&Impl>, ) -> [LinkBlock<'static>; 3] { let format_impls = |impls: Vec<&Impl>, id_map: &mut IdMap| { - let mut links = FxHashSet::default(); + let mut links = GxHashSet::default(); let mut ret = impls .iter() @@ -560,7 +560,7 @@ fn sidebar_render_assoc_items( ] } -fn get_next_url(used_links: &mut FxHashSet, url: String) -> String { +fn get_next_url(used_links: &mut GxHashSet, url: String) -> String { if used_links.insert(url.clone()) { return url; } @@ -574,7 +574,7 @@ fn get_next_url(used_links: &mut FxHashSet, url: String) -> String { fn get_methods<'a>( i: &'a clean::Impl, for_deref: bool, - used_links: &mut FxHashSet, + used_links: &mut GxHashSet, deref_mut: bool, tcx: TyCtxt<'_>, ) -> Vec> { @@ -598,7 +598,7 @@ fn get_methods<'a>( fn get_associated_constants<'a>( i: &'a clean::Impl, - used_links: &mut FxHashSet, + used_links: &mut GxHashSet, ) -> Vec> { i.items .iter() diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 0535246ae10fe..0921c42b6d2c3 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -1,7 +1,7 @@ use crate::clean::{self, rustc_span, PrimitiveType}; use crate::html::sources; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::intravisit::{self, Visitor}; @@ -44,8 +44,8 @@ pub(crate) fn collect_spans_and_sources( src_root: &Path, include_sources: bool, generate_link_to_definition: bool, -) -> (FxHashMap, FxHashMap) { - let mut visitor = SpanMapVisitor { tcx, matches: FxHashMap::default() }; +) -> (GxHashMap, GxHashMap) { + let mut visitor = SpanMapVisitor { tcx, matches: GxHashMap::default() }; if include_sources { if generate_link_to_definition { @@ -60,7 +60,7 @@ pub(crate) fn collect_spans_and_sources( struct SpanMapVisitor<'tcx> { pub(crate) tcx: TyCtxt<'tcx>, - pub(crate) matches: FxHashMap, + pub(crate) matches: GxHashMap, } impl<'tcx> SpanMapVisitor<'tcx> { diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index c806bf1cc66f3..94d91d50a9801 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -8,7 +8,7 @@ use std::rc::{Rc, Weak}; use indexmap::IndexMap; use itertools::Itertools; use rustc_data_structures::flock; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams}; use rustc_span::def_id::DefId; use rustc_span::Symbol; @@ -201,8 +201,8 @@ pub(super) fn write_shared( struct Hierarchy { parent: Weak, elem: OsString, - children: RefCell>>, - elems: RefCell>, + children: RefCell>>, + elems: RefCell>, } impl Hierarchy { @@ -415,7 +415,7 @@ else if (window.initSearch) window.initSearch(searchIndex); struct TypeImplCollector<'cx, 'cache> { // Map from DefId-of-aliased-type to its data. aliased_types: IndexMap>, - visited_aliases: FxHashSet, + visited_aliases: GxHashSet, cache: &'cache Cache, cx: &'cache mut Context<'cx>, } @@ -490,7 +490,7 @@ else if (window.initSearch) window.initSearch(searchIndex); // Exclude impls that are directly on this type. They're already in the HTML. // Some inlining scenarios can cause there to be two versions of the same // impl: one on the type alias and one on the underlying target type. - let mut seen_impls: FxHashSet = cache + let mut seen_impls: GxHashSet = cache .impls .get(&self_did) .map(|s| &s[..]) @@ -523,7 +523,7 @@ else if (window.initSearch) window.initSearch(searchIndex); } let mut type_impl_collector = TypeImplCollector { aliased_types: IndexMap::default(), - visited_aliases: FxHashSet::default(), + visited_aliases: GxHashSet::default(), cache, cx, }; diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index d4b1da71b40a0..48798471c7769 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -9,7 +9,7 @@ use crate::html::render::Context; use crate::visit::DocVisitor; use askama::Template; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -29,7 +29,7 @@ pub(crate) fn render(cx: &mut Context<'_>, krate: &clean::Crate) -> Result<(), E let dst = cx.dst.join("src").join(krate.name(cx.tcx()).as_str()); cx.shared.ensure_dir(&dst)?; - let mut collector = SourceCollector { dst, cx, emitted_local_sources: FxHashSet::default() }; + let mut collector = SourceCollector { dst, cx, emitted_local_sources: GxHashSet::default() }; collector.visit_crate(krate); Ok(()) } @@ -38,15 +38,15 @@ pub(crate) fn collect_local_sources<'tcx>( tcx: TyCtxt<'tcx>, src_root: &Path, krate: &clean::Crate, -) -> FxHashMap { - let mut lsc = LocalSourcesCollector { tcx, local_sources: FxHashMap::default(), src_root }; +) -> GxHashMap { + let mut lsc = LocalSourcesCollector { tcx, local_sources: GxHashMap::default(), src_root }; lsc.visit_crate(krate); lsc.local_sources } struct LocalSourcesCollector<'a, 'tcx> { tcx: TyCtxt<'tcx>, - local_sources: FxHashMap, + local_sources: GxHashMap, src_root: &'a Path, } @@ -116,7 +116,7 @@ struct SourceCollector<'a, 'tcx> { /// Root destination to place all HTML output into dst: PathBuf, - emitted_local_sources: FxHashSet, + emitted_local_sources: GxHashSet, } impl DocVisitor for SourceCollector<'_, '_> { diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs index 035376bace9c7..aac170f59ff53 100644 --- a/src/librustdoc/html/static_files.rs +++ b/src/librustdoc/html/static_files.rs @@ -3,7 +3,7 @@ //! All the static files are included here for centralized access in case anything other than the //! HTML rendering code (say, the theme checker) needs to access one of these files. -use rustc_data_structures::fx::FxHasher; +use rustc_data_structures::gx::GxHasher; use std::hash::Hasher; use std::path::{Path, PathBuf}; use std::{fmt, str}; @@ -63,7 +63,7 @@ pub(crate) fn static_filename(filename: &str, contents: &[u8]) -> PathBuf { } fn static_suffix(bytes: &[u8]) -> String { - let mut hasher = FxHasher::default(); + let mut hasher = GxHasher::default(); hasher.write(bytes); format!("-{:016x}", hasher.finish()) } diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 0ef24818515c6..d9ac438ff683e 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -13,7 +13,7 @@ use std::io::{BufWriter, Write}; use std::path::PathBuf; use std::rc::Rc; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -36,7 +36,7 @@ pub(crate) struct JsonRenderer<'tcx> { tcx: TyCtxt<'tcx>, /// A mapping of IDs that contains all local items for this crate which gets output as a top /// level field of the JSON blob. - index: Rc>>, + index: Rc>>, /// The directory where the blob will be written to. out_path: PathBuf, cache: Rc, @@ -120,7 +120,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { Ok(( JsonRenderer { tcx, - index: Rc::new(RefCell::new(FxHashMap::default())), + index: Rc::new(RefCell::new(GxHashMap::default())), out_path: options.output, cache: Rc::new(cache), imported_items, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index fb4cd218b84c2..4d12762a20483 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -85,7 +85,7 @@ use rustc_session::{getopts, EarlyDiagCtxt}; use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL; -/// A macro to create a FxHashMap. +/// A macro to create a GxHashMap. /// /// Example: /// @@ -97,7 +97,7 @@ use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL; /// Commas between elements are required (even if the expression is a block). macro_rules! map { ($( $key: expr => $val: expr ),* $(,)*) => {{ - let mut map = ::rustc_data_structures::fx::FxHashMap::default(); + let mut map = ::rustc_data_structures::gx::GxHashMap::default(); $( map.insert($key, $val); )* map }} diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs index dd2bb47e5926b..61ae3078cbb8f 100644 --- a/src/librustdoc/lint.rs +++ b/src/librustdoc/lint.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_lint::LintStore; use rustc_lint_defs::{declare_tool_lint, Lint, LintId}; use rustc_session::{lint, Session}; @@ -21,7 +21,7 @@ pub(crate) fn init_lints( mut allowed_lints: Vec, lint_opts: Vec<(String, lint::Level)>, filter_call: F, -) -> (Vec<(String, lint::Level)>, FxHashMap) +) -> (Vec<(String, lint::Level)>, GxHashMap) where F: Fn(&lint::Lint) -> Option<(String, lint::Level)>, { diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 440b02a1fa75b..3eb920d0cfbca 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -5,7 +5,7 @@ use pulldown_cmark::LinkType; use rustc_ast::util::comments::may_have_doc_links; use rustc_data_structures::{ - fx::{FxHashMap, FxHashSet}, + gx::{GxHashMap, GxHashSet}, intern::Interned, }; use rustc_errors::{Applicability, Diag, DiagMessage}; @@ -45,7 +45,7 @@ pub(crate) const COLLECT_INTRA_DOC_LINKS: Pass = Pass { }; fn collect_intra_doc_links(krate: Crate, cx: &mut DocContext<'_>) -> Crate { - let mut collector = LinkCollector { cx, visited_links: FxHashMap::default() }; + let mut collector = LinkCollector { cx, visited_links: GxHashMap::default() }; collector.visit_crate(&krate); krate } @@ -254,7 +254,7 @@ struct LinkCollector<'a, 'tcx> { cx: &'a mut DocContext<'tcx>, /// Cache the resolved links so we can avoid resolving (and emitting errors for) the same link. /// The link will be `None` if it could not be resolved (i.e. the error was cached). - visited_links: FxHashMap)>>, + visited_links: GxHashMap)>>, } impl<'a, 'tcx> LinkCollector<'a, 'tcx> { @@ -768,9 +768,9 @@ fn trait_impls_for<'a>( cx: &mut DocContext<'a>, ty: Ty<'a>, module: DefId, -) -> FxHashSet<(DefId, DefId)> { +) -> GxHashSet<(DefId, DefId)> { let tcx = cx.tcx; - let mut impls = FxHashSet::default(); + let mut impls = GxHashSet::default(); for &trait_ in tcx.doc_link_traits_in_scope(module) { tcx.for_each_relevant_impl(trait_, ty, |impl_| { @@ -2076,7 +2076,7 @@ fn ambiguity_error( path_str: &str, candidates: &[(Res, Option)], ) -> bool { - let mut descrs = FxHashSet::default(); + let mut descrs = GxHashSet::default(); let kinds = candidates .iter() .map( diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 9ac9941e52196..d11ea37451ffa 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -8,7 +8,7 @@ use crate::core::DocContext; use crate::formats::cache::Cache; use crate::visit::DocVisitor; -use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::gx::GxHashSet; use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LOCAL_CRATE}; use rustc_middle::ty; use rustc_span::symbol::sym; @@ -34,7 +34,7 @@ pub(crate) fn collect_trait_impls(mut krate: Crate, cx: &mut DocContext<'_>) -> }); let local_crate = ExternalCrate { crate_num: LOCAL_CRATE }; - let prims: FxHashSet = local_crate.primitives(tcx).iter().map(|p| p.1).collect(); + let prims: GxHashSet = local_crate.primitives(tcx).iter().map(|p| p.1).collect(); let crate_items = { let mut coll = ItemAndAliasCollector::new(&cx.cache); @@ -243,13 +243,13 @@ impl<'a, 'tcx> DocVisitor for SyntheticImplCollector<'a, 'tcx> { } struct ItemAndAliasCollector<'cache> { - items: FxHashSet, + items: GxHashSet, cache: &'cache Cache, } impl<'cache> ItemAndAliasCollector<'cache> { fn new(cache: &'cache Cache) -> Self { - ItemAndAliasCollector { items: FxHashSet::default(), cache } + ItemAndAliasCollector { items: GxHashSet::default(), cache } } } @@ -268,8 +268,8 @@ impl<'cache> DocVisitor for ItemAndAliasCollector<'cache> { } struct BadImplStripper<'a> { - prims: FxHashSet, - items: FxHashSet, + prims: GxHashSet, + items: GxHashSet, cache: &'a Cache, } diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index 5a595e0395350..968314dd553c4 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -6,7 +6,7 @@ use crate::formats; use crate::formats::renderer::FormatRenderer; use crate::html::render::Context; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use rustc_errors::DiagCtxtHandle; use rustc_hir::{ self as hir, @@ -109,8 +109,8 @@ pub(crate) struct CallData { pub(crate) is_bin: bool, } -pub(crate) type FnCallLocations = FxHashMap; -pub(crate) type AllCallLocations = FxHashMap; +pub(crate) type FnCallLocations = GxHashMap; +pub(crate) type AllCallLocations = GxHashMap; /// Visitor for traversing a crate and finding instances of function calls. struct FindCalls<'a, 'tcx> { @@ -300,7 +300,7 @@ pub(crate) fn run( debug!("Scrape examples target_crates: {target_crates:?}"); // Run call-finder on all items - let mut calls = FxHashMap::default(); + let mut calls = GxHashMap::default(); let mut finder = FindCalls { calls: &mut calls, tcx, map: tcx.hir(), cx, target_crates, bin_crate }; tcx.hir().visit_all_item_likes_in_crate(&mut finder); @@ -339,7 +339,7 @@ pub(crate) fn load_call_locations( with_examples: Vec, dcx: DiagCtxtHandle<'_>, ) -> AllCallLocations { - let mut all_calls: AllCallLocations = FxHashMap::default(); + let mut all_calls: AllCallLocations = GxHashMap::default(); for path in with_examples { let bytes = match fs::read(&path) { Ok(bytes) => bytes, diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs index 2fa54a9cd8126..279c1bcb33544 100644 --- a/src/librustdoc/theme.rs +++ b/src/librustdoc/theme.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::gx::GxHashMap; use std::collections::hash_map::Entry; use std::fs; use std::iter::Peekable; @@ -12,8 +12,8 @@ mod tests; #[derive(Debug)] pub(crate) struct CssPath { - pub(crate) rules: FxHashMap, - pub(crate) children: FxHashMap, + pub(crate) rules: GxHashMap, + pub(crate) children: GxHashMap, } /// When encountering a `"` or a `'`, returns the whole string, including the quote characters. @@ -120,10 +120,10 @@ fn parse_rules( content: &str, selector: String, iter: &mut Peekable>, - paths: &mut FxHashMap, + paths: &mut GxHashMap, ) -> Result<(), String> { - let mut rules = FxHashMap::default(); - let mut children = FxHashMap::default(); + let mut rules = GxHashMap::default(); + let mut children = GxHashMap::default(); loop { // If the parent isn't a "normal" CSS selector, we only expect sub-selectors and not CSS @@ -178,7 +178,7 @@ fn parse_rules( pub(crate) fn parse_selectors( content: &str, iter: &mut Peekable>, - paths: &mut FxHashMap, + paths: &mut GxHashMap, ) -> Result<(), String> { let mut selector = String::new(); @@ -202,17 +202,17 @@ pub(crate) fn parse_selectors( /// The entry point to parse the CSS rules. Every time we encounter a `{`, we then parse the rules /// inside it. -pub(crate) fn load_css_paths(content: &str) -> Result, String> { +pub(crate) fn load_css_paths(content: &str) -> Result, String> { let mut iter = content.chars().peekable(); - let mut paths = FxHashMap::default(); + let mut paths = GxHashMap::default(); parse_selectors(content, &mut iter, &mut paths)?; Ok(paths) } pub(crate) fn get_differences( - origin: &FxHashMap, - against: &FxHashMap, + origin: &GxHashMap, + against: &GxHashMap, v: &mut Vec, ) { for (selector, entry) in origin.iter() { @@ -235,7 +235,7 @@ pub(crate) fn get_differences( pub(crate) fn test_theme_against>( f: &P, - origin: &FxHashMap, + origin: &GxHashMap, dcx: DiagCtxtHandle<'_>, ) -> (bool, Vec) { let against = match fs::read_to_string(f) diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 886df82e5b69f..da1ec91ed11ee 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -1,7 +1,7 @@ //! The Rust AST Visitor. Extracts useful information and massages it into a form //! usable for `clean`. -use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_data_structures::gx::{GxHashSet, GxIndexMap}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LocalDefIdSet}; @@ -31,13 +31,13 @@ pub(crate) struct Module<'hir> { pub(crate) renamed: Option, pub(crate) import_id: Option, /// The key is the item `ItemId` and the value is: (item, renamed, import_id). - /// We use `FxIndexMap` to keep the insert order. - pub(crate) items: FxIndexMap< + /// We use `GxIndexMap` to keep the insert order. + pub(crate) items: GxIndexMap< (LocalDefId, Option), (&'hir hir::Item<'hir>, Option, Option), >, /// Same as for `items`. - pub(crate) inlined_foreigns: FxIndexMap<(DefId, Option), (Res, LocalDefId)>, + pub(crate) inlined_foreigns: GxIndexMap<(DefId, Option), (Res, LocalDefId)>, pub(crate) foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option)>, } @@ -56,8 +56,8 @@ impl Module<'_> { renamed, import_id, mods: Vec::new(), - items: FxIndexMap::default(), - inlined_foreigns: FxIndexMap::default(), + items: GxIndexMap::default(), + inlined_foreigns: GxIndexMap::default(), foreigns: Vec::new(), } } @@ -133,7 +133,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // it can happen if within the same module a `#[macro_export] macro_rules!` // is declared but also a reexport of itself producing two exports of the same // macro in the same module. - let mut inserted = FxHashSet::default(); + let mut inserted = GxHashSet::default(); for child in self.cx.tcx.module_children_local(CRATE_DEF_ID) { if !child.reexport_chain.is_empty() && let Res::Def(DefKind::Macro(_), def_id) = child.res diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index aa119819aaa26..a66a7a382c2bc 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -281,6 +281,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "getrandom", "gimli", "gsgdt", + "gxhash", "hashbrown", "hermit-abi", "icu_list", @@ -355,7 +356,8 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "rustc_apfloat", "rustc_version", "rustix", - "ruzstd", // via object in thorin-dwp + "rustversion", // Dependency of gxhash + "ruzstd", // via object in thorin-dwp "ryu", "scoped-tls", "scopeguard", diff --git a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs index f273bbc99a8ac..7dd0fe7048290 100644 --- a/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs +++ b/tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs @@ -17,7 +17,7 @@ extern crate rustc_target; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_codegen_ssa::{CodegenResults, CrateInfo}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::gx::GxIndexMap; use rustc_errors::ErrorGuaranteed; use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; @@ -53,11 +53,11 @@ impl CodegenBackend for TheBackend { ongoing_codegen: Box, _sess: &Session, _outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CodegenResults, GxIndexMap) { let codegen_results = ongoing_codegen .downcast::() .expect("in join_codegen: ongoing_codegen is not a CodegenResults"); - (*codegen_results, FxIndexMap::default()) + (*codegen_results, GxIndexMap::default()) } fn link( diff --git a/tests/ui-fulldeps/internal-lints/default_hash_types.rs b/tests/ui-fulldeps/internal-lints/default_hash_types.rs index bfafa8c5f27f9..c5554605e797c 100644 --- a/tests/ui-fulldeps/internal-lints/default_hash_types.rs +++ b/tests/ui-fulldeps/internal-lints/default_hash_types.rs @@ -5,7 +5,7 @@ extern crate rustc_data_structures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; use std::collections::{HashMap, HashSet}; mod foo { @@ -14,15 +14,15 @@ mod foo { fn main() { let _map: HashMap = HashMap::default(); - //~^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance - //~^^ ERROR prefer `FxHashMap` over `HashMap`, it has better performance + //~^ ERROR prefer `GxHashMap` over `HashMap`, it has better performance + //~^^ ERROR prefer `GxHashMap` over `HashMap`, it has better performance let _set: HashSet = HashSet::default(); - //~^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance - //~^^ ERROR prefer `FxHashSet` over `HashSet`, it has better performance + //~^ ERROR prefer `GxHashSet` over `HashSet`, it has better performance + //~^^ ERROR prefer `GxHashSet` over `HashSet`, it has better performance // test that the lint doesn't also match the Fx variants themselves - let _fx_map: FxHashMap = FxHashMap::default(); - let _fx_set: FxHashSet = FxHashSet::default(); + let _fx_map: GxHashMap = GxHashMap::default(); + let _fx_set: GxHashSet = GxHashSet::default(); // test another struct of the same name let _ = foo::HashMap; diff --git a/tests/ui-fulldeps/internal-lints/default_hash_types.stderr b/tests/ui-fulldeps/internal-lints/default_hash_types.stderr index 3cb13082f2501..6e4be96bdd0c7 100644 --- a/tests/ui-fulldeps/internal-lints/default_hash_types.stderr +++ b/tests/ui-fulldeps/internal-lints/default_hash_types.stderr @@ -1,39 +1,39 @@ -error: prefer `FxHashMap` over `HashMap`, it has better performance +error: prefer `GxHashMap` over `HashMap`, it has better performance --> $DIR/default_hash_types.rs:16:41 | LL | let _map: HashMap = HashMap::default(); | ^^^^^^^ | - = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary + = note: a `use rustc_data_structures::gx::GxHashMap` may be necessary note: the lint level is defined here --> $DIR/default_hash_types.rs:4:9 | LL | #![deny(rustc::default_hash_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: prefer `FxHashMap` over `HashMap`, it has better performance +error: prefer `GxHashMap` over `HashMap`, it has better performance --> $DIR/default_hash_types.rs:16:15 | LL | let _map: HashMap = HashMap::default(); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary + = note: a `use rustc_data_structures::gx::GxHashMap` may be necessary -error: prefer `FxHashSet` over `HashSet`, it has better performance +error: prefer `GxHashSet` over `HashSet`, it has better performance --> $DIR/default_hash_types.rs:19:33 | LL | let _set: HashSet = HashSet::default(); | ^^^^^^^ | - = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary + = note: a `use rustc_data_structures::gx::GxHashSet` may be necessary -error: prefer `FxHashSet` over `HashSet`, it has better performance +error: prefer `GxHashSet` over `HashSet`, it has better performance --> $DIR/default_hash_types.rs:19:15 | LL | let _set: HashSet = HashSet::default(); | ^^^^^^^^^^^^^^^ | - = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary + = note: a `use rustc_data_structures::gx::GxHashSet` may be necessary error: aborting due to 4 previous errors diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 7b897fabd2d80..64c5b0a44de4f 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -5,10 +5,10 @@ extern crate rustc_data_structures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::gx::{GxHashMap, GxHashSet}; fn main() { - let mut x = FxHashMap::::default(); + let mut x = GxHashMap::::default(); for _ in x.drain() {} //~^ ERROR using `drain` can result in unstable @@ -22,14 +22,14 @@ fn main() { for _ in x {} //~^ ERROR using `into_iter` - let x = FxHashMap::::default(); + let x = GxHashMap::::default(); let _ = x.keys(); //~^ ERROR using `keys` can result in unstable query results let _ = x.values(); //~^ ERROR using `values` can result in unstable query results - let mut x = FxHashMap::::default(); + let mut x = GxHashMap::::default(); for val in x.values_mut() { //~^ ERROR using `values_mut` can result in unstable query results *val = *val + 10; diff --git a/tests/ui/generic-associated-types/self-outlives-lint.stderr b/tests/ui/generic-associated-types/self-outlives-lint.stderr index 9e9b2e18abeb8..58172bf06b512 100644 --- a/tests/ui/generic-associated-types/self-outlives-lint.stderr +++ b/tests/ui/generic-associated-types/self-outlives-lint.stderr @@ -108,17 +108,6 @@ LL | type Bar<'b>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information -error: missing required bound on `Iterator` - --> $DIR/self-outlives-lint.rs:142:5 - | -LL | type Iterator<'a>: Iterator>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` - | - = note: this bound is currently required to ensure that impls have maximum flexibility - = note: we are soliciting feedback, see issue #87479 for more information - error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:140:5 | @@ -130,6 +119,17 @@ LL | type Item<'a>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 for more information +error: missing required bound on `Iterator` + --> $DIR/self-outlives-lint.rs:142:5 + | +LL | type Iterator<'a>: Iterator>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 for more information + error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:148:5 | diff --git a/tests/ui/lint/issue-83477.rs b/tests/ui/lint/issue-83477.rs index d134650f221d4..6c351f73800f3 100644 --- a/tests/ui/lint/issue-83477.rs +++ b/tests/ui/lint/issue-83477.rs @@ -12,5 +12,5 @@ //~| SUGGESTION rustc::default_hash_types fn main() { let _ = std::collections::HashMap::::new(); - //~^ WARN prefer `FxHashMap` over `HashMap`, it has better performance + //~^ WARN prefer `GxHashMap` over `HashMap`, it has better performance } diff --git a/tests/ui/lint/issue-83477.stderr b/tests/ui/lint/issue-83477.stderr index f824fc09e7240..e27eb2866af34 100644 --- a/tests/ui/lint/issue-83477.stderr +++ b/tests/ui/lint/issue-83477.stderr @@ -12,13 +12,13 @@ warning: unknown lint: `rustc::foo::default_hash_types` LL | #[allow(rustc::foo::default_hash_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types` -warning: prefer `FxHashMap` over `HashMap`, it has better performance +warning: prefer `GxHashMap` over `HashMap`, it has better performance --> $DIR/issue-83477.rs:14:13 | LL | let _ = std::collections::HashMap::::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary + = note: a `use rustc_data_structures::gx::GxHashMap` may be necessary note: the lint level is defined here --> $DIR/issue-83477.rs:3:9 | diff --git a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr index 936428f6a1ca6..d91af762e6830 100644 --- a/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-compile-error.stderr @@ -10,17 +10,17 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #3 of macro `num2` is never used - --> $DIR/unused-macro-rules-compile-error.rs:22:5 - | -LL | (two_) => { compile_error! }; - | ^^^^^^ - error: rule #2 of macro `num2` is never used --> $DIR/unused-macro-rules-compile-error.rs:20:5 | LL | (two) => { fn compile_error() {} }; | ^^^^^ +error: rule #3 of macro `num2` is never used + --> $DIR/unused-macro-rules-compile-error.rs:22:5 + | +LL | (two_) => { compile_error! }; + | ^^^^^^ + error: aborting due to 3 previous errors diff --git a/tests/ui/lint/unused/unused-macro-rules-decl.stderr b/tests/ui/lint/unused/unused-macro-rules-decl.stderr index 10ceb3921f3b5..98f146c5b5b52 100644 --- a/tests/ui/lint/unused/unused-macro-rules-decl.stderr +++ b/tests/ui/lint/unused/unused-macro-rules-decl.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:11:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:9:5 | -LL | (four) => { 4 }, - | ^^^^^^ +LL | (two) => { 2 }, + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules-decl.rs:2:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules-decl.rs:9:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules-decl.rs:11:5 | -LL | (two) => { 2 }, - | ^^^^^ +LL | (four) => { 4 }, + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules-decl.rs:31:5 diff --git a/tests/ui/lint/unused/unused-macro-rules.stderr b/tests/ui/lint/unused/unused-macro-rules.stderr index b9258e778053d..e50a8a63cea47 100644 --- a/tests/ui/lint/unused/unused-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-macro-rules.stderr @@ -1,8 +1,8 @@ -error: rule #4 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:10:5 +error: rule #2 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:8:5 | -LL | (four) => { 4 }; - | ^^^^^^ +LL | (two) => { 2 }; + | ^^^^^ | note: the lint level is defined here --> $DIR/unused-macro-rules.rs:1:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_macro_rules)] | ^^^^^^^^^^^^^^^^^^ -error: rule #2 of macro `num` is never used - --> $DIR/unused-macro-rules.rs:8:5 +error: rule #4 of macro `num` is never used + --> $DIR/unused-macro-rules.rs:10:5 | -LL | (two) => { 2 }; - | ^^^^^ +LL | (four) => { 4 }; + | ^^^^^^ error: rule #3 of macro `num_rec` is never used --> $DIR/unused-macro-rules.rs:30:5 diff --git a/tests/ui/stats/hir-stats.stderr b/tests/ui/stats/hir-stats.stderr index a7a612a8a9ea7..152fdcce9dba7 100644 --- a/tests/ui/stats/hir-stats.stderr +++ b/tests/ui/stats/hir-stats.stderr @@ -8,13 +8,14 @@ ast-stats-1 ExprField 48 ( 0.7%) 1 48 ast-stats-1 WherePredicate 56 ( 0.8%) 1 56 ast-stats-1 - BoundPredicate 56 ( 0.8%) 1 ast-stats-1 Attribute 64 ( 1.0%) 2 32 -ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 - DocComment 32 ( 0.5%) 1 +ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 Local 80 ( 1.2%) 1 80 ast-stats-1 ForeignItem 88 ( 1.3%) 1 88 ast-stats-1 - Fn 88 ( 1.3%) 1 ast-stats-1 Arm 96 ( 1.4%) 2 48 ast-stats-1 FnDecl 120 ( 1.8%) 5 24 +ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 FieldDef 160 ( 2.4%) 2 80 ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 @@ -41,9 +42,15 @@ ast-stats-1 - Lit 144 ( 2.2%) 2 ast-stats-1 - Block 216 ( 3.3%) 3 ast-stats-1 PathSegment 744 (11.2%) 31 24 ast-stats-1 Ty 896 (13.5%) 14 64 -ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - Ref 64 ( 1.0%) 1 +ast-stats-1 - Ptr 64 ( 1.0%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 +ast-stats-1 - Path 640 ( 9.7%) 10 +ast-stats-1 Item 1_224 (18.5%) 9 136 +ast-stats-1 - ForeignMod 136 ( 2.1%) 1 +ast-stats-1 - Trait 136 ( 2.1%) 1 +ast-stats-1 - Impl 136 ( 2.1%) 1 +ast-stats-1 - Enum 136 ( 2.1%) 1 ast-stats-1 - Path 640 ( 9.6%) 10 ast-stats-1 Item 1_224 (18.4%) 9 136 ast-stats-1 - Trait 136 ( 2.0%) 1 @@ -73,6 +80,7 @@ ast-stats-2 FnDecl 120 ( 1.6%) 5 24 ast-stats-2 Attribute 128 ( 1.8%) 4 32 ast-stats-2 - DocComment 32 ( 0.4%) 1 ast-stats-2 - Normal 96 ( 1.3%) 3 +ast-stats-2 Param 160 ( 2.2%) 4 40 ast-stats-2 FieldDef 160 ( 2.2%) 2 80 ast-stats-2 Stmt 160 ( 2.2%) 5 32 ast-stats-2 - Let 32 ( 0.4%) 1 @@ -101,12 +109,11 @@ ast-stats-2 - Block 216 ( 3.0%) 3 ast-stats-2 PathSegment 864 (11.9%) 36 24 ast-stats-2 Ty 896 (12.3%) 14 64 ast-stats-2 - Ptr 64 ( 0.9%) 1 -ast-stats-2 - Ref 64 ( 0.9%) 1 ast-stats-2 - ImplicitSelf 128 ( 1.8%) 2 ast-stats-2 - Path 640 ( 8.8%) 10 ast-stats-2 Item 1_496 (20.5%) 11 136 ast-stats-2 - Trait 136 ( 1.9%) 1 -ast-stats-2 - Enum 136 ( 1.9%) 1 +ast-stats-2 - Impl 136 ( 1.9%) 1 ast-stats-2 - ExternCrate 136 ( 1.9%) 1 ast-stats-2 - ForeignMod 136 ( 1.9%) 1 ast-stats-2 - Impl 136 ( 1.9%) 1 @@ -125,9 +132,9 @@ hir-stats ExprField 40 ( 0.4%) 1 40 hir-stats TraitItemRef 56 ( 0.6%) 2 28 hir-stats Local 64 ( 0.7%) 1 64 hir-stats Param 64 ( 0.7%) 2 32 -hir-stats Body 72 ( 0.8%) 3 24 -hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats ImplItemRef 72 ( 0.8%) 2 36 +hir-stats InlineAsm 72 ( 0.8%) 1 72 +hir-stats Body 72 ( 0.8%) 3 24 hir-stats Arm 80 ( 0.9%) 2 40 hir-stats GenericArg 96 ( 1.1%) 4 24 hir-stats - Type 24 ( 0.3%) 1 @@ -139,36 +146,36 @@ hir-stats - Semi 32 ( 0.4%) 1 hir-stats - Expr 32 ( 0.4%) 1 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 -hir-stats Variant 144 ( 1.6%) 2 72 hir-stats GenericArgs 144 ( 1.6%) 3 48 -hir-stats GenericBound 192 ( 2.1%) 4 48 -hir-stats - Trait 192 ( 2.1%) 4 +hir-stats Variant 144 ( 1.6%) 2 72 hir-stats WherePredicate 192 ( 2.1%) 3 64 hir-stats - BoundPredicate 192 ( 2.1%) 3 +hir-stats GenericBound 192 ( 2.1%) 4 48 +hir-stats - Trait 192 ( 2.1%) 4 hir-stats Block 288 ( 3.2%) 6 48 -hir-stats GenericParam 360 ( 4.0%) 5 72 hir-stats Pat 360 ( 4.0%) 5 72 -hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Struct 72 ( 0.8%) 1 +hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Binding 216 ( 2.4%) 3 +hir-stats GenericParam 360 ( 4.0%) 5 72 hir-stats Generics 560 ( 6.2%) 10 56 hir-stats Ty 720 ( 8.0%) 15 48 -hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Ref 48 ( 0.5%) 1 +hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Path 624 ( 6.9%) 13 hir-stats Expr 768 ( 8.5%) 12 64 hir-stats - Path 64 ( 0.7%) 1 -hir-stats - Struct 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 +hir-stats - Struct 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.3%) 6 hir-stats Item 968 (10.8%) 11 88 -hir-stats - Trait 88 ( 1.0%) 1 hir-stats - Enum 88 ( 1.0%) 1 +hir-stats - Trait 88 ( 1.0%) 1 +hir-stats - Impl 88 ( 1.0%) 1 hir-stats - ExternCrate 88 ( 1.0%) 1 hir-stats - ForeignMod 88 ( 1.0%) 1 -hir-stats - Impl 88 ( 1.0%) 1 hir-stats - Fn 176 ( 2.0%) 2 hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.8%) 31 40