@@ -3083,7 +3083,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
3083
3083
let mut map: DefIdMap < Symbol > = Default :: default ( ) ;
3084
3084
3085
3085
if let TrimmedDefPaths :: GoodPath = tcx. sess . opts . trimmed_def_paths {
3086
- // Trimming paths is expensive and not optimized, since we expect it to only be used for error reporting.
3086
+ // Trimming paths is expensive and not optimized, since we expect it to only be used for
3087
+ // error reporting.
3087
3088
//
3088
3089
// For good paths causing this bug, the `rustc_middle::ty::print::with_no_trimmed_paths`
3089
3090
// wrapper can be used to suppress this query, in exchange for full paths being formatted.
@@ -3092,6 +3093,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
3092
3093
) ;
3093
3094
}
3094
3095
3096
+ // Once constructed, unique namespace+symbol pairs will have a `Some(_)` entry, while
3097
+ // non-unique pairs will have a `None` entry.
3095
3098
let unique_symbols_rev: & mut FxHashMap < ( Namespace , Symbol ) , Option < DefId > > =
3096
3099
& mut FxHashMap :: default ( ) ;
3097
3100
@@ -3121,6 +3124,7 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
3121
3124
}
3122
3125
} ) ;
3123
3126
3127
+ // Put the symbol from all the unique namespace+symbol pairs into `map`.
3124
3128
for ( ( _, symbol) , opt_def_id) in unique_symbols_rev. drain ( ) {
3125
3129
use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
3126
3130
0 commit comments