diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-11 18:52:09 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-10-25 04:29:37 +0200 |
| commit | d7f6ba83fcf59fb32f1017ddff310c56a1008b3a (patch) | |
| tree | ab6ec606c70481256eee6f095defcf1b5c586b2a /src/libsyntax/parse | |
| parent | 10a52c25cad963986cace7a22c167363afca0d74 (diff) | |
| download | rust-d7f6ba83fcf59fb32f1017ddff310c56a1008b3a.tar.gz rust-d7f6ba83fcf59fb32f1017ddff310c56a1008b3a.zip | |
move panictry! to where it is used.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index e6b794a6a99..e6ddf8778cc 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -59,6 +59,23 @@ pub enum DirectoryOwnership { // uses a HOF to parse anything, and <source> includes file and // `source_str`. +/// 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; + match $e { + Ok(e) => e, + Err(errs) => { + for e in errs { + $handler.emit_diagnostic(&e); + } + FatalError.raise() + } + } + }) +} + pub fn parse_crate_from_file<'a>(input: &Path, sess: &'a ParseSess) -> PResult<'a, ast::Crate> { let mut parser = new_parser_from_file(sess, input); parser.parse_crate_mod() |
