about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-10-25 17:59:18 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-02-26 10:30:27 +0000
commit7dcc74eee5584639c182aecdfe80a7f5369c5b69 (patch)
tree4fecd9e78b8cd8f05ff619bfb68f58d3685742bf /compiler/rustc_const_eval/src
parentd35dbbdc8ec3437807213ec103e42659467d9a77 (diff)
downloadrust-7dcc74eee5584639c182aecdfe80a7f5369c5b69.tar.gz
rust-7dcc74eee5584639c182aecdfe80a7f5369c5b69.zip
Access upvars through a query.
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/validity.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index e76d4c1728e..f7881c50960 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -240,10 +240,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
                 // FIXME this should be more descriptive i.e. CapturePlace instead of CapturedVar
                 // https://github.com/rust-lang/project-rfc-2229/issues/46
                 if let Some(local_def_id) = def_id.as_local() {
-                    let tables = self.ecx.tcx.typeck(local_def_id);
-                    if let Some(captured_place) =
-                        tables.closure_min_captures_flattened(local_def_id).nth(field)
-                    {
+                    let captures = self.ecx.tcx.closure_captures(local_def_id);
+                    if let Some(captured_place) = captures.get(field) {
                         // Sometimes the index is beyond the number of upvars (seen
                         // for a generator).
                         let var_hir_id = captured_place.get_root_variable();