about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-15 18:13:31 -0400
committerGitHub <noreply@github.com>2025-08-15 18:13:31 -0400
commit4fa90ef7996f891f7f1e126411e5d75afe64accf (patch)
tree48c2e551ff924c64e568c6a2bf68172850cc615e
parent71adb87994f89423576723d3c4849a37c0722469 (diff)
parente9ce9ff498140ac257f35f163e9dfd52e96191cb (diff)
downloadrust-4fa90ef7996f891f7f1e126411e5d75afe64accf.tar.gz
rust-4fa90ef7996f891f7f1e126411e5d75afe64accf.zip
Rollup merge of #145454 - Kobzol:bootstrap-fix-step-debug-repr, r=jieyouxu
Fix tracing debug representation of steps without arguments in bootstrap

I was wondering why I see `lainSourceTarbal` in tracing logs...

r? `@jieyouxu`
-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 2b521debd84..043cb1c2666 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -1840,9 +1840,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 {