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
commite3a8d9c6a3ed67948cded5a3cbef65c15fd6b180 (patch)
tree65695b4c927676ad20a2989014fc4e9198b35dc0
parentbb2b3d04c31648ebd737b0ebc47b9d90fc3b777a (diff)
downloadrust-e3a8d9c6a3ed67948cded5a3cbef65c15fd6b180.tar.gz
rust-e3a8d9c6a3ed67948cded5a3cbef65c15fd6b180.zip
Fix testing with randomized layouts enabled
-rw-r--r--build_system/tests.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/build_system/tests.rs b/build_system/tests.rs
index eb15a3fc027..eec89c026b2 100644
--- a/build_system/tests.rs
+++ b/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);