diff options
| author | Ben Kimock <kimockb@gmail.com> | 2025-02-15 13:57:21 -0500 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2025-02-15 13:59:09 -0500 |
| commit | 1d7cf0ff407beea447334c2784d39658e4be3ca0 (patch) | |
| tree | 245db5686a564ac6dd23781adf40fff8d777ad39 /compiler/rustc_ty_utils/src/layout.rs | |
| parent | fc147b4a81bea997e544afa8f8f05af73c759231 (diff) | |
| download | rust-1d7cf0ff407beea447334c2784d39658e4be3ca0.tar.gz rust-1d7cf0ff407beea447334c2784d39658e4be3ca0.zip | |
Replace some u64 hashes with Hash64
Diffstat (limited to 'compiler/rustc_ty_utils/src/layout.rs')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index ee271048fc1..6a67009fe90 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -9,6 +9,7 @@ use rustc_abi::{ HasDataLayout, Layout, LayoutCalculatorError, LayoutData, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, VariantIdx, Variants, WrappingRange, }; +use rustc_data_structures::stable_hasher::Hash64; use rustc_index::bit_set::DenseBitSet; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::bug; @@ -380,7 +381,7 @@ fn layout_of_uncached<'tcx>( size, max_repr_align: None, unadjusted_abi_align: element.align.abi, - randomization_seed: element.randomization_seed.wrapping_add(count), + randomization_seed: element.randomization_seed.wrapping_add(Hash64::new(count)), }) } ty::Slice(element) => { @@ -395,7 +396,9 @@ fn layout_of_uncached<'tcx>( max_repr_align: None, unadjusted_abi_align: element.align.abi, // adding a randomly chosen value to distinguish slices - randomization_seed: element.randomization_seed.wrapping_add(0x2dcba99c39784102), + randomization_seed: element + .randomization_seed + .wrapping_add(Hash64::new(0x2dcba99c39784102)), }) } ty::Str => tcx.mk_layout(LayoutData { @@ -408,7 +411,7 @@ fn layout_of_uncached<'tcx>( max_repr_align: None, unadjusted_abi_align: dl.i8_align.abi, // another random value - randomization_seed: 0xc1325f37d127be22, + randomization_seed: Hash64::new(0xc1325f37d127be22), }), // Odd unit types. @@ -585,7 +588,7 @@ fn layout_of_uncached<'tcx>( align, max_repr_align: None, unadjusted_abi_align: align.abi, - randomization_seed: e_ly.randomization_seed.wrapping_add(e_len), + randomization_seed: e_ly.randomization_seed.wrapping_add(Hash64::new(e_len)), }) } @@ -1051,7 +1054,7 @@ fn coroutine_layout<'tcx>( }; // this is similar to how ReprOptions populates its field_shuffle_seed - let def_hash = tcx.def_path_hash(def_id).0.to_smaller_hash().as_u64(); + let def_hash = tcx.def_path_hash(def_id).0.to_smaller_hash(); let layout = tcx.mk_layout(LayoutData { variants: Variants::Multiple { |
