about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-03-15 13:03:42 -0400
committerAlex Burka <aburka@seas.upenn.edu>2016-03-24 01:33:31 -0400
commit9799cacba3042420cc7b49d555289241cf0456e1 (patch)
tree7a08fce357b03fc4e9b5a53949dd52348c1aaddb /src/libsyntax
parentcd80c1bb5540fa2610a8f3d8a25560d1f0981400 (diff)
fatal error instead of ICE for impossible range during HIR lowering
End-less ranges (`a...`) don't parse but bad syntax extensions could
conceivably produce them. Unbounded ranges (`...`) do parse and are
caught here.

The other panics in HIR lowering are all for unexpanded macros, which
cannot be constructed by bad syntax extensions.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index ac1a07d1cb5..e096aa99024 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -19,6 +19,7 @@ pub use self::PathParameters::*;
 use attr::ThinAttributes;
 use codemap::{Span, Spanned, DUMMY_SP, ExpnId};
 use abi::Abi;
+use errors;
 use ext::base;
 use ext::tt::macro_parser;
 use parse::token::InternedString;
@@ -344,6 +345,10 @@ pub const DUMMY_NODE_ID: NodeId = !0;
 pub trait NodeIdAssigner {
     fn next_node_id(&self) -> NodeId;
     fn peek_node_id(&self) -> NodeId;
+
+    fn diagnostic(&self) -> &errors::Handler {
+        panic!("this ID assigner cannot emit diagnostics")
+    }
 }
 
 /// The AST represents all type param bounds as types.