about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-08-15 16:52:30 +0200
committerJakub Beránek <berykubik@gmail.com>2025-08-15 16:54:13 +0200
commite9ce9ff498140ac257f35f163e9dfd52e96191cb (patch)
tree48454563e71b71ad371c57f3906e290da69c1d5c /src/bootstrap
parent8800ec16657b24ad8a2f443c133bf0b56ae76033 (diff)
downloadrust-e9ce9ff498140ac257f35f163e9dfd52e96191cb.tar.gz
rust-e9ce9ff498140ac257f35f163e9dfd52e96191cb.zip
Fix tracing debug representation of steps without arguments in bootstrap
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/builder/mod.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
index 6226c81a3fd..ebbb19e9f87 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -1839,9 +1839,14 @@ pub fn pretty_step_name<S: Step>() -> String {
 /// Renders `step` using its `Debug` implementation and extract the field arguments out of it.
 fn step_debug_args<S: Step>(step: &S) -> String {
     let step_dbg_repr = format!("{step:?}");
-    let brace_start = step_dbg_repr.find('{').unwrap_or(0);
-    let brace_end = step_dbg_repr.rfind('}').unwrap_or(step_dbg_repr.len());
-    step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
+
+    // Some steps do not have any arguments, so they do not have the braces
+    match (step_dbg_repr.find('{'), step_dbg_repr.rfind('}')) {
+        (Some(brace_start), Some(brace_end)) => {
+            step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
+        }
+        _ => String::new(),
+    }
 }
 
 fn pretty_print_step<S: Step>(step: &S) -> String {