about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2024-03-05 12:50:14 -0500
committerAntoni Boucher <bouanto@zoho.com>2024-03-05 12:53:40 -0500
commit3b4c58d7f570f2db6a35e5a3d90167cfada02dd3 (patch)
tree0f7051abf094d8ffe70a1af7b1211091bff89fd8
parent86a2bb760c729fe620a45f35fb55e89abeacfc40 (diff)
downloadrust-3b4c58d7f570f2db6a35e5a3d90167cfada02dd3.tar.gz
rust-3b4c58d7f570f2db6a35e5a3d90167cfada02dd3.zip
Fix rand tests
-rw-r--r--build_system/src/prepare.rs26
-rw-r--r--patches/crates/0001-Remove-deny-warnings.patch24
2 files changed, 50 insertions, 0 deletions
diff --git a/build_system/src/prepare.rs b/build_system/src/prepare.rs
index 4ea334ad8b9..821c793c7e5 100644
--- a/build_system/src/prepare.rs
+++ b/build_system/src/prepare.rs
@@ -131,6 +131,30 @@ fn prepare_libcore(
         )?;
     }
     println!("Successfully prepared libcore for building");
+
+    Ok(())
+}
+
+// TODO: remove when we can ignore warnings in rustdoc tests.
+fn prepare_rand() -> Result<(), String> {
+    // Apply patch for the rand crate.
+    let file_path = "patches/crates/0001-Remove-deny-warnings.patch";
+    let rand_dir = Path::new("build/rand");
+    println!("[GIT] apply `{}`", file_path);
+    let path = Path::new("../..").join(file_path);
+    run_command_with_output(&[&"git", &"apply", &path], Some(rand_dir))?;
+    run_command_with_output(&[&"git", &"add", &"-A"], Some(rand_dir))?;
+    run_command_with_output(
+        &[
+            &"git",
+            &"commit",
+            &"--no-gpg-sign",
+            &"-m",
+            &format!("Patch {}", path.display()),
+        ],
+        Some(rand_dir),
+    )?;
+
     Ok(())
 }
 
@@ -241,6 +265,8 @@ pub fn run() -> Result<(), String> {
         for (repo_url, checkout_commit, cb) in to_clone {
             clone_and_setup(repo_url, checkout_commit, *cb)?;
         }
+
+        prepare_rand()?;
     }
 
     println!("Successfully ran `prepare`");
diff --git a/patches/crates/0001-Remove-deny-warnings.patch b/patches/crates/0001-Remove-deny-warnings.patch
new file mode 100644
index 00000000000..66ea1df4e13
--- /dev/null
+++ b/patches/crates/0001-Remove-deny-warnings.patch
@@ -0,0 +1,24 @@
+From f4a31d2c57cdbd578b778ab70eb2a0cfb248652c Mon Sep 17 00:00:00 2001
+From: Antoni Boucher <bouanto@zoho.com>
+Date: Tue, 5 Mar 2024 12:39:44 -0500
+Subject: [PATCH] Remove #[deny(warnings)]
+
+---
+ src/lib.rs | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/lib.rs b/src/lib.rs
+index 8ade2881d5..e26c595e38 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -47,7 +47,6 @@
+ )]
+ #![deny(missing_docs)]
+ #![deny(missing_debug_implementations)]
+-#![doc(test(attr(allow(unused_variables), deny(warnings))))]
+ #![no_std]
+ #![cfg_attr(feature = "simd_support", feature(stdsimd, portable_simd))]
+ #![cfg_attr(doc_cfg, feature(doc_cfg))]
+-- 
+2.44.0
+