Add track_caller to builder.msg

this makes the panics on nested GHA groups more useful
This commit is contained in:
jyn 2023-07-14 17:32:05 -05:00
parent 9851a141a3
commit 3e306c2ddb
3 changed files with 9 additions and 0 deletions

View File

@ -1000,6 +1000,7 @@ impl Build {
}
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_check(
&self,
what: impl Display,
@ -1009,6 +1010,7 @@ impl Build {
}
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_doc(
&self,
compiler: Compiler,
@ -1019,6 +1021,7 @@ impl Build {
}
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_build(
&self,
compiler: Compiler,
@ -1032,6 +1035,7 @@ impl Build {
///
/// [`Step`]: crate::builder::Step
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg(
&self,
action: impl Into<Kind>,
@ -1059,6 +1063,7 @@ impl Build {
///
/// [`Step`]: crate::builder::Step
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_unstaged(
&self,
action: impl Into<Kind>,
@ -1071,6 +1076,7 @@ impl Build {
}
#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_sysroot_tool(
&self,
action: impl Into<Kind>,
@ -1089,6 +1095,7 @@ impl Build {
self.group(&msg)
}
#[track_caller]
fn group(&self, msg: &str) -> Option<gha::Group> {
match self.config.dry_run {
DryRun::SelfCheck => None,

View File

@ -34,6 +34,7 @@ struct ToolBuild {
}
impl Builder<'_> {
#[track_caller]
fn msg_tool(
&self,
mode: Mode,

View File

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