Skip to content

Commit 95dd85a

Browse files
committed
Moved cache check to push_debuginfo_type_name
1 parent 482aedc commit 95dd85a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ pub fn compute_debuginfo_type_name<'tcx>(
3737
) -> String {
3838
let _prof = tcx.prof.generic_activity("compute_debuginfo_type_name");
3939

40-
// Check if we have seen this type and qualifier before.
41-
if let Some(type_name) = type_name_cache.get(&(&t, qualified)) {
42-
return type_name.clone();
43-
}
44-
4540
let mut result = String::with_capacity(64);
4641
let mut visited = FxHashSet::default();
4742
push_debuginfo_type_name(tcx, t, qualified, &mut result, &mut visited, type_name_cache);
@@ -58,6 +53,12 @@ fn push_debuginfo_type_name<'tcx>(
5853
visited: &mut FxHashSet<Ty<'tcx>>,
5954
type_name_cache: &mut FxHashMap<(Ty<'tcx>, bool), String>,
6055
) {
56+
// Check if we have seen this type and qualifier before.
57+
if let Some(type_name) = type_name_cache.get(&(&t, qualified)) {
58+
output.push_str(&type_name.clone());
59+
return;
60+
}
61+
6162
// When targeting MSVC, emit C++ style type names for compatibility with
6263
// .natvis visualizers (and perhaps other existing native debuggers?)
6364
let cpp_like_names = cpp_like_names(tcx);

0 commit comments

Comments
 (0)