about summary refs log tree commit diff
path: root/src/libsyntax/lib.rs
diff options
context:
space:
mode:
authorQuietMisdreavus <grey@quietmisdreavus.net>2018-11-01 16:01:38 -0500
committerQuietMisdreavus <grey@quietmisdreavus.net>2018-11-02 17:07:28 -0500
commit014c8c4c3872ff74169ffbbc3a69acd92be2a76c (patch)
tree5b0317314b848b087d62241ff5a98e9a38ca50b7 /src/libsyntax/lib.rs
parent0fe6aae49a1482c5cc163f990006f279a0eaf0e5 (diff)
downloadrust-014c8c4c3872ff74169ffbbc3a69acd92be2a76c.tar.gz
rust-014c8c4c3872ff74169ffbbc3a69acd92be2a76c.zip
implement existing parser fns in terms of fallible fns
Diffstat (limited to 'src/libsyntax/lib.rs')
-rw-r--r--src/libsyntax/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index 9077eca1821..e9a6535cba1 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -70,6 +70,23 @@ macro_rules! panictry {
     })
 }
 
+// A variant of 'panictry!' that works on a Vec<Diagnostic> instead of a single DiagnosticBuilder.
+macro_rules! panictry_buffer {
+    ($handler:expr, $e:expr) => ({
+        use std::result::Result::{Ok, Err};
+        use errors::{FatalError, DiagnosticBuilder};
+        match $e {
+            Ok(e) => e,
+            Err(errs) => {
+                for e in errs {
+                    DiagnosticBuilder::new_diagnostic($handler, e).emit();
+                }
+                FatalError.raise()
+            }
+        }
+    })
+}
+
 #[macro_export]
 macro_rules! unwrap_or {
     ($opt:expr, $default:expr) => {