提交 27d8ea05 编写于 作者: A Alex Crichton

core: Implement and export the try! macro

This is used quite extensively by core::fmt
上级 f2af4ca3
......@@ -59,3 +59,9 @@ fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
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) })
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册