From 45571f34aaaa904ef58484aad41233f815ccace9 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Fri, 16 Dec 2016 19:12:37 -0500 Subject: [PATCH] definitions: Add some documentation. --- src/librustc/hir/map/definitions.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 16b8880b36fe..4f64670f4827 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -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. @@ -26,6 +25,10 @@ use syntax::symbol::{Symbol, InternedString}; 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, @@ -110,7 +113,9 @@ impl Decodable for DefPathTable { } -/// 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,