Skip to content

Commit ac45719

Browse files
authored
Merge pull request #65491 from guanqun/extend-t-macro
show up some extra info when t!() fails
2 parents b043380 + c716be6 commit ac45719

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ impl Build {
11261126
}
11271127

11281128
let mut paths = Vec::new();
1129-
let contents = t!(fs::read(stamp));
1129+
let contents = t!(fs::read(stamp), &stamp);
11301130
// This is the method we use for extracting paths from the stamp file passed to us. See
11311131
// run_cargo for more information (in compile.rs).
11321132
for part in contents.split(|b| *b == 0) {

src/build_helper/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ macro_rules! t {
2121
Err(e) => panic!("{} failed with {}", stringify!($e), e),
2222
}
2323
};
24+
// it can show extra info in the second parameter
25+
($e:expr, $extra:expr) => {
26+
match $e {
27+
Ok(e) => e,
28+
Err(e) => panic!("{} failed with {} ({:?})", stringify!($e), e, $extra),
29+
}
30+
};
2431
}
2532

2633
// Because Cargo adds the compiler's dylib path to our library search path, llvm-config may

0 commit comments

Comments
 (0)