]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Assert that the parser doesn't assign node id 0
authorBrian Anderson <banderson@mozilla.com>
Thu, 19 Jan 2012 02:52:09 +0000 (18:52 -0800)
committerBrian Anderson <banderson@mozilla.com>
Thu, 19 Jan 2012 03:59:24 +0000 (19:59 -0800)
It is reserved for indicating the crate, but doesn't exist in the AST

src/comp/syntax/parse/parser.rs

index 4a4b22c3e120a2f59a2953533e9888a2d6cb6489..174851c4fcbf30a975e6832f76eb7edd6b9416c5 100644 (file)
@@ -31,6 +31,8 @@
 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;
 }