From 3e306c2ddb743491147e0a36fc531692d9c0d30d Mon Sep 17 00:00:00 2001 From: jyn Date: Fri, 14 Jul 2023 17:32:05 -0500 Subject: [PATCH] Add `track_caller` to builder.msg this makes the panics on nested GHA groups more useful --- src/bootstrap/lib.rs | 7 +++++++ src/bootstrap/tool.rs | 1 + src/tools/build_helper/src/ci.rs | 1 + 3 files changed, 9 insertions(+) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 7ffd1e1f9c5..32b66973567 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -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, @@ -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, @@ -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, @@ -1089,6 +1095,7 @@ impl Build { self.group(&msg) } + #[track_caller] fn group(&self, msg: &str) -> Option { match self.config.dry_run { DryRun::SelfCheck => None, diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 915dceae389..8b3e8ca9b90 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -34,6 +34,7 @@ struct ToolBuild { } impl Builder<'_> { + #[track_caller] fn msg_tool( &self, mode: Mode, diff --git a/src/tools/build_helper/src/ci.rs b/src/tools/build_helper/src/ci.rs index 08bc861fd21..b70ea5ec113 100644 --- a/src/tools/build_helper/src/ci.rs +++ b/src/tools/build_helper/src/ci.rs @@ -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}");