Skip to content

Commit 9ff5fc4

Browse files
committed
Auto merge of #131145 - ismailarilik:handle_potential_query_instability_lint_for_rustc_metadata, r=compiler-errors
Handle `rustc_metadata` cases of `rustc::potential_query_instability` lint This PR removes `#![allow(rustc::potential_query_instability)]` line from [`compiler/rustc_metadata/src/lib.rs`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/lib.rs#L3) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors. A somewhat tracking issue: #84447
2 parents 56e35a5 + 3d8bd6b commit 9ff5fc4

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

compiler/rustc_metadata/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// tidy-alphabetical-start
22
#![allow(internal_features)]
3-
#![allow(rustc::potential_query_instability)]
43
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
54
#![doc(rust_logo)]
65
#![feature(control_flow_enum)]

compiler/rustc_metadata/src/locator.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ use std::ops::Deref;
218218
use std::path::{Path, PathBuf};
219219
use std::{cmp, fmt};
220220

221-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
221+
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
222222
use rustc_data_structures::memmap::Mmap;
223223
use rustc_data_structures::owned_slice::slice_owned;
224224
use rustc_data_structures::svh::Svh;
@@ -385,7 +385,7 @@ impl<'a> CrateLocator<'a> {
385385
let dylib_suffix = &self.target.dll_suffix;
386386
let staticlib_suffix = &self.target.staticlib_suffix;
387387

388-
let mut candidates: FxHashMap<_, (FxHashMap<_, _>, FxHashMap<_, _>, FxHashMap<_, _>)> =
388+
let mut candidates: FxIndexMap<_, (FxIndexMap<_, _>, FxIndexMap<_, _>, FxIndexMap<_, _>)> =
389389
Default::default();
390390

391391
// First, find all possible candidate rlibs and dylibs purely based on
@@ -460,7 +460,7 @@ impl<'a> CrateLocator<'a> {
460460
// A Library candidate is created if the metadata for the set of
461461
// libraries corresponds to the crate id and hash criteria that this
462462
// search is being performed for.
463-
let mut libraries = FxHashMap::default();
463+
let mut libraries = FxIndexMap::default();
464464
for (_hash, (rlibs, rmetas, dylibs)) in candidates {
465465
if let Some((svh, lib)) = self.extract_lib(rlibs, rmetas, dylibs)? {
466466
libraries.insert(svh, lib);
@@ -494,9 +494,9 @@ impl<'a> CrateLocator<'a> {
494494

495495
fn extract_lib(
496496
&mut self,
497-
rlibs: FxHashMap<PathBuf, PathKind>,
498-
rmetas: FxHashMap<PathBuf, PathKind>,
499-
dylibs: FxHashMap<PathBuf, PathKind>,
497+
rlibs: FxIndexMap<PathBuf, PathKind>,
498+
rmetas: FxIndexMap<PathBuf, PathKind>,
499+
dylibs: FxIndexMap<PathBuf, PathKind>,
500500
) -> Result<Option<(Svh, Library)>, CrateError> {
501501
let mut slot = None;
502502
// Order here matters, rmeta should come first. See comment in
@@ -534,7 +534,7 @@ impl<'a> CrateLocator<'a> {
534534
// The `PathBuf` in `slot` will only be used for diagnostic purposes.
535535
fn extract_one(
536536
&mut self,
537-
m: FxHashMap<PathBuf, PathKind>,
537+
m: FxIndexMap<PathBuf, PathKind>,
538538
flavor: CrateFlavor,
539539
slot: &mut Option<(Svh, MetadataBlob, PathBuf)>,
540540
) -> Result<Option<(PathBuf, PathKind)>, CrateError> {
@@ -702,9 +702,9 @@ impl<'a> CrateLocator<'a> {
702702
// First, filter out all libraries that look suspicious. We only accept
703703
// files which actually exist that have the correct naming scheme for
704704
// rlibs/dylibs.
705-
let mut rlibs = FxHashMap::default();
706-
let mut rmetas = FxHashMap::default();
707-
let mut dylibs = FxHashMap::default();
705+
let mut rlibs = FxIndexMap::default();
706+
let mut rmetas = FxIndexMap::default();
707+
let mut dylibs = FxIndexMap::default();
708708
for loc in &self.exact_paths {
709709
if !loc.canonicalized().exists() {
710710
return Err(CrateError::ExternLocationNotExist(

compiler/rustc_middle/src/ty/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ pub struct ResolverGlobalCtxt {
187187
/// Mapping from ident span to path span for paths that don't exist as written, but that
188188
/// exist under `std`. For example, wrote `str::from_utf8` instead of `std::str::from_utf8`.
189189
pub confused_type_with_std_module: FxIndexMap<Span, Span>,
190-
pub doc_link_resolutions: FxHashMap<LocalDefId, DocLinkResMap>,
191-
pub doc_link_traits_in_scope: FxHashMap<LocalDefId, Vec<DefId>>,
190+
pub doc_link_resolutions: FxIndexMap<LocalDefId, DocLinkResMap>,
191+
pub doc_link_traits_in_scope: FxIndexMap<LocalDefId, Vec<DefId>>,
192192
pub all_macro_rules: FxHashMap<Symbol, Res<ast::NodeId>>,
193193
pub stripped_cfg_items: Steal<Vec<StrippedCfgItem>>,
194194
}

compiler/rustc_resolve/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1196,8 +1196,8 @@ pub struct Resolver<'ra, 'tcx> {
11961196
stripped_cfg_items: Vec<StrippedCfgItem<NodeId>>,
11971197

11981198
effective_visibilities: EffectiveVisibilities,
1199-
doc_link_resolutions: FxHashMap<LocalDefId, DocLinkResMap>,
1200-
doc_link_traits_in_scope: FxHashMap<LocalDefId, Vec<DefId>>,
1199+
doc_link_resolutions: FxIndexMap<LocalDefId, DocLinkResMap>,
1200+
doc_link_traits_in_scope: FxIndexMap<LocalDefId, Vec<DefId>>,
12011201
all_macro_rules: FxHashMap<Symbol, Res>,
12021202

12031203
/// Invocation ids of all glob delegations.

0 commit comments

Comments
 (0)