Skip to content

Commit 2af4a01

Browse files
committed
Document NodeId
1 parent f30733a commit 2af4a01

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

compiler/rustc_ast/src/node_id.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ use rustc_span::ExpnId;
22
use std::fmt;
33

44
rustc_index::newtype_index! {
5+
/// Identifies an AST node.
6+
///
7+
/// This identifies top-level definitions, expressions, and everything in between.
8+
/// This is later turned into [`DefId`] and `HirId` for the HIR.
9+
///
10+
/// [`DefId`]: rustc_span::def_id::DefId
511
pub struct NodeId {
612
DEBUG_FORMAT = "NodeId({})"
713
}
814
}
915

1016
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeId);
1117

12-
/// `NodeId` used to represent the root of the crate.
18+
/// The [`NodeId`] used to represent the root of the crate.
1319
pub const CRATE_NODE_ID: NodeId = NodeId::from_u32(0);
1420

1521
/// When parsing and doing expansions, we initially give all AST nodes this AST
16-
/// node value. Then later, during expansion, we renumber them to have small,
17-
/// positive ids.
22+
/// [`NodeId`]. Then later, during expansion, we renumber them to have small,
23+
/// positive IDs.
1824
pub const DUMMY_NODE_ID: NodeId = NodeId::MAX;
1925

2026
impl NodeId {

0 commit comments

Comments
 (0)