Skip to content

Commit 2af02ab

Browse files
committed
Minor cleanup
1 parent 2b46c7c commit 2af02ab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler/rustc_middle/src/ty/layout.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,6 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
347347

348348
let mut inverse_memory_index: Vec<u32> = (0..fields.len() as u32).collect();
349349

350-
// `ReprOptions.layout_seed` is a deterministic seed that we can use to
351-
// randomize field ordering with
352-
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);
353-
354350
let optimize = !repr.inhibit_struct_field_reordering_opt();
355351
if optimize {
356352
let end =
@@ -364,6 +360,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
364360
// the field ordering to try and catch some code making assumptions about layouts
365361
// we don't guarantee
366362
if repr.can_randomize_type_layout() {
363+
// `ReprOptions.layout_seed` is a deterministic seed that we can use to
364+
// randomize field ordering with
365+
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);
366+
367367
// Shuffle the ordering of the fields
368368
optimizing.shuffle(&mut rng);
369369

compiler/rustc_middle/src/ty/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1608,9 +1608,9 @@ bitflags! {
16081608
// the seed stored in `ReprOptions.layout_seed`
16091609
const RANDOMIZE_LAYOUT = 1 << 5;
16101610
// Any of these flags being set prevent field reordering optimisation.
1611-
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits |
1612-
ReprFlags::IS_SIMD.bits |
1613-
ReprFlags::IS_LINEAR.bits;
1611+
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits
1612+
| ReprFlags::IS_SIMD.bits
1613+
| ReprFlags::IS_LINEAR.bits;
16141614
}
16151615
}
16161616

0 commit comments

Comments
 (0)