diff options
| author | bors <bors@rust-lang.org> | 2023-02-27 21:48:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-27 21:48:10 +0000 |
| commit | 6290ae92b2df2bfff09abdcb80a3aa483692bab6 (patch) | |
| tree | 8e49fd876e7847ee39461e51a00d197e4b1c5c70 /compiler/rustc_const_eval/src/interpret | |
| parent | 7281249a19a9755e9d889ee251ec323629caadab (diff) | |
| parent | cb51d2da7a590d230e8eae8e580ed8e8dee72bd6 (diff) | |
| download | rust-6290ae92b2df2bfff09abdcb80a3aa483692bab6.tar.gz rust-6290ae92b2df2bfff09abdcb80a3aa483692bab6.zip | |
Auto merge of #108487 - cjgillot:no-typeck-mir, r=oli-obk
Avoid invoking typeck from borrowck This PR attempts to reduce direct dependencies between typeck and MIR-related queries. The goal is to have all the information transit either through THIR or through dedicated queries that avoid depending on the whole `TypeckResults`. In a first commit, we store the type information that MIR building requires into THIR. This avoids edges between mir_built and typeck. In the second and third commit, we wrap informations around closures (upvars, kind origin and user-provided signature) to avoid borrowck depending on typeck information. There should be a single remaining borrowck -> typeck edge in the good path, due to inline consts.
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/validity.rs | 6 |
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(); |
