about summary refs log tree commit diff
path: root/src/libsyntax/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/lib.rs')
-rw-r--r--src/libsyntax/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 39a9aff48bf..4c9a5d512af 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -65,6 +65,16 @@ macro_rules! panictry {
     })
 }
 
+#[macro_export]
+macro_rules! unwrap_or {
+    ($opt:expr, $default:expr) => {
+        match $opt {
+            Some(x) => x,
+            None => $default,
+        }
+    }
+}
+
 #[macro_use]
 pub mod diagnostics {
     #[macro_use]