about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <jakub.beranek@vsb.cz>2024-07-04 15:47:30 +0200
committerJakub Beránek <berykubik@gmail.com>2024-07-12 20:14:37 +0200
commit97990a475928cb7428ed945342cec70a4e19c3b2 (patch)
treee432c35f5691281fc41102173e8944ea5a35ccdf
parent5d76a13bbedebd773b4960432bff14f40acf3840 (diff)
downloadrust-97990a475928cb7428ed945342cec70a4e19c3b2.tar.gz
rust-97990a475928cb7428ed945342cec70a4e19c3b2.zip
Move `DropBomb` from `run-make-support` to `build_helper`
So that it can be also used in bootstrap.
-rw-r--r--Cargo.lock1
-rw-r--r--src/tools/build_helper/src/drop_bomb/mod.rs (renamed from src/tools/run-make-support/src/drop_bomb/mod.rs)8
-rw-r--r--src/tools/build_helper/src/drop_bomb/tests.rs (renamed from src/tools/run-make-support/src/drop_bomb/tests.rs)0
-rw-r--r--src/tools/build_helper/src/lib.rs1
-rw-r--r--src/tools/run-make-support/Cargo.toml2
-rw-r--r--src/tools/run-make-support/src/command.rs2
-rw-r--r--src/tools/run-make-support/src/diff/mod.rs2
-rw-r--r--src/tools/run-make-support/src/lib.rs1
8 files changed, 10 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index eba4eed3686..cafc623c185 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3420,6 +3420,7 @@ version = "0.2.0"
 dependencies = [
  "ar",
  "bstr",
+ "build_helper",
  "gimli 0.28.1",
  "object 0.34.0",
  "regex",
diff --git a/src/tools/run-make-support/src/drop_bomb/mod.rs b/src/tools/build_helper/src/drop_bomb/mod.rs
index 2fc84892c1b..ffb86d1c9ee 100644
--- a/src/tools/run-make-support/src/drop_bomb/mod.rs
+++ b/src/tools/build_helper/src/drop_bomb/mod.rs
@@ -12,7 +12,7 @@ use std::panic;
 mod tests;
 
 #[derive(Debug)]
-pub(crate) struct DropBomb {
+pub struct DropBomb {
     command: OsString,
     defused: bool,
     armed_line: u32,
@@ -21,9 +21,9 @@ pub(crate) struct DropBomb {
 impl DropBomb {
     /// Arm a [`DropBomb`]. If the value is dropped without being [`defused`][Self::defused], then
     /// it will panic. It is expected that the command wrapper uses `#[track_caller]` to help
-    /// propagate the caller info from rmake.rs.
+    /// propagate the caller location.
     #[track_caller]
-    pub(crate) fn arm<S: AsRef<OsStr>>(command: S) -> DropBomb {
+    pub fn arm<S: AsRef<OsStr>>(command: S) -> DropBomb {
         DropBomb {
             command: command.as_ref().into(),
             defused: false,
@@ -32,7 +32,7 @@ impl DropBomb {
     }
 
     /// Defuse the [`DropBomb`]. This will prevent the drop bomb from panicking when dropped.
-    pub(crate) fn defuse(&mut self) {
+    pub fn defuse(&mut self) {
         self.defused = true;
     }
 }
diff --git a/src/tools/run-make-support/src/drop_bomb/tests.rs b/src/tools/build_helper/src/drop_bomb/tests.rs
index 4a488c0f670..4a488c0f670 100644
--- a/src/tools/run-make-support/src/drop_bomb/tests.rs
+++ b/src/tools/build_helper/src/drop_bomb/tests.rs
diff --git a/src/tools/build_helper/src/lib.rs b/src/tools/build_helper/src/lib.rs
index 15807d1c0d8..4a4f0ca2a9d 100644
--- a/src/tools/build_helper/src/lib.rs
+++ b/src/tools/build_helper/src/lib.rs
@@ -1,6 +1,7 @@
 //! Types and functions shared across tools in this workspace.
 
 pub mod ci;
+pub mod drop_bomb;
 pub mod git;
 pub mod metrics;
 pub mod stage0_parser;
diff --git a/src/tools/run-make-support/Cargo.toml b/src/tools/run-make-support/Cargo.toml
index ec3b8a96ef3..969552dec84 100644
--- a/src/tools/run-make-support/Cargo.toml
+++ b/src/tools/run-make-support/Cargo.toml
@@ -11,3 +11,5 @@ wasmparser = "0.118.2"
 regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
 gimli = "0.28.1"
 ar = "0.9.0"
+
+build_helper = { path = "../build_helper" }
diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs
index c506c3d6b61..5017a4b88da 100644
--- a/src/tools/run-make-support/src/command.rs
+++ b/src/tools/run-make-support/src/command.rs
@@ -5,8 +5,8 @@ use std::panic;
 use std::path::Path;
 use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
 
-use crate::drop_bomb::DropBomb;
 use crate::{assert_contains, assert_equals, assert_not_contains, handle_failed_output};
+use build_helper::drop_bomb::DropBomb;
 
 /// This is a custom command wrapper that simplifies working with commands and makes it easier to
 /// ensure that we check the exit status of executed processes.
diff --git a/src/tools/run-make-support/src/diff/mod.rs b/src/tools/run-make-support/src/diff/mod.rs
index 24fa88af82e..ad989b74e4d 100644
--- a/src/tools/run-make-support/src/diff/mod.rs
+++ b/src/tools/run-make-support/src/diff/mod.rs
@@ -2,8 +2,8 @@ use regex::Regex;
 use similar::TextDiff;
 use std::path::{Path, PathBuf};
 
-use crate::drop_bomb::DropBomb;
 use crate::fs_wrapper;
+use build_helper::drop_bomb::DropBomb;
 
 #[cfg(test)]
 mod tests;
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 5655318267a..cb61aa7516d 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -7,7 +7,6 @@ pub mod cc;
 pub mod clang;
 mod command;
 pub mod diff;
-mod drop_bomb;
 pub mod fs_wrapper;
 pub mod llvm;
 pub mod run;