@@ -4,7 +4,6 @@ use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
44use rustc_middle:: ty:: print:: { PrettyPrinter , Print , PrintError , Printer } ;
55use rustc_middle:: ty:: { self , Instance , Ty , TyCtxt , TypeVisitableExt } ;
66use rustc_middle:: ty:: { GenericArg , GenericArgKind } ;
7- use rustc_middle:: util:: common:: record_time;
87
98use std:: fmt:: { self , Write } ;
109use std:: mem:: { self , discriminant} ;
@@ -101,40 +100,38 @@ fn get_symbol_hash<'tcx>(
101100 tcx. with_stable_hashing_context ( |mut hcx| {
102101 let mut hasher = StableHasher :: new ( ) ;
103102
104- record_time ( & tcx. sess . perf_stats . symbol_hash_time , || {
105- // the main symbol name is not necessarily unique; hash in the
106- // compiler's internal def-path, guaranteeing each symbol has a
107- // truly unique path
108- tcx. def_path_hash ( def_id) . hash_stable ( & mut hcx, & mut hasher) ;
109-
110- // Include the main item-type. Note that, in this case, the
111- // assertions about `has_param` may not hold, but this item-type
112- // ought to be the same for every reference anyway.
113- assert ! ( !item_type. has_erasable_regions( ) ) ;
114- hcx. while_hashing_spans ( false , |hcx| {
115- item_type. hash_stable ( hcx, & mut hasher) ;
116-
117- // If this is a function, we hash the signature as well.
118- // This is not *strictly* needed, but it may help in some
119- // situations, see the `run-make/a-b-a-linker-guard` test.
120- if let ty:: FnDef ( ..) = item_type. kind ( ) {
121- item_type. fn_sig ( tcx) . hash_stable ( hcx, & mut hasher) ;
122- }
103+ // the main symbol name is not necessarily unique; hash in the
104+ // compiler's internal def-path, guaranteeing each symbol has a
105+ // truly unique path
106+ tcx. def_path_hash ( def_id) . hash_stable ( & mut hcx, & mut hasher) ;
107+
108+ // Include the main item-type. Note that, in this case, the
109+ // assertions about `has_param` may not hold, but this item-type
110+ // ought to be the same for every reference anyway.
111+ assert ! ( !item_type. has_erasable_regions( ) ) ;
112+ hcx. while_hashing_spans ( false , |hcx| {
113+ item_type. hash_stable ( hcx, & mut hasher) ;
114+
115+ // If this is a function, we hash the signature as well.
116+ // This is not *strictly* needed, but it may help in some
117+ // situations, see the `run-make/a-b-a-linker-guard` test.
118+ if let ty:: FnDef ( ..) = item_type. kind ( ) {
119+ item_type. fn_sig ( tcx) . hash_stable ( hcx, & mut hasher) ;
120+ }
123121
124- // also include any type parameters (for generic items)
125- args. hash_stable ( hcx, & mut hasher) ;
122+ // also include any type parameters (for generic items)
123+ args. hash_stable ( hcx, & mut hasher) ;
126124
127- if let Some ( instantiating_crate) = instantiating_crate {
128- tcx. def_path_hash ( instantiating_crate. as_def_id ( ) )
129- . stable_crate_id ( )
130- . hash_stable ( hcx, & mut hasher) ;
131- }
125+ if let Some ( instantiating_crate) = instantiating_crate {
126+ tcx. def_path_hash ( instantiating_crate. as_def_id ( ) )
127+ . stable_crate_id ( )
128+ . hash_stable ( hcx, & mut hasher) ;
129+ }
132130
133- // We want to avoid accidental collision between different types of instances.
134- // Especially, `VTableShim`s and `ReifyShim`s may overlap with their original
135- // instances without this.
136- discriminant ( & instance. def ) . hash_stable ( hcx, & mut hasher) ;
137- } ) ;
131+ // We want to avoid accidental collision between different types of instances.
132+ // Especially, `VTableShim`s and `ReifyShim`s may overlap with their original
133+ // instances without this.
134+ discriminant ( & instance. def ) . hash_stable ( hcx, & mut hasher) ;
138135 } ) ;
139136
140137 // 64 bits should be enough to avoid collisions.
0 commit comments