about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-22 10:53:17 +0000
committerbors <bors@rust-lang.org>2022-10-22 10:53:17 +0000
commitf8c86c82bfae6d4b90395d08af88e93d6cba5402 (patch)
tree847526e2f7a9d1a96d28fb46d3ae560ab99f6f0a
parent26c96e341639102afacbbcad0dc18ad0ac71ab18 (diff)
parent7b5a366c2aa8ed60965f234a5162f9c70c04a5f6 (diff)
downloadrust-f8c86c82bfae6d4b90395d08af88e93d6cba5402.tar.gz
rust-f8c86c82bfae6d4b90395d08af88e93d6cba5402.zip
Auto merge of #103231 - ecnelises:le_fix, r=lcnr
Remove byte swap of valtree hash on big endian

This addresses problem reported in #103183. The code was originally introduced in https://github.com/rust-lang/rust/commit/e14b34c386ad2809e937e0e6e0379c5cc5474954. (see https://github.com/rust-lang/rust/pull/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.
-rw-r--r--compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index 135ed680da2..e05646e1e86 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -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) {