Skip to content

Commit 14c9ccd

Browse files
committed
Make panic! error message GCC compatible
Reorders the output of thread error messages so that the file:line location appears first on the line. For example, this goes from thread 'test_fails' panicked at 'assertion failed: 0 == 1', src/main.rs:34 to src/main.rs:34: thread 'test_fails' panicked at 'assertion failed: 0 == 1' Fixes: rust-lang#25151
1 parent fc45fd9 commit 14c9ccd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/panicking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
4141
Some(mut stderr) => {
4242
// FIXME: what to do when the thread printing panics?
4343
let _ = writeln!(stderr,
44-
"thread '{}' panicked at '{}', {}:{}\n",
45-
name, msg, file, line);
44+
"{}:{}: thread '{}' panicked at '{}'\n",
45+
file, line, name, msg);
4646
if backtrace::log_enabled() {
4747
let _ = backtrace::write(&mut *stderr);
4848
}
@@ -52,8 +52,8 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
5252
});
5353
}
5454
None => {
55-
let _ = writeln!(&mut err, "thread '{}' panicked at '{}', {}:{}",
56-
name, msg, file, line);
55+
let _ = writeln!(&mut err, "{}:{}: thread '{}' panicked at '{}'",
56+
file, line, name, msg);
5757
if backtrace::log_enabled() {
5858
let _ = backtrace::write(&mut err);
5959
}

0 commit comments

Comments
 (0)