about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorPhil Dawes <phil@phildawes.net>2015-04-04 21:47:40 +0100
committerPhil Dawes <phil@phildawes.net>2015-04-05 09:52:56 +0100
commite3427c3c341fcd15cbac783bf8dad7276422c97a (patch)
tree2c9b344ab6f07634ef7e00d9c3a71de1eb3509d9 /src/libsyntax
parentb2bcb7229a4bce0c9459807552d071eb2b2c9a0e (diff)
downloadrust-e3427c3c341fcd15cbac783bf8dad7276422c97a.tar.gz
rust-e3427c3c341fcd15cbac783bf8dad7276422c97a.zip
Add comments suggested by Niko
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs6
-rw-r--r--src/libsyntax/ext/asm.rs11
-rw-r--r--src/libsyntax/ext/format.rs11
-rw-r--r--src/libsyntax/lib.rs8
4 files changed, 9 insertions, 27 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index c746445e77e..8fe23a3c8e8 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -68,9 +68,9 @@ pub trait Emitter {
                    sp: RenderSpan, msg: &str, lvl: Level);
 }
 
-/// This structure is used to signify that a task has panicked with a fatal error
-/// from the diagnostics. You can use this with the `Any` trait to figure out
-/// how a rustc task died (if so desired).
+/// Used as a return value to signify a fatal error occurred. (It is also
+/// used as the argument to panic at the moment, but that will eventually
+/// not be true.)
 #[derive(Copy, Clone)]
 #[must_use]
 pub struct FatalError;
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index 3513f6d2bb9..f2b45d89f73 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -23,17 +23,6 @@ use parse::token::InternedString;
 use parse::token;
 use ptr::P;
 
-macro_rules! panictry {
-    ($e:expr) => ({
-        use std::result::Result::{Ok, Err};
-
-        match $e {
-            Ok(e) => e,
-            Err(e) => panic!(e),
-        }
-    })
-}
-
 enum State {
     Asm,
     Outputs,
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index fe3a05cfc44..1d99a475b32 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -24,17 +24,6 @@ use ptr::P;
 use std::collections::HashMap;
 use std::iter::repeat;
 
-macro_rules! panictry {
-    ($e:expr) => ({
-        use std::result::Result::{Ok, Err};
-
-        match $e {
-            Ok(e) => e,
-            Err(e) => { panic!(e); }
-        }
-    })
-}
-
 #[derive(PartialEq)]
 enum ArgumentType {
     Known(String),
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)
         }
     })
 }