Skip to content

Commit 45571f3

Browse files
definitions: Add some documentation.
1 parent 70944c2 commit 45571f3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/librustc/hir/map/definitions.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
1211
//! For each definition, we track the following data. A definition
1312
//! here is defined somewhat circularly as "something with a def-id",
1413
//! but it generally corresponds to things like structs, enums, etc.
@@ -26,6 +25,10 @@ use syntax::symbol::{Symbol, InternedString};
2625
use ty::TyCtxt;
2726
use util::nodemap::NodeMap;
2827

28+
/// The DefPathTable maps DefIndexes to DefKeys and vice versa.
29+
/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
30+
/// stores the DefIndex of its parent.
31+
/// There is one DefPathTable for each crate.
2932
#[derive(Clone)]
3033
pub struct DefPathTable {
3134
index_to_key: Vec<DefKey>,
@@ -110,7 +113,9 @@ impl Decodable for DefPathTable {
110113
}
111114

112115

113-
/// The definition table containing node definitions
116+
/// The definition table containing node definitions.
117+
/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
118+
/// mapping from NodeIds to local DefIds.
114119
#[derive(Clone)]
115120
pub struct Definitions {
116121
table: DefPathTable,

0 commit comments

Comments
 (0)