Skip to content

Commit ccae5e3

Browse files
committed
Allow the lint somewhere because precautios is already taken.
1 parent efd8724 commit ccae5e3

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

+19-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ops::{Deref, DerefMut};
66
use rustc_abi::{ExternAbi, Size};
77
use rustc_apfloat::Float;
88
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
9-
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
9+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
1010
use rustc_data_structures::unord::UnordMap;
1111
use rustc_hir as hir;
1212
use rustc_hir::LangItem;
@@ -3489,8 +3489,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
34893489

34903490
// Once constructed, unique namespace+symbol pairs will have a `Some(_)` entry, while
34913491
// non-unique pairs will have a `None` entry.
3492-
let unique_symbols_rev: &mut FxIndexMap<(Namespace, Symbol), Option<DefId>> =
3493-
&mut FxIndexMap::default();
3492+
let unique_symbols_rev: &mut FxHashMap<(Namespace, Symbol), Option<DefId>> =
3493+
&mut FxHashMap::default();
34943494

34953495
for symbol_set in tcx.resolutions(()).glob_map.values() {
34963496
for symbol in symbol_set {
@@ -3500,23 +3500,29 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
35003500
}
35013501
}
35023502

3503-
for_each_def(tcx, |ident, ns, def_id| match unique_symbols_rev.entry((ns, ident.name)) {
3504-
IndexEntry::Occupied(mut v) => match v.get() {
3505-
None => {}
3506-
Some(existing) => {
3507-
if *existing != def_id {
3508-
v.insert(None);
3503+
for_each_def(tcx, |ident, ns, def_id| {
3504+
use std::collections::hash_map::Entry::{Occupied, Vacant};
3505+
3506+
match unique_symbols_rev.entry((ns, ident.name)) {
3507+
Occupied(mut v) => match v.get() {
3508+
None => {}
3509+
Some(existing) => {
3510+
if *existing != def_id {
3511+
v.insert(None);
3512+
}
35093513
}
3514+
},
3515+
Vacant(v) => {
3516+
v.insert(Some(def_id));
35103517
}
3511-
},
3512-
IndexEntry::Vacant(v) => {
3513-
v.insert(Some(def_id));
35143518
}
35153519
});
35163520

35173521
// Put the symbol from all the unique namespace+symbol pairs into `map`.
35183522
let mut map: DefIdMap<Symbol> = Default::default();
3519-
for ((_, symbol), opt_def_id) in unique_symbols_rev.drain(..) {
3523+
// Precatious is taken below in the loop so we can allow this lint here.
3524+
#[allow(rustc::potential_query_instability)]
3525+
for ((_, symbol), opt_def_id) in unique_symbols_rev.drain() {
35203526
use std::collections::hash_map::Entry::{Occupied, Vacant};
35213527

35223528
if let Some(def_id) = opt_def_id {

0 commit comments

Comments
 (0)