Skip to content

Commit 3e306c2

Browse files
committed
Add track_caller to builder.msg
this makes the panics on nested GHA groups more useful
1 parent 9851a14 commit 3e306c2

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/bootstrap/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ impl Build {
10001000
}
10011001

10021002
#[must_use = "Groups should not be dropped until the Step finishes running"]
1003+
#[track_caller]
10031004
fn msg_check(
10041005
&self,
10051006
what: impl Display,
@@ -1009,6 +1010,7 @@ impl Build {
10091010
}
10101011

10111012
#[must_use = "Groups should not be dropped until the Step finishes running"]
1013+
#[track_caller]
10121014
fn msg_doc(
10131015
&self,
10141016
compiler: Compiler,
@@ -1019,6 +1021,7 @@ impl Build {
10191021
}
10201022

10211023
#[must_use = "Groups should not be dropped until the Step finishes running"]
1024+
#[track_caller]
10221025
fn msg_build(
10231026
&self,
10241027
compiler: Compiler,
@@ -1032,6 +1035,7 @@ impl Build {
10321035
///
10331036
/// [`Step`]: crate::builder::Step
10341037
#[must_use = "Groups should not be dropped until the Step finishes running"]
1038+
#[track_caller]
10351039
fn msg(
10361040
&self,
10371041
action: impl Into<Kind>,
@@ -1059,6 +1063,7 @@ impl Build {
10591063
///
10601064
/// [`Step`]: crate::builder::Step
10611065
#[must_use = "Groups should not be dropped until the Step finishes running"]
1066+
#[track_caller]
10621067
fn msg_unstaged(
10631068
&self,
10641069
action: impl Into<Kind>,
@@ -1071,6 +1076,7 @@ impl Build {
10711076
}
10721077

10731078
#[must_use = "Groups should not be dropped until the Step finishes running"]
1079+
#[track_caller]
10741080
fn msg_sysroot_tool(
10751081
&self,
10761082
action: impl Into<Kind>,
@@ -1089,6 +1095,7 @@ impl Build {
10891095
self.group(&msg)
10901096
}
10911097

1098+
#[track_caller]
10921099
fn group(&self, msg: &str) -> Option<gha::Group> {
10931100
match self.config.dry_run {
10941101
DryRun::SelfCheck => None,

src/bootstrap/tool.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct ToolBuild {
3434
}
3535

3636
impl Builder<'_> {
37+
#[track_caller]
3738
fn msg_tool(
3839
&self,
3940
mode: Mode,

src/tools/build_helper/src/ci.rs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub mod gha {
4343
/// All github actions log messages from this call to the Drop of the return value
4444
/// will be grouped and hidden by default in logs. Note that nesting these does
4545
/// not really work.
46+
#[track_caller]
4647
pub fn group(name: impl std::fmt::Display) -> Group {
4748
if std::env::var_os("GITHUB_ACTIONS").is_some() {
4849
eprintln!("::group::{name}");

0 commit comments

Comments
 (0)