Skip to content

Commit

Permalink
Auto merge of rust-lang#103231 - ecnelises:le_fix, r=lcnr
Browse files Browse the repository at this point in the history
Remove byte swap of valtree hash on big endian

This addresses problem reported in rust-lang#103183. The code was originally introduced in rust-lang@e14b34c. (see rust-lang#96591)

On big-endian environment, this operation sequence actually put the other half from 128-bit result, thus we got different hash result on LE and BE.
  • Loading branch information
bors committed Oct 22, 2022
2 parents 26c96e3 + 7b5a366 commit f8c86c8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,8 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
hcx.while_hashing_spans(false, |hcx| {
ct.to_valtree().hash_stable(hcx, &mut hasher)
});
// Note: Don't use `StableHashResult` impl of `u64` here directly, since that
// would lead to endianness problems.
let hash: u128 = hasher.finish();
(hash.to_le() as u64).to_le()
let hash: u64 = hasher.finish();
hash
});

if cpp_like_debuginfo(tcx) {
Expand Down

0 comments on commit f8c86c8

Please sign in to comment.