This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -227,13 +227,13 @@ rustc_index::newtype_index! {
227227// We guarantee field order. Note that the order is essential here, see below why.
228228pub struct DefId {
229229 // cfg-ing the order of fields so that the `DefIndex` which is high entropy always ends up in
230- // the lower bits no matter the endianness. This allows the compiler to turn that `Hash` impl
230+ // the higher bits no matter the endianness. This allows the compiler to turn that `Hash` impl
231231 // into a direct call to `u64::hash(_)`.
232232 #[ cfg( not( all( target_pointer_width = "64" , target_endian = "big" ) ) ) ]
233- pub index : DefIndex ,
234- pub krate : CrateNum ,
233+ pub krate : DefIndex ,
234+ pub index : CrateNum ,
235235 #[ cfg( all( target_pointer_width = "64" , target_endian = "big" ) ) ]
236- pub index : DefIndex ,
236+ pub krate : DefIndex ,
237237}
238238
239239// To ensure correctness of incremental compilation,
@@ -248,15 +248,15 @@ impl !PartialOrd for DefId {}
248248//
249249// ```
250250// +-1--------------31-+-32-------------63-+
251- // ! index ! krate !
251+ // ! krate ! index !
252252// +-------------------+-------------------+
253253// ```
254254//
255255// On 64-bit big-endian systems, this compiles to a 64-bit rotation by 32 bits, or a 64-bit load.
256256#[ cfg( target_pointer_width = "64" ) ]
257257impl Hash for DefId {
258258 fn hash < H : Hasher > ( & self , h : & mut H ) {
259- ( ( ( self . krate . as_u32 ( ) as u64 ) << 32 ) | ( self . index . as_u32 ( ) as u64 ) ) . hash ( h)
259+ ( ( ( self . index . as_u32 ( ) as u64 ) << 32 ) | ( self . krate . as_u32 ( ) as u64 ) ) . hash ( h)
260260 }
261261}
262262
You can’t perform that action at this time.
0 commit comments