Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
11cfc16
mir-opt: Use one MirPatch in MatchBranchSimplification
dianqk Apr 20, 2025
5881b7c
mir-opt: execute MatchBranchSimplification after GVN
dianqk Apr 21, 2025
8290766
bypass linker configuration and cross target check on `x check`
onur-ozkan Apr 27, 2025
7669d50
add a FIXME
onur-ozkan Apr 28, 2025
6970813
Use less rustc_type_ir in the compiler codebase
rperier May 1, 2025
d0216b5
`fn check_opaque_type_parameter_valid` defer error
lcnr May 3, 2025
de44231
implement `PanicTracker` to track `t` panics
onur-ozkan May 4, 2025
a8f7fd1
update `cc_detect` tests
onur-ozkan May 5, 2025
4b58c50
Make -Zfixed-x18 into a target modifier
Darksonn May 5, 2025
3a1ee64
Resolve instance for SymFn in global/naked asm
compiler-errors Apr 27, 2025
833c212
Rename Instance::new to Instance::new_raw and add a note that it is raw
compiler-errors Apr 28, 2025
29f9aaf
calculate step duration in a panic-safe way
onur-ozkan May 5, 2025
12d3021
Deeply normalize in the new solver in WF
compiler-errors May 5, 2025
8723871
Update books
rustbot May 5, 2025
677a5ac
Rollup merge of #140080 - dianqk:one-mirpatch, r=oli-obk
GuillaumeGomez May 5, 2025
ab7623e
Rollup merge of #140115 - dianqk:gvn-matchbr, r=oli-obk
GuillaumeGomez May 5, 2025
246acdb
Rollup merge of #140357 - onur-ozkan:133840, r=clubby789
GuillaumeGomez May 5, 2025
1e90557
Rollup merge of #140374 - compiler-errors:global_asm-bug, r=lcnr
GuillaumeGomez May 5, 2025
224e3ca
Rollup merge of #140559 - rperier:type-ir-to-type-middle, r=compiler-…
GuillaumeGomez May 5, 2025
1c801a3
Rollup merge of #140605 - lcnr:defer-opaque-type-error, r=compiler-er…
GuillaumeGomez May 5, 2025
6cee5bf
Rollup merge of #140636 - onur-ozkan:panic-tracker-for-t-macro, r=Kobzol
GuillaumeGomez May 5, 2025
0d7067d
Rollup merge of #140661 - Darksonn:fixedx18-tm, r=wesleywiser
GuillaumeGomez May 5, 2025
5822dd6
Rollup merge of #140670 - onur-ozkan:129959, r=Kobzol
GuillaumeGomez May 5, 2025
bdbf1c6
Rollup merge of #140672 - compiler-errors:deeply-normalize, r=lcnr
GuillaumeGomez May 5, 2025
2a882f7
Rollup merge of #140676 - rustbot:docs-update, r=ehuss
GuillaumeGomez May 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implement PanicTracker to track t panics
Trying to understand panics triggered by `t` macro calls is very exhausting (especially on CI failures)
because it doesn't provide any information about where the macro was originally invoked. This change adds
that missing information when an inner call inside the `t` macro panics.

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed May 4, 2025
commit de44231d22eea1d1d27fab8d020557323996bb52
1 change: 1 addition & 0 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use tracing::{instrument, span};
pub use utils::change_tracker::{
CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes,
};
pub use utils::helpers::PanicTracker;

use crate::core::build_steps::vendor::VENDOR_DIR;

Expand Down
30 changes: 25 additions & 5 deletions src/bootstrap/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::sync::OnceLock;
use std::thread::panicking;
use std::time::{Instant, SystemTime, UNIX_EPOCH};
use std::{env, fs, io, str};
use std::{env, fs, io, panic, str};

use build_helper::util::fail;
use object::read::archive::ArchiveFile;
Expand All @@ -22,6 +23,23 @@ pub use crate::utils::shared_helpers::{dylib_path, dylib_path_var};
#[cfg(test)]
mod tests;

/// A wrapper around `std::panic::Location` used to track the location of panics
/// triggered by `t` macro usage.
pub struct PanicTracker<'a>(pub &'a panic::Location<'a>);

impl Drop for PanicTracker<'_> {
fn drop(&mut self) {
if panicking() {
eprintln!(
"Panic was initiated from {}:{}:{}",
self.0.file(),
self.0.line(),
self.0.column()
);
}
}
}

/// A helper macro to `unwrap` a result except also print out details like:
///
/// * The file/line of the panic
Expand All @@ -32,19 +50,21 @@ mod tests;
/// using a `Result` with `try!`, but this may change one day...
#[macro_export]
macro_rules! t {
($e:expr) => {
($e:expr) => {{
let _panic_guard = $crate::PanicTracker(std::panic::Location::caller());
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {}", stringify!($e), e),
}
};
}};
// it can show extra info in the second parameter
($e:expr, $extra:expr) => {
($e:expr, $extra:expr) => {{
let _panic_guard = $crate::PanicTracker(std::panic::Location::caller());
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {} ({:?})", stringify!($e), e, $extra),
}
};
}};
}

pub use t;
Expand Down
Loading