Skip to content

Commit 942831e

Browse files
author
Jethro Beekman
committed
Debug-print error when using rtunwrap
1 parent fe0a415 commit 942831e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libstd/sys_common/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ macro_rules! rtassert {
3030

3131
#[allow(unused_macros)] // not used on all platforms
3232
macro_rules! rtunwrap {
33-
($ok:ident, $e:expr) => (if let $ok(v) = $e {
34-
v
35-
} else {
36-
rtabort!(concat!("unwrap failed: ", stringify!($e)));
33+
($ok:ident, $e:expr) => (match $e {
34+
$ok(v) => v,
35+
ref err => {
36+
let err = err.as_ref().map(|_|()); // map Ok/Some which might not be Debug
37+
rtabort!(concat!("unwrap failed: ", stringify!($e), " = {:?}"), err)
38+
},
3739
})
3840
}
3941

0 commit comments

Comments
 (0)