diff options
| author | Phil Dawes <phil@phildawes.net> | 2015-04-04 21:47:40 +0100 |
|---|---|---|
| committer | Phil Dawes <phil@phildawes.net> | 2015-04-05 09:52:56 +0100 |
| commit | e3427c3c341fcd15cbac783bf8dad7276422c97a (patch) | |
| tree | 2c9b344ab6f07634ef7e00d9c3a71de1eb3509d9 /src/libsyntax/lib.rs | |
| parent | b2bcb7229a4bce0c9459807552d071eb2b2c9a0e (diff) | |
| download | rust-e3427c3c341fcd15cbac783bf8dad7276422c97a.tar.gz rust-e3427c3c341fcd15cbac783bf8dad7276422c97a.zip | |
Add comments suggested by Niko
Diffstat (limited to 'src/libsyntax/lib.rs')
| -rw-r--r-- | src/libsyntax/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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) } }) } |
