From 1b8d81fc74e7c7342cf0695018c036d76dbed6df Mon Sep 17 00:00:00 2001 From: ismailarilik Date: Wed, 2 Oct 2024 09:32:04 +0300 Subject: [PATCH] Handle `rustc_metadata` cases of `rustc::potential_query_instability` lint --- compiler/rustc_metadata/src/lib.rs | 1 - compiler/rustc_metadata/src/locator.rs | 20 ++++++++++---------- compiler/rustc_middle/src/ty/mod.rs | 4 ++-- compiler/rustc_resolve/src/lib.rs | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 10f2087d1e6f1..f206dba6cf4bc 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -1,6 +1,5 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::potential_query_instability)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(control_flow_enum)] diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 089ac060ba848..99c673b021a90 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -218,7 +218,7 @@ use std::ops::Deref; use std::path::{Path, PathBuf}; use std::{cmp, fmt}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::owned_slice::slice_owned; use rustc_data_structures::svh::Svh; @@ -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: FxIndexMap<_, (FxIndexMap<_, _>, FxIndexMap<_, _>, FxIndexMap<_, _>)> = 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 = FxIndexMap::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: FxIndexMap, + rmetas: FxIndexMap, + dylibs: FxIndexMap, ) -> 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: FxIndexMap, 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 = FxIndexMap::default(); + let mut rmetas = FxIndexMap::default(); + let mut dylibs = FxIndexMap::default(); for loc in &self.exact_paths { if !loc.canonicalized().exists() { return Err(CrateError::ExternLocationNotExist( diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 2b1212a5eb567..ee8c78c37ed64 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -187,8 +187,8 @@ pub struct ResolverGlobalCtxt { /// 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 doc_link_resolutions: FxIndexMap, + pub doc_link_traits_in_scope: FxIndexMap>, pub all_macro_rules: FxHashMap>, pub stripped_cfg_items: Steal>, } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index b84408cd0cb7a..35caed428c392 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1196,8 +1196,8 @@ pub struct Resolver<'ra, 'tcx> { stripped_cfg_items: Vec>, effective_visibilities: EffectiveVisibilities, - doc_link_resolutions: FxHashMap, - doc_link_traits_in_scope: FxHashMap>, + doc_link_resolutions: FxIndexMap, + doc_link_traits_in_scope: FxIndexMap>, all_macro_rules: FxHashMap, /// Invocation ids of all glob delegations.