@@ -4,9 +4,10 @@ use measureme::{StringComponent, StringId};
44use rustc_data_structures:: fx:: FxHashMap ;
55use rustc_data_structures:: profiling:: SelfProfiler ;
66use 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 ;
88use rustc_query_system:: query:: QueryCache ;
99use rustc_query_system:: query:: QueryState ;
10+ use rustc_span:: symbol:: Symbol ;
1011use std:: fmt:: Debug ;
1112use 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