From e9ce9ff498140ac257f35f163e9dfd52e96191cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 15 Aug 2025 16:52:30 +0200 Subject: [PATCH] Fix tracing debug representation of steps without arguments in bootstrap --- src/bootstrap/src/core/builder/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 6226c81a3fdb7..ebbb19e9f87d2 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() -> String { /// Renders `step` using its `Debug` implementation and extract the field arguments out of it. fn step_debug_args(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(step: &S) -> String {