From fde54c2c0301be851543220ce64c74a468a17311 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:30:01 +0000 Subject: [PATCH] Fix testing with randomized layouts enabled --- compiler/rustc_codegen_cranelift/build_system/tests.rs | 4 +++- library/alloc/Cargo.toml | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/build_system/tests.rs b/compiler/rustc_codegen_cranelift/build_system/tests.rs index eb15a3fc027..eec89c026b2 100644 --- a/compiler/rustc_codegen_cranelift/build_system/tests.rs +++ b/compiler/rustc_codegen_cranelift/build_system/tests.rs @@ -109,10 +109,12 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[ SYSROOT_TESTS.clean(&runner.dirs); + let mut target_compiler = runner.target_compiler.clone(); // coretests and alloctests produce a bunch of warnings. When running // in rust's CI warnings are denied, so we have to override that here. - let mut target_compiler = runner.target_compiler.clone(); target_compiler.rustflags.push("--cap-lints=allow".to_owned()); + // The standard library may have been compiled with -Zrandomize-layout. + target_compiler.rustflags.extend(["--cfg".to_owned(), "randomized_layouts".to_owned()]); if runner.is_native { let mut test_cmd = SYSROOT_TESTS.test(&target_compiler, &runner.dirs); diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index b729d5e116d..1d2dd1e6081 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -36,5 +36,4 @@ check-cfg = [ 'cfg(no_global_oom_handling)', 'cfg(no_rc)', 'cfg(no_sync)', - 'cfg(randomized_layouts)', ]