about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-04-03 15:30:01 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-04-03 15:30:01 +0000
commitfde54c2c0301be851543220ce64c74a468a17311 (patch)
treee172faefe15160cb6f61a82bb70e0f96df11c834
parent13970949d135f3b0e1b9ece433c5fc230804d657 (diff)
downloadrust-fde54c2c0301be851543220ce64c74a468a17311.tar.gz
rust-fde54c2c0301be851543220ce64c74a468a17311.zip
Fix testing with randomized layouts enabled
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/tests.rs4
-rw-r--r--library/alloc/Cargo.toml1
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)',
 ]