Skip to content

Commit 7a23019

Browse files
committed
Move DropBomb from run-make-support to build_helper
So that it can be also used in bootstrap.
1 parent 35e6e4c commit 7a23019

File tree

8 files changed

+10
-7
lines changed

8 files changed

+10
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,6 +3420,7 @@ version = "0.2.0"
34203420
dependencies = [
34213421
"ar",
34223422
"bstr",
3423+
"build_helper",
34233424
"gimli 0.28.1",
34243425
"object 0.34.0",
34253426
"regex",

src/tools/run-make-support/src/drop_bomb/mod.rs renamed to src/tools/build_helper/src/drop_bomb/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::panic;
1212
mod tests;
1313

1414
#[derive(Debug)]
15-
pub(crate) struct DropBomb {
15+
pub struct DropBomb {
1616
command: OsString,
1717
defused: bool,
1818
armed_line: u32,
@@ -21,9 +21,9 @@ pub(crate) struct DropBomb {
2121
impl DropBomb {
2222
/// Arm a [`DropBomb`]. If the value is dropped without being [`defused`][Self::defused], then
2323
/// it will panic. It is expected that the command wrapper uses `#[track_caller]` to help
24-
/// propagate the caller info from rmake.rs.
24+
/// propagate the caller location.
2525
#[track_caller]
26-
pub(crate) fn arm<S: AsRef<OsStr>>(command: S) -> DropBomb {
26+
pub fn arm<S: AsRef<OsStr>>(command: S) -> DropBomb {
2727
DropBomb {
2828
command: command.as_ref().into(),
2929
defused: false,
@@ -32,7 +32,7 @@ impl DropBomb {
3232
}
3333

3434
/// Defuse the [`DropBomb`]. This will prevent the drop bomb from panicking when dropped.
35-
pub(crate) fn defuse(&mut self) {
35+
pub fn defuse(&mut self) {
3636
self.defused = true;
3737
}
3838
}

src/tools/build_helper/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Types and functions shared across tools in this workspace.
22
33
pub mod ci;
4+
pub mod drop_bomb;
45
pub mod git;
56
pub mod metrics;
67
pub mod stage0_parser;

src/tools/run-make-support/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ wasmparser = "0.118.2"
1111
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
1212
gimli = "0.28.1"
1313
ar = "0.9.0"
14+
15+
build_helper = { path = "../build_helper" }

src/tools/run-make-support/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::panic;
55
use std::path::Path;
66
use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
77

8-
use crate::drop_bomb::DropBomb;
98
use crate::{assert_contains, assert_equals, assert_not_contains, handle_failed_output};
9+
use build_helper::drop_bomb::DropBomb;
1010

1111
/// This is a custom command wrapper that simplifies working with commands and makes it easier to
1212
/// ensure that we check the exit status of executed processes.

src/tools/run-make-support/src/diff/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use regex::Regex;
22
use similar::TextDiff;
33
use std::path::{Path, PathBuf};
44

5-
use crate::drop_bomb::DropBomb;
65
use crate::fs_wrapper;
6+
use build_helper::drop_bomb::DropBomb;
77

88
#[cfg(test)]
99
mod tests;

src/tools/run-make-support/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub mod cc;
77
pub mod clang;
88
mod command;
99
pub mod diff;
10-
mod drop_bomb;
1110
pub mod fs_wrapper;
1211
pub mod llvm;
1312
pub mod run;

0 commit comments

Comments
 (0)