Skip to content

Commit

Permalink
Rollup merge of rust-lang#65540 - guanqun:extend-t-macro, r=nikomatsakis
Browse files Browse the repository at this point in the history
show up some extra info when t!() fails
  • Loading branch information
Centril authored Oct 18, 2019
2 parents c4f5203 + c716be6 commit b85d26a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ impl Build {
}

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
// run_cargo for more information (in compile.rs).
for part in contents.split(|b| *b == 0) {
Expand Down
7 changes: 7 additions & 0 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ macro_rules! t {
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
Expand Down

0 comments on commit b85d26a

Please sign in to comment.