Skip to content

Commit

Permalink
Debug-print error when using rtunwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Jethro Beekman committed Apr 23, 2019
1 parent fe0a415 commit 942831e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/libstd/sys_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ macro_rules! rtassert {

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

Expand Down

0 comments on commit 942831e

Please sign in to comment.