We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1d03fd commit 04eb681Copy full SHA for 04eb681
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
@@ -269,6 +270,16 @@ impl serialize::UseSpecializedDecodable for NodeId {
269
270
}
271
272
273
+impl indexed_vec::Idx for NodeId {
274
+ fn new(idx: usize) -> Self {
275
+ NodeId::new(idx)
276
+ }
277
+
278
+ fn index(self) -> usize {
279
+ self.as_usize()
280
281
+}
282
283
/// Node id used to represent the root of the crate.
284
pub const CRATE_NODE_ID: NodeId = NodeId(0);
285
0 commit comments