Skip to content

Commit

Permalink
Remove redundant "randomize" feature gate.
Browse files Browse the repository at this point in the history
It comes immediately after another gate.
  • Loading branch information
nnethercote committed Oct 1, 2023
1 parent 2369adc commit 11053d8
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,16 +871,12 @@ fn univariant(
// the field ordering to try and catch some code making assumptions about layouts
// we don't guarantee.
if repr.can_randomize_type_layout() && cfg!(feature = "randomize") {
#[cfg(feature = "randomize")]
{
// `ReprOptions.layout_seed` is a deterministic seed we can use to randomize field
// ordering.
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed.as_u64());

// Shuffle the ordering of the fields.
optimizing.shuffle(&mut rng);
}
// Otherwise we just leave things alone and actually optimize the type's fields
// `ReprOptions.layout_seed` is a deterministic seed we can use to randomize field
// ordering.
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed.as_u64());

// Shuffle the ordering of the fields.
optimizing.shuffle(&mut rng);
} else {
// To allow unsizing `&Foo<Type>` -> `&Foo<dyn Trait>`, the layout of the struct must
// not depend on the layout of the tail.
Expand Down

0 comments on commit 11053d8

Please sign in to comment.