@@ -6,13 +6,12 @@ use rustc_ast as ast;
66use rustc_data_structures:: { fx:: FxHashMap , stable_set:: FxHashSet } ;
77use rustc_errors:: { Applicability , DiagnosticBuilder } ;
88use rustc_expand:: base:: SyntaxExtensionKind ;
9- use rustc_hir as hir;
109use rustc_hir:: def:: {
1110 DefKind ,
1211 Namespace :: { self , * } ,
1312 PerNS ,
1413} ;
15- use rustc_hir:: def_id:: { CrateNum , DefId } ;
14+ use rustc_hir:: def_id:: { CrateNum , DefId , CRATE_DEF_ID } ;
1615use rustc_middle:: ty:: { DefIdTree , Ty , TyCtxt } ;
1716use rustc_middle:: { bug, span_bug, ty} ;
1817use rustc_resolve:: ParentScope ;
@@ -1736,9 +1735,9 @@ impl Disambiguator {
17361735 fn descr ( self ) -> & ' static str {
17371736 match self {
17381737 Self :: Namespace ( n) => n. descr ( ) ,
1739- // HACK(jynelson): by looking at the source I saw the DefId we pass
1740- // for `expected.descr()` doesn't matter, since it's not a crate
1741- Self :: Kind ( k) => k. descr ( DefId :: local ( hir :: def_id :: DefIndex :: from_usize ( 0 ) ) ) ,
1738+ // HACK(jynelson): the source of `DefKind::descr` only uses the DefId for
1739+ // printing "module" vs "crate" so using the wrong ID is not a huge problem
1740+ Self :: Kind ( k) => k. descr ( CRATE_DEF_ID . to_def_id ( ) ) ,
17421741 Self :: Primitive => "builtin type" ,
17431742 }
17441743 }
0 commit comments