File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
rustc_middle/src/ty/print Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ impl DefKey {
145145 let DisambiguatedDefPathData { ref data, disambiguator } = self . disambiguated_data ;
146146
147147 std:: mem:: discriminant ( data) . hash ( & mut hasher) ;
148- if let Some ( name) = data. get_opt_name ( ) {
148+ if let Some ( name) = data. hashed_symbol ( ) {
149149 // Get a stable hash by considering the symbol chars rather than
150150 // the symbol index.
151151 name. as_str ( ) . hash ( & mut hasher) ;
@@ -443,6 +443,26 @@ pub enum DefPathDataName {
443443
444444impl DefPathData {
445445 pub fn get_opt_name ( & self ) -> Option < Symbol > {
446+ use self :: DefPathData :: * ;
447+ match * self {
448+ TypeNs ( name) | ValueNs ( name) | MacroNs ( name) | LifetimeNs ( name) => Some ( name) ,
449+
450+ Impl
451+ | ForeignMod
452+ | CrateRoot
453+ | Use
454+ | GlobalAsm
455+ | Closure
456+ | Ctor
457+ | AnonConst
458+ | OpaqueTy
459+ | AnonAssocTy ( ..)
460+ | SyntheticCoroutineBody
461+ | NestedStatic => None ,
462+ }
463+ }
464+
465+ fn hashed_symbol ( & self ) -> Option < Symbol > {
446466 use self :: DefPathData :: * ;
447467 match * self {
448468 TypeNs ( name) | ValueNs ( name) | MacroNs ( name) | LifetimeNs ( name) | AnonAssocTy ( name) => {
Original file line number Diff line number Diff line change @@ -391,10 +391,6 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
391391 let visible_parent_map = self . tcx ( ) . visible_parent_map ( ( ) ) ;
392392 let kind = self . tcx ( ) . def_kind ( def_id) ;
393393
394- if let DefPathData :: AnonAssocTy ( ..) = key. disambiguated_data . data {
395- return Ok ( false ) ;
396- }
397-
398394 let get_local_name = |this : & Self , name, def_id, key : DefKey | {
399395 if let Some ( visible_parent) = visible_parent_map. get ( & def_id)
400396 && let actual_parent = this. tcx ( ) . opt_parent ( def_id)
You can’t perform that action at this time.
0 commit comments