From 2ec04bf0960a60dc5d72584a8959c54040efdbbb Mon Sep 17 00:00:00 2001 From: Niklas Jonsson Date: Fri, 8 Jul 2022 22:14:12 +0200 Subject: [PATCH] Remove allow(rustc::potential_query_instability) in rustc_session Replace a use of FxHashMap with FxIndexMap --- compiler/rustc_session/src/lib.rs | 1 - compiler/rustc_session/src/parse.rs | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index 7353c1ca0e208..34646591aa370 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -8,7 +8,6 @@ #![feature(rustc_attrs)] #![feature(map_many_mut)] #![recursion_limit = "256"] -#![allow(rustc::potential_query_instability)] #[macro_use] extern crate rustc_macros; diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index f31d52147b47b..c228b6f68b78b 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -5,7 +5,7 @@ use crate::config::CheckCfg; use crate::lint::{BufferedEarlyLint, BuiltinLintDiagnostics, Lint, LintId}; use crate::SessionDiagnostic; use rustc_ast::node_id::NodeId; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_data_structures::sync::{Lock, Lrc}; use rustc_errors::{emitter::SilentEmitter, ColorConfig, Handler}; use rustc_errors::{ @@ -29,7 +29,7 @@ pub type CrateCheckConfig = CheckCfg; /// used and should be feature gated accordingly in `check_crate`. #[derive(Default)] pub struct GatedSpans { - pub spans: Lock>>, + pub spans: Lock>>, } impl GatedSpans { @@ -56,9 +56,9 @@ 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: FxIndexMap>) { let mut inner = self.spans.borrow_mut(); - for (gate, mut gate_spans) in inner.drain() { + for (gate, mut gate_spans) in inner.drain(..) { spans.entry(gate).or_default().append(&mut gate_spans); } *inner = spans; @@ -68,7 +68,7 @@ impl GatedSpans { #[derive(Default)] pub struct SymbolGallery { /// All symbols occurred and their first occurrence span. - pub symbols: Lock>, + pub symbols: Lock>, } impl SymbolGallery { @@ -147,13 +147,13 @@ 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, /// The parser has reached `Eof` due to an unclosed brace. Used to silence unnecessary errors.