about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-11-22 16:53:17 -0500
committerNiko Matsakis <niko@alum.mit.edu>2017-12-04 09:14:38 -0500
commit18cc0f9f374e4dcd6e933164037654b39e841148 (patch)
tree636beb53548dbdea3c638ec52dd68980e2c20eda
parent2e63bb34199545042c049f67be3e3253520a85fc (diff)
downloadrust-18cc0f9f374e4dcd6e933164037654b39e841148.tar.gz
rust-18cc0f9f374e4dcd6e933164037654b39e841148.zip
document `closure_base_def_id`
-rw-r--r--src/librustc/ty/util.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index e19bab46402..129badc46d8 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -624,6 +624,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
         self.def_key(def_id).disambiguated_data.data == DefPathData::ClosureExpr
     }
 
+    /// Given the `DefId` of a fn or closure, returns the `DefId` of
+    /// the innermost fn item that the closure is contained within.
+    /// This is a significant def-id because, when we do
+    /// type-checking, we type-check this fn item and all of its
+    /// (transitive) closures together.  Therefore, when we fetch the
+    /// `typeck_tables_of` the closure, for example, we really wind up
+    /// fetching the `typeck_tables_of` the enclosing fn item.
     pub fn closure_base_def_id(self, def_id: DefId) -> DefId {
         let mut def_id = def_id;
         while self.is_closure(def_id) {