Skip to content

Commit 6a2a210

Browse files
committed
Allow the lint somewhere because precautios is already taken.
1 parent 188c1cc commit 6a2a210

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ops::{Deref, DerefMut};
55

66
use rustc_apfloat::Float;
77
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
8-
use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
8+
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
99
use rustc_data_structures::unord::UnordMap;
1010
use rustc_hir as hir;
1111
use rustc_hir::LangItem;
@@ -3352,8 +3352,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
33523352

33533353
// Once constructed, unique namespace+symbol pairs will have a `Some(_)` entry, while
33543354
// non-unique pairs will have a `None` entry.
3355-
let unique_symbols_rev: &mut FxIndexMap<(Namespace, Symbol), Option<DefId>> =
3356-
&mut FxIndexMap::default();
3355+
let unique_symbols_rev: &mut FxHashMap<(Namespace, Symbol), Option<DefId>> =
3356+
&mut FxHashMap::default();
33573357

33583358
for symbol_set in tcx.resolutions(()).glob_map.values() {
33593359
for symbol in symbol_set {
@@ -3363,23 +3363,29 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
33633363
}
33643364
}
33653365

3366-
for_each_def(tcx, |ident, ns, def_id| match unique_symbols_rev.entry((ns, ident.name)) {
3367-
IndexEntry::Occupied(mut v) => match v.get() {
3368-
None => {}
3369-
Some(existing) => {
3370-
if *existing != def_id {
3371-
v.insert(None);
3366+
for_each_def(tcx, |ident, ns, def_id| {
3367+
use std::collections::hash_map::Entry::{Occupied, Vacant};
3368+
3369+
match unique_symbols_rev.entry((ns, ident.name)) {
3370+
Occupied(mut v) => match v.get() {
3371+
None => {}
3372+
Some(existing) => {
3373+
if *existing != def_id {
3374+
v.insert(None);
3375+
}
33723376
}
3377+
},
3378+
Vacant(v) => {
3379+
v.insert(Some(def_id));
33733380
}
3374-
},
3375-
IndexEntry::Vacant(v) => {
3376-
v.insert(Some(def_id));
33773381
}
33783382
});
33793383

33803384
// Put the symbol from all the unique namespace+symbol pairs into `map`.
33813385
let mut map: DefIdMap<Symbol> = Default::default();
3382-
for ((_, symbol), opt_def_id) in unique_symbols_rev.drain(..) {
3386+
// Precatious is taken below in the loop so we can allow this lint here.
3387+
#[allow(rustc::potential_query_instability)]
3388+
for ((_, symbol), opt_def_id) in unique_symbols_rev.drain() {
33833389
use std::collections::hash_map::Entry::{Occupied, Vacant};
33843390

33853391
if let Some(def_id) = opt_def_id {

0 commit comments

Comments
 (0)