From 3ebf7b42bd930de73f376dd1b3f2060e00b0fe6d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 18 Jan 2012 18:52:09 -0800 Subject: rustc: Assert that the parser doesn't assign node id 0 It is reserved for indicating the crate, but doesn't exist in the AST --- src/comp/syntax/parse/parser.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 4a4b22c3e12..174851c4fcb 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -31,6 +31,8 @@ type parse_sess = @{ fn next_node_id(sess: parse_sess) -> node_id { let rv = sess.next_id; sess.next_id += 1; + // ID 0 is reserved for the crate and doesn't actually exist in the AST + assert rv != 0; ret rv; } -- cgit 1.4.1-3-g733a5