We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e0589a commit 559127bCopy full SHA for 559127b
src/libsyntax/ast.rs
@@ -23,6 +23,7 @@ use abi::Abi;
23
use ext::hygiene::SyntaxContext;
24
use print::pprust;
25
use ptr::P;
26
+use rustc_data_structures::indexed_vec;
27
use symbol::{Symbol, keywords};
28
use tokenstream::{ThinTokenStream, TokenStream};
29
@@ -275,6 +276,16 @@ impl serialize::UseSpecializedDecodable for NodeId {
275
276
}
277
278
279
+impl indexed_vec::Idx for NodeId {
280
+ fn new(idx: usize) -> Self {
281
+ NodeId::new(idx)
282
+ }
283
+
284
+ fn index(self) -> usize {
285
+ self.as_usize()
286
287
+}
288
289
/// Node id used to represent the root of the crate.
290
pub const CRATE_NODE_ID: NodeId = NodeId(0);
291
0 commit comments