This repository was archived by the owner on May 28, 2025. It is now read-only.
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 {
145
145
let DisambiguatedDefPathData { ref data, disambiguator } = self . disambiguated_data ;
146
146
147
147
std:: mem:: discriminant ( data) . hash ( & mut hasher) ;
148
- if let Some ( name) = data. get_opt_name ( ) {
148
+ if let Some ( name) = data. hashed_symbol ( ) {
149
149
// Get a stable hash by considering the symbol chars rather than
150
150
// the symbol index.
151
151
name. as_str ( ) . hash ( & mut hasher) ;
@@ -443,6 +443,26 @@ pub enum DefPathDataName {
443
443
444
444
impl DefPathData {
445
445
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 > {
446
466
use self :: DefPathData :: * ;
447
467
match * self {
448
468
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 {
391
391
let visible_parent_map = self . tcx ( ) . visible_parent_map ( ( ) ) ;
392
392
let kind = self . tcx ( ) . def_kind ( def_id) ;
393
393
394
- if let DefPathData :: AnonAssocTy ( ..) = key. disambiguated_data . data {
395
- return Ok ( false ) ;
396
- }
397
-
398
394
let get_local_name = |this : & Self , name, def_id, key : DefKey | {
399
395
if let Some ( visible_parent) = visible_parent_map. get ( & def_id)
400
396
&& let actual_parent = this. tcx ( ) . opt_parent ( def_id)
You can’t perform that action at this time.
0 commit comments