]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/ty/context.rs
Initial work for doing minimum capture analysis for RFC-2229
[rust.git] / compiler / rustc_middle / src / ty / context.rs
index e9bc4b9b90dd5621b8d8182a7958dfe008befd4d..76ca0c51ce1c3b59c24ffbe936fa0a28889ecdec 100644 (file)
@@ -415,9 +415,10 @@ pub struct TypeckResults<'tcx> {
     /// entire variable.
     pub closure_captures: ty::UpvarListMap,
 
-    /// Given the closure ID this map provides the list of
-    /// `Place`s and how/why are they captured by the closure.
-    pub closure_capture_information: ty::CaptureInformationMap<'tcx>,
+    /// Given the closure DefId this map provides a map of
+    /// root variables to minimum set of `Place`s (and how) that need to be tracked
+    /// to support all captures of that closure.
+    pub closure_min_captures: ty::MinCaptureInformationMap<'tcx>,
 
     /// Stores the type, expression, span and optional scope span of all types
     /// that are live across the yield of this generator (if a generator).
@@ -446,7 +447,7 @@ pub fn new(hir_owner: LocalDefId) -> TypeckResults<'tcx> {
             tainted_by_errors: None,
             concrete_opaque_types: Default::default(),
             closure_captures: Default::default(),
-            closure_capture_information: Default::default(),
+            closure_min_captures: Default::default(),
             generator_interior_types: Default::default(),
         }
     }
@@ -681,7 +682,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             tainted_by_errors,
             ref concrete_opaque_types,
             ref closure_captures,
-            ref closure_capture_information,
+            ref closure_min_captures,
             ref generator_interior_types,
         } = *self;
 
@@ -715,7 +716,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             tainted_by_errors.hash_stable(hcx, hasher);
             concrete_opaque_types.hash_stable(hcx, hasher);
             closure_captures.hash_stable(hcx, hasher);
-            closure_capture_information.hash_stable(hcx, hasher);
+            closure_min_captures.hash_stable(hcx, hasher);
             generator_interior_types.hash_stable(hcx, hasher);
         })
     }