Skip to content

Commit e9ce9ff

Browse files
committed
Fix tracing debug representation of steps without arguments in bootstrap
1 parent 8800ec1 commit e9ce9ff

File tree

1 file changed

+8
-3
lines changed
  • src/bootstrap/src/core/builder

1 file changed

+8
-3
lines changed

src/bootstrap/src/core/builder/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,9 +1839,14 @@ pub fn pretty_step_name<S: Step>() -> String {
18391839
/// Renders `step` using its `Debug` implementation and extract the field arguments out of it.
18401840
fn step_debug_args<S: Step>(step: &S) -> String {
18411841
let step_dbg_repr = format!("{step:?}");
1842-
let brace_start = step_dbg_repr.find('{').unwrap_or(0);
1843-
let brace_end = step_dbg_repr.rfind('}').unwrap_or(step_dbg_repr.len());
1844-
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
1842+
1843+
// Some steps do not have any arguments, so they do not have the braces
1844+
match (step_dbg_repr.find('{'), step_dbg_repr.rfind('}')) {
1845+
(Some(brace_start), Some(brace_end)) => {
1846+
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
1847+
}
1848+
_ => String::new(),
1849+
}
18451850
}
18461851

18471852
fn pretty_print_step<S: Step>(step: &S) -> String {

0 commit comments

Comments
 (0)