core: Implement and export the try! macro
This is used quite extensively by core::fmt
This commit is contained in:
parent
f2af4ca3e6
commit
27d8ea05a2
@ -59,3 +59,9 @@ macro_rules! assert(
|
||||
macro_rules! debug_assert(
|
||||
($($arg:tt)*) => (if cfg!(not(ndebug)) { assert!($($arg)*); })
|
||||
)
|
||||
|
||||
/// Short circuiting evaluation on Err
|
||||
#[macro_export]
|
||||
macro_rules! try(
|
||||
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user