]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ast.rs
Switch syntax attribute tracking to BitVector
[rust.git] / src / libsyntax / ast.rs
index d59c9dd6b53e8fbc5399984ec1d81a0ec40ae4d6..28c1e4324de7a3070c90f2c4cce5a694dc3ce2e8 100644 (file)
@@ -23,6 +23,7 @@
 use print::pprust;
 use ptr::P;
 use rustc_data_structures::indexed_vec;
+use rustc_data_structures::indexed_vec::Idx;
 use symbol::{Symbol, keywords};
 use tokenstream::{ThinTokenStream, TokenStream};
 
@@ -1910,9 +1911,18 @@ pub enum AttrStyle {
     Inner,
 }
 
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, PartialOrd, Ord, Copy)]
 pub struct AttrId(pub usize);
 
+impl Idx for AttrId {
+    fn new(idx: usize) -> Self {
+        AttrId(idx)
+    }
+    fn index(self) -> usize {
+        self.0
+    }
+}
+
 /// Meta-data associated with an item
 /// Doc-comments are promoted to attributes that have is_sugared_doc = true
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]