Skip to content

Commit b2e5a7b

Browse files
Make iteration order of trimmed_def_paths query stable
1 parent 62fc1e7 commit b2e5a7b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ rustc_queries! {
17911791
}
17921792
/// Collects the "trimmed", shortest accessible paths to all items for diagnostics.
17931793
/// See the [provider docs](`rustc_middle::ty::print::trimmed_def_paths`) for more info.
1794-
query trimmed_def_paths(_: ()) -> &'tcx FxHashMap<DefId, Symbol> {
1794+
query trimmed_def_paths(_: ()) -> &'tcx DefIdMap<Symbol> {
17951795
arena_cache
17961796
desc { "calculating trimmed def paths" }
17971797
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_apfloat::Float;
1212
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
1313
use rustc_hir as hir;
1414
use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
15-
use rustc_hir::def_id::{DefIdSet, ModDefId, CRATE_DEF_ID, LOCAL_CRATE};
15+
use rustc_hir::def_id::{DefIdMap, DefIdSet, ModDefId, CRATE_DEF_ID, LOCAL_CRATE};
1616
use rustc_hir::definitions::{DefKey, DefPathDataName};
1717
use rustc_hir::LangItem;
1818
use rustc_session::config::TrimmedDefPaths;
@@ -3040,8 +3040,8 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
30403040
///
30413041
/// See also [`DelayDm`](rustc_error_messages::DelayDm) and [`with_no_trimmed_paths!`].
30423042
// this is pub to be able to intra-doc-link it
3043-
pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> {
3044-
let mut map: FxHashMap<DefId, Symbol> = FxHashMap::default();
3043+
pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
3044+
let mut map: DefIdMap<Symbol> = Default::default();
30453045

30463046
if let TrimmedDefPaths::GoodPath = tcx.sess.opts.trimmed_def_paths {
30473047
// Trimming paths is expensive and not optimized, since we expect it to only be used for error reporting.

0 commit comments

Comments
 (0)