File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/librustc_data_structures Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,11 @@ impl<W> Hasher for StableHasher<W> {
132132
133133 #[ inline]
134134 fn write_usize ( & mut self , i : usize ) {
135- self . state . write_usize ( i. to_le ( ) ) ;
136- self . bytes_hashed += :: std:: mem:: size_of :: < usize > ( ) as u64 ;
135+ // Always treat usize as u64 so we get the same results on 32 and 64 bit
136+ // platforms. This is important for symbol hashes when cross compiling,
137+ // for example.
138+ self . state . write_u64 ( ( i as u64 ) . to_le ( ) ) ;
139+ self . bytes_hashed += 8 ;
137140 }
138141
139142 #[ inline]
@@ -168,8 +171,11 @@ impl<W> Hasher for StableHasher<W> {
168171
169172 #[ inline]
170173 fn write_isize ( & mut self , i : isize ) {
171- self . state . write_isize ( i. to_le ( ) ) ;
172- self . bytes_hashed += :: std:: mem:: size_of :: < isize > ( ) as u64 ;
174+ // Always treat isize as i64 so we get the same results on 32 and 64 bit
175+ // platforms. This is important for symbol hashes when cross compiling,
176+ // for example.
177+ self . state . write_i64 ( ( i as i64 ) . to_le ( ) ) ;
178+ self . bytes_hashed += 8 ;
173179 }
174180}
175181
You can’t perform that action at this time.
0 commit comments