Make the randomize feature of rustc_abi additive
This commit is contained in:
parent
a42d94ebb8
commit
c8a25eddfe
4 changed files with 7 additions and 9 deletions
|
@ -906,9 +906,8 @@ fn univariant<
|
|||
use rand::{seq::SliceRandom, SeedableRng};
|
||||
// `ReprOptions.layout_seed` is a deterministic seed we can use to randomize field
|
||||
// ordering.
|
||||
let mut rng = rand_xoshiro::Xoshiro128StarStar::seed_from_u64(
|
||||
repr.field_shuffle_seed.as_u64(),
|
||||
);
|
||||
let mut rng =
|
||||
rand_xoshiro::Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);
|
||||
|
||||
// Shuffle the ordering of the fields.
|
||||
optimizing.shuffle(&mut rng);
|
||||
|
|
|
@ -76,15 +76,14 @@ pub struct ReprOptions {
|
|||
pub align: Option<Align>,
|
||||
pub pack: Option<Align>,
|
||||
pub flags: ReprFlags,
|
||||
#[cfg(feature = "randomize")]
|
||||
/// The seed to be used for randomizing a type's layout
|
||||
///
|
||||
/// Note: This could technically be a `Hash128` which would
|
||||
/// Note: This could technically be a `u128` which would
|
||||
/// be the "most accurate" hash as it'd encompass the item and crate
|
||||
/// hash without loss, but it does pay the price of being larger.
|
||||
/// Everything's a tradeoff, a 64-bit seed should be sufficient for our
|
||||
/// purposes (primarily `-Z randomize-layout`)
|
||||
pub field_shuffle_seed: rustc_data_structures::stable_hasher::Hash64,
|
||||
pub field_shuffle_seed: u64,
|
||||
}
|
||||
|
||||
impl ReprOptions {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue