Skip to content

Commit 47ba935

Browse files
committed
Auto merge of rust-lang#99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors
rustc_expand: Switch FxHashMap to FxIndexMap where iteration is used Relates rust-lang#84447
2 parents 7d0a55b + b47a934 commit 47ba935

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

compiler/rustc_expand/src/base.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_ast::tokenstream::TokenStream;
88
use rustc_ast::visit::{AssocCtxt, Visitor};
99
use rustc_ast::{self as ast, Attribute, HasAttrs, Item, NodeId, PatKind};
1010
use rustc_attr::{self as attr, Deprecation, Stability};
11-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
11+
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
1212
use rustc_data_structures::sync::{self, Lrc};
1313
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan, PResult};
1414
use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
@@ -985,7 +985,7 @@ pub struct ExtCtxt<'a> {
985985
/// Error recovery mode entered when expansion is stuck
986986
/// (or during eager expansion, but that's a hack).
987987
pub force_mode: bool,
988-
pub expansions: FxHashMap<Span, Vec<String>>,
988+
pub expansions: FxIndexMap<Span, Vec<String>>,
989989
/// Used for running pre-expansion lints on freshly loaded modules.
990990
pub(super) lint_store: LintStoreExpandDyn<'a>,
991991
/// Used for storing lints generated during expansion, like `NAMED_ARGUMENTS_USED_POSITIONALLY`
@@ -1020,7 +1020,7 @@ impl<'a> ExtCtxt<'a> {
10201020
is_trailing_mac: false,
10211021
},
10221022
force_mode: false,
1023-
expansions: FxHashMap::default(),
1023+
expansions: FxIndexMap::default(),
10241024
expanded_inert_attrs: MarkedAttrs::new(),
10251025
buffered_early_lint: vec![],
10261026
}

compiler/rustc_expand/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(rustc::potential_query_instability)]
21
#![feature(array_windows)]
32
#![feature(associated_type_bounds)]
43
#![feature(associated_type_defaults)]

compiler/rustc_expand/src/mbe/macro_rules.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_ast::tokenstream::{DelimSpan, TokenStream};
1313
use rustc_ast::{NodeId, DUMMY_NODE_ID};
1414
use rustc_ast_pretty::pprust;
1515
use rustc_attr::{self as attr, TransparencyError};
16-
use rustc_data_structures::fx::FxHashMap;
16+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
1717
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
1818
use rustc_feature::Features;
1919
use rustc_lint_defs::builtin::{
@@ -198,7 +198,7 @@ fn macro_rules_dummy_expander<'cx>(
198198
DummyResult::any(span)
199199
}
200200

201-
fn trace_macros_note(cx_expansions: &mut FxHashMap<Span, Vec<String>>, sp: Span, message: String) {
201+
fn trace_macros_note(cx_expansions: &mut FxIndexMap<Span, Vec<String>>, sp: Span, message: String) {
202202
let sp = sp.macro_backtrace().last().map_or(sp, |trace| trace.call_site);
203203
cx_expansions.entry(sp).or_default().push(message);
204204
}

0 commit comments

Comments
 (0)