]> git.lizzy.rs Git - rust.git/commitdiff
definitions: Add some documentation.
authorMichael Woerister <michaelwoerister@posteo.net>
Sat, 17 Dec 2016 00:12:37 +0000 (19:12 -0500)
committerMichael Woerister <michaelwoerister@posteo.net>
Sat, 17 Dec 2016 00:14:16 +0000 (19:14 -0500)
src/librustc/hir/map/definitions.rs

index 16b8880b36fea71f710fc3b81968e524842b598f..4f64670f482796bde55b37dda9a0d31df0bf0817 100644 (file)
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
 //! For each definition, we track the following data.  A definition
 //! here is defined somewhat circularly as "something with a def-id",
 //! but it generally corresponds to things like structs, enums, etc.
 use ty::TyCtxt;
 use util::nodemap::NodeMap;
 
+/// The DefPathTable maps DefIndexes to DefKeys and vice versa.
+/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
+/// stores the DefIndex of its parent.
+/// There is one DefPathTable for each crate.
 #[derive(Clone)]
 pub struct DefPathTable {
     index_to_key: Vec<DefKey>,
@@ -110,7 +113,9 @@ fn decode<D: Decoder>(d: &mut D) -> Result<DefPathTable, D::Error> {
 }
 
 
-/// The definition table containing node definitions
+/// The definition table containing node definitions.
+/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
+/// mapping from NodeIds to local DefIds.
 #[derive(Clone)]
 pub struct Definitions {
     table: DefPathTable,