Auto merge of #12733 - nox:panic-location, r=jdm

Print thread name and file location when panicking

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12733)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-04 10:02:42 -05:00 committed by GitHub
commit aced80b56d

View file

@ -41,6 +41,7 @@ use servo::util::servo_version;
use std::panic;
use std::process;
use std::rc::Rc;
use std::thread;
pub mod platform {
#[cfg(target_os = "macos")]
@ -107,7 +108,13 @@ fn main() {
None => "Box<Any>",
},
};
error!("{}", msg);
let current_thread = thread::current();
let name = current_thread.name().unwrap_or("<unnamed>");
if let Some(location) = info.location() {
error!("{} (thread {}, at {}:{})", msg, name, location.file(), location.line());
} else {
error!("{} (thread {})", msg, name);
}
}));
setup_logging();