show up some extra info when t!() fails

This commit is contained in:
Guanqun Lu 2019-10-17 16:57:46 +08:00
parent 237d54ff6c
commit c716be6874
2 changed files with 8 additions and 1 deletions

View file

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

View file

@ -21,6 +21,13 @@ macro_rules! t {
Err(e) => panic!("{} failed with {}", stringify!($e), e), Err(e) => panic!("{} failed with {}", stringify!($e), e),
} }
}; };
// it can show extra info in the second parameter
($e:expr, $extra:expr) => {
match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {} ({:?})", stringify!($e), e, $extra),
}
};
} }
// Because Cargo adds the compiler's dylib path to our library search path, llvm-config may // Because Cargo adds the compiler's dylib path to our library search path, llvm-config may