From e3427c3c341fcd15cbac783bf8dad7276422c97a Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Sat, 4 Apr 2015 21:47:40 +0100 Subject: Add comments suggested by Niko --- src/libsyntax/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/lib.rs') diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index a8b6dae06b9..bf95daf8755 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -50,13 +50,17 @@ extern crate libc; extern crate serialize as rustc_serialize; // used by deriving +// A variant of 'try!' that panics on Err(FatalError). This is used as a +// crutch on the way towards a non-panic!-prone parser. It should be used +// for fatal parsing errors; eventually we plan to convert all code using +// panictry to just use normal try macro_rules! panictry { ($e:expr) => ({ use std::result::Result::{Ok, Err}; - + use diagnostic::FatalError; match $e { Ok(e) => e, - Err(e) => panic!(e) + Err(FatalError) => panic!(FatalError) } }) } -- cgit 1.4.1-3-g733a5