Skip to content

Commit 23085b6

Browse files
committed
Fix profiling query key creation
1 parent bb8e176 commit 23085b6

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

compiler/rustc_middle/src/ty/query/profiling_support.rs

+12-19
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ use measureme::{StringComponent, StringId};
44
use rustc_data_structures::fx::FxHashMap;
55
use rustc_data_structures::profiling::SelfProfiler;
66
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
7-
use rustc_hir::definitions::{DefPathData, DefPathDataName};
7+
use rustc_hir::definitions::DefPathData;
88
use rustc_query_system::query::QueryCache;
99
use rustc_query_system::query::QueryState;
10+
use rustc_span::symbol::Symbol;
1011
use std::fmt::Debug;
1112
use std::io::Write;
1213

@@ -66,25 +67,17 @@ impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
6667
end_index = 3;
6768
}
6869
other => {
69-
name = match other.name() {
70-
DefPathDataName::Named(name) => {
71-
dis = "";
72-
end_index = 3;
73-
name
74-
}
75-
DefPathDataName::Anon { namespace } => {
76-
write!(
77-
&mut dis_buffer[..],
78-
"[{}]",
79-
def_key.disambiguated_data.disambiguator
80-
)
70+
name = Symbol::intern(&other.to_string());
71+
if def_key.disambiguated_data.disambiguator == 0 {
72+
dis = "";
73+
end_index = 3;
74+
} else {
75+
write!(&mut dis_buffer[..], "[{}]", def_key.disambiguated_data.disambiguator)
8176
.unwrap();
82-
let end_of_dis = dis_buffer.iter().position(|&c| c == b']').unwrap();
83-
dis = std::str::from_utf8(&dis_buffer[..end_of_dis + 1]).unwrap();
84-
end_index = 4;
85-
namespace
86-
}
87-
};
77+
let end_of_dis = dis_buffer.iter().position(|&c| c == b']').unwrap();
78+
dis = std::str::from_utf8(&dis_buffer[..end_of_dis + 1]).unwrap();
79+
end_index = 4;
80+
}
8881
}
8982
}
9083

0 commit comments

Comments
 (0)