Skip to content

Commit c8f2f75

Browse files
committed
when -Zrandomize-layout is enabled disable alloc test testing internal struct sizes
1 parent 7d05966 commit c8f2f75

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

library/alloc/src/collections/btree/node/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ fn test_partial_eq() {
9494

9595
#[test]
9696
#[cfg(target_arch = "x86_64")]
97+
#[cfg(not(randomized_layouts))]
9798
fn test_sizes() {
9899
assert_eq!(core::mem::size_of::<LeafNode<(), ()>>(), 16);
99100
assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 2 * 8);

src/bootstrap/compile.rs

+2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
297297
cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
298298
}
299299

300+
cargo.rustflag("--cfg").rustflag("randomized_layouts");
301+
300302
// Determine if we're going to compile in optimized C intrinsics to
301303
// the `compiler-builtins` crate. These intrinsics live in LLVM's
302304
// `compiler-rt` repository, but our `src/llvm-project` submodule isn't

src/bootstrap/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
194194
(None, "bootstrap", None),
195195
(Some(Mode::Rustc), "parallel_compiler", None),
196196
(Some(Mode::ToolRustc), "parallel_compiler", None),
197+
(Some(Mode::Std), "randomized_layouts", None),
197198
(Some(Mode::Std), "stdarch_intel_sde", None),
198199
(Some(Mode::Std), "no_fp_fmt_parse", None),
199200
(Some(Mode::Std), "no_global_oom_handling", None),

0 commit comments

Comments
 (0)