Skip to content

Commit 4fa90ef

Browse files
authored
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`
2 parents 71adb87 + e9ce9ff commit 4fa90ef

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
@@ -1840,9 +1840,14 @@ pub fn pretty_step_name<S: Step>() -> String {
18401840
/// Renders `step` using its `Debug` implementation and extract the field arguments out of it.
18411841
fn step_debug_args<S: Step>(step: &S) -> String {
18421842
let step_dbg_repr = format!("{step:?}");
1843-
let brace_start = step_dbg_repr.find('{').unwrap_or(0);
1844-
let brace_end = step_dbg_repr.rfind('}').unwrap_or(step_dbg_repr.len());
1845-
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
1843+
1844+
// Some steps do not have any arguments, so they do not have the braces
1845+
match (step_dbg_repr.find('{'), step_dbg_repr.rfind('}')) {
1846+
(Some(brace_start), Some(brace_end)) => {
1847+
step_dbg_repr[brace_start + 1..brace_end - 1].trim().to_string()
1848+
}
1849+
_ => String::new(),
1850+
}
18461851
}
18471852

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

0 commit comments

Comments
 (0)